svnno****@sourc*****
svnno****@sourc*****
2010年 5月 2日 (日) 23:42:38 JST
Revision: 1812 http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=1812 Author: dhrname Date: 2010-05-02 23:42:38 +0900 (Sun, 02 May 2010) Log Message: ----------- Modified Paths: -------------- branches/ufltima/dom/svg.js Modified: branches/ufltima/dom/svg.js =================================================================== --- branches/ufltima/dom/svg.js 2010-05-01 14:06:17 UTC (rev 1811) +++ branches/ufltima/dom/svg.js 2010-05-02 14:42:38 UTC (rev 1812) @@ -2663,7 +2663,7 @@ } else { var ptx = pty = ptdx = ptdy = {numberOfItems : 0}; } - var kern = "fijlt.,:;1'", akern = "abcdghkmnopqsuvwxyz", alm = 0; + var kern = "fijlt.,IJ:;1'", akern = "abcdeghknopqsuvxyz"; ; while (ti) { if (ti.nodeType === Node.TEXT_NODE) { @@ -2689,28 +2689,27 @@ } else if (n < tdy.numberOfItems) { y += tdy.getItem(n).value; } + var alm = 0; if (isYokogaki) { - if (kern.indexOf(ti.data.charAt(i)) > -1) { //カーニングを求める - if (alm === 0) { - alm = fontSize/2; - } else { - alm = 0; - } - x -= alm; - } else if(akern.indexOf(ti.data.charAt(i)) > -1){ - if (alm === 0) { - x = x - fontSize/2; - } - alm = 0; + var tdc = ti.data.charAt(i); + if (kern.indexOf(tdc) > -1) { //カーニングを求める + alm = fontSize / 2; + } else if(tdc === "r"){ + alm = fontSize * 0.2; + } else if(akern.indexOf(tdc) > -1){ + } else { + alm = -fontSize * 0.4; } + } + tar._list[tar._list.length] = x; + tar._list[tar._list.length] = y; + tar._list[tar._list.length] = fontSize - alm; + if (isYokogaki) { x += fontSize; + x -= alm; } else { y += fontSize; } - tar._list[tar._list.length] = x; - tar._list[tar._list.length] = y; - tar._list[tar._list.length] = fontSize - alm; - x -= alm; ++n; } } else if ((ti.localName === "tspan") && (ti.namespaceURI === "http://www.w3.org/2000/svg") && ti.firtChild) { @@ -2758,7 +2757,7 @@ } else { var s = this.getStartPositionOfChar(charnum); //アドバンス値(すなわちフォントの大きさ)をCTMの行列式を用いて、算出する - var n = this._list[charnum*3 + 2] * Math.sqrt(Math.abs(this.getScreenCTM().determinant())); + var n = this._list[charnum*3 + 2] * Math.sqrt(Math.abs(this.getScreenCTM()._determinant())); if (this._isYokogaki) { s.x += n; } else { @@ -2864,7 +2863,8 @@ tar.addEventListener("DOMNodeInsertedIntoDocument", function(evt) { var tar = evt.target, ti = tar.firstChild; var style = tar.ownerDocument.defaultView.getComputedStyle(tar, null); - tar._tar.style.fontSize = style.getPropertyValue("font-size") + "px"; + var n = parseFloat(style.getPropertyValue("font-size")) * Math.sqrt(Math.abs(tar.getScreenCTM()._determinant())); + tar._tar.style.fontSize = n + "px"; for (var i=0, j=0, tli=tar.getNumberOfChars();i<tli;++i) { if (ti) { var p = tar.getStartPositionOfChar(i-j);