svnno****@sourc*****
svnno****@sourc*****
2009年 10月 26日 (月) 23:31:00 JST
Revision: 1374 http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=1374 Author: dhrname Date: 2009-10-26 23:31:00 +0900 (Mon, 26 Oct 2009) Log Message: ----------- NAIBU._ie_createFont処理を追加 Modified Paths: -------------- branches/05x/053/sie.js Modified: branches/05x/053/sie.js =================================================================== --- branches/05x/053/sie.js 2009-10-26 11:37:24 UTC (rev 1373) +++ branches/05x/053/sie.js 2009-10-26 14:31:00 UTC (rev 1374) @@ -1832,9 +1832,40 @@ } } catch(e) {stlog.add(e,17155);} }; -function pathData() { - +NAIBU._ie_createFont = function(/*Element*/ ti, /*Element*/ font) { + var node = ti.firstChild, data, glyphs = font.getElementsByTagName("GLYPH"); + var dx = parseFloat(ti.style.left), dy = parseFloat(ti.style.top), fontSize = parseFloat(ti.style.fontSize); + while(node) { + data = node.data; + if (data !== void 0) { //dataがある場合 + for (var i=0,gli=glyphs.length;i<gli;++i) { + var index = data.indexOf(glyphs[i].getAttribute("unicode")), path = document.createElement("v:shape"); + /*カーニング処理について(To DO) + *カーニングに該当する文字を検索して、ずらしたい長さだけ、以降のxとyから引く必要がある + */ + var x = dx * fontSize * index, y = dy * fontSize * index; + ti.inserBefore(path); + NAIBU.pathData(glyphs[i].getAttribute("d"), path, true, x, y); + } + } else { + NAIBU._ie_createFont(node, font); + } + node = node.nextSibling; + } } +NAIBU.pathData = function(/*string*/ data, /*Element*/ p, /*boolean*/ t, /*float*/x, y, w, h, fontSize, em) { + //CTMでフォントを移動させておく + var fe = fontSize / em, matrix = new STMatrix(fe, 0, 0, -fe, x*fe, -y*fe); + if (t) { //IEならば + var s = new STPath(p, matrix); + s.d = data; + s.set(w,h); + } else { + p.setAttributeNS(null, "transform", "matrix(" +matrix.a+ "," +matrix.b+ "," +matrix.c+ "," +matrix.d+ "," +matrix.e+ "," +matrix.f+ ")"); + } + fe = matrix = null; +}; + function utf16( /*string*/ s) { return unescape(s); }