svnno****@sourc*****
svnno****@sourc*****
2009年 11月 23日 (月) 22:11:44 JST
Revision: 1432 http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=1432 Author: dhrname Date: 2009-11-23 22:11:44 +0900 (Mon, 23 Nov 2009) Log Message: ----------- orientation属性を実装 Modified Paths: -------------- branches/05x/055/sie.js Modified: branches/05x/055/sie.js =================================================================== --- branches/05x/055/sie.js 2009-11-23 10:18:19 UTC (rev 1431) +++ branches/05x/055/sie.js 2009-11-23 13:11:44 UTC (rev 1432) @@ -1983,13 +1983,23 @@ var advanceX = [], glyphData = []; for (var i=0,gli=glyphs.length;i<gli;++i) { var glyph = glyphs[i], unicode = glyph.getAttribute("unicode") || "なし"; //unicode属性に指定がない場合、処理させないようにする - //indexは該当する文字が何番目にあるかの数字 - var index = data.indexOf(unicode); - while (index > -1) { - advanceX[index] = parseFloat(glyph.getAttribute(horizOrVert) || advX); //字幅を収納 - glyphData[index] = glyph.getAttribute("d"); - index = data.indexOf(unicode, index+1); + var orientation = glyph.getAttribute("orientation"), isVert = true, isOrientationAttribute = true; + if (orientation) { + if (orientation === "h") { + isVert = false; + } + } else { + isOrientationAttribute = false; } + if ( (isTategaki && isVert) || !(isTategaki || isVert) || !isOrientationAttribute){ + //indexは該当する文字が何番目にあるかの数字 + var index = data.indexOf(unicode); + while (index > -1) { + advanceX[index] = parseFloat(glyph.getAttribute(horizOrVert) || advX); //字幅を収納 + glyphData[index] = glyph.getAttribute("d"); + index = data.indexOf(unicode, index+1); + } + } } for (var i=0,adv=0;i<data.length;++i) { if (advanceX[i] !== void 0) { //配列に含まれていれば @@ -2083,14 +2093,24 @@ if (data !== void 0) { //dataがある場合 var advanceX = [], glyphData = []; for (var i=0,gli=glyphs.length;i<gli;++i) { - var glyph = glyphs[i], unicode = glyph.getAttributeNS(null, "unicode") || "なし"; //unicode属性に指定がない場合、処理させないようにする - //indexは該当する文字が何番目にあるかの数字 - var index = data.indexOf(unicode); - while (index > -1) { - advanceX[index] = parseFloat(glyph.getAttributeNS(null, horizOrVert) || advX); //字幅を収納 - glyphData[index] = glyph.getAttributeNS(null, "d"); - index = data.indexOf(unicode, index+1); + var glyph = glyphs[i], unicode = glyph.getAttributeNS(null, "unicode") || "なし"; //unicode属性に指定がない場合、処理させないようにする + var orientation = glyph.getAttributeNS(null, "orientation"), isVert = true, isOrientationAttribute = true; + if (orientation) { + if (orientation === "h") { + isVert = false; + } + } else { + isOrientationAttribute = false; } + if ( (isTategaki && isVert) || !(isTategaki || isVert) || !isOrientationAttribute){ + //indexは該当する文字が何番目にあるかの数字 + var index = data.indexOf(unicode); + while (index > -1) { + advanceX[index] = parseFloat(glyph.getAttributeNS(null, horizOrVert) || advX); //字幅を収納 + glyphData[index] = glyph.getAttributeNS(null, "d"); + index = data.indexOf(unicode, index+1); + } + } } for (var i=0,adv=0;i<data.length;++i) { if (advanceX[i] !== void 0) { //配列に含まれていれば