svnno****@sourc*****
svnno****@sourc*****
2009年 11月 2日 (月) 22:43:16 JST
Revision: 1389
http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=1389
Author: dhrname
Date: 2009-11-02 22:43:16 +0900 (Mon, 02 Nov 2009)
Log Message:
-----------
fontSizeの調整
Modified Paths:
--------------
branches/05x/053/sie.js
Modified: branches/05x/053/sie.js
===================================================================
--- branches/05x/053/sie.js 2009-11-02 11:36:23 UTC (rev 1388)
+++ branches/05x/053/sie.js 2009-11-02 13:43:16 UTC (rev 1389)
@@ -1873,7 +1873,7 @@
}
};
NAIBU._ie_createFont = function(/*Element*/ ti, /*Element*/ font) {
- var node = ti.firstChild, data, glyphs = font.getElementsByTagName("glyph");
+ var node = ti.firstChild, data, glyphs = font.getElementsByTagName("glyph"), em = font.getElementsByTagName("font-face").item(0).getAttribute("units-per-em");
var dx = parseFloat(ti.style.left), dy = parseFloat(ti.style.top), fontSize = parseFloat(ti.style.fontSize);
while(node) {
data = node.data;
@@ -1883,8 +1883,8 @@
if (index > -1) {
//fontSizeと文字数をかけた長さ分、ずらしていく
var x = dx + fontSize * index, y = dy + fontSize * index;
- ti.insertBefore(path);
- NAIBU.pathData(glyphs[i].getAttribute("d"), path, true, x, y, ti.w, ti.h, fontSize, 1000);
+ ti.parentNode.insertBefore(path, ti);
+ NAIBU.pathData(glyphs[i].getAttribute("d"), path, true, x, y, ti.w, ti.h, fontSize, parseFloat(em || 1000));
}
}
} else {
@@ -1954,7 +1954,7 @@
};
NAIBU.pathData = function(/*string*/ data, /*Element*/ p, /*boolean*/ t, /*float*/x, y, w, h, fontSize, em) {
//CTMでフォントを移動させておく
- var fe = fontSize / em, matrix = new Matrix(fe, 0, 0, -fe, x*fe, -y*fe);
+ var fe = fontSize / em, matrix = new Matrix(fe, 0, 0, -fe, x*fe, -y*fe - em*fontSize);
if (t) { //IEならば
var s = new STPath(p, matrix);
s.d = data;