svnno****@sourc*****
svnno****@sourc*****
2010年 1月 15日 (金) 22:39:10 JST
Revision: 1584
http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=1584
Author: dhrname
Date: 2010-01-15 22:39:10 +0900 (Fri, 15 Jan 2010)
Log Message:
-----------
チケット #20295 「SVGFontを使ったとき、text要素の属性が反映されない」を修正
Ticket Links:
:-----------
http://sourceforge.jp/projects/sie/tracker/detail/20295
Modified Paths:
--------------
branches/05x/058/sie.js
Modified: branches/05x/058/sie.js
===================================================================
--- branches/05x/058/sie.js 2010-01-15 13:00:46 UTC (rev 1583)
+++ branches/05x/058/sie.js 2010-01-15 13:39:10 UTC (rev 1584)
@@ -2172,7 +2172,7 @@
var em = parseFloat(font.getElementsByTagNameNS(NAIBU.svgNameSpace, "font-face").item(0).getAttribute("units-per-em") || 0);
var advX = parseFloat( (font.getAttributeNS(null, horizOrVert) || em) ); //字幅の設定
var dx = parseFloat(ti.getAttributeNS(null, "x") || 0), fontSize = parseFloat(style.fontSize), dy = parseFloat(ti.getAttributeNS(null, "y") || 0), fe = fontSize / em;
- var ds = false;
+ var ds = false, npdlist = NAIBU.PaintColor.prototype.defaultsList;
if (/a/[-1] === 'a') { //Firefoxならば
ds = true;
} else {
@@ -2209,9 +2209,11 @@
if (advanceX[i] !== void 0) { //配列に含まれていれば
var path = ti.ownerDocument.createElementNS(NAIBU.svgNameSpace, "path");
//advance、すなわち字幅の長さ分、ずらしていく
- ti.parentNode.insertBefore(path, ti);
- path.setAttributeNS(null, "style", style.cssText);
var matrix = new Matrix(fe, 0, 0, -fe, 0, 0);
+ for (var j=0;j<npdlist.length;++j){
+ var nj = npdlist[j].replace(/(fill|stroke)(\w)/, "$1-$2");
+ path.setAttributeNS(null, nj, ti.getAttributeNS(null, nj));
+ }
if (isTategaki) {
var y= dy + adv*fe, x = dx;
if ("、。".indexOf(data.charAt(i)) > -1) { //句読点の場合
@@ -2228,6 +2230,7 @@
}
path.setAttributeNS(null, "transform", "matrix(" +matrix.a+ "," +matrix.b+ "," +matrix.c+ "," +matrix.d+ "," +matrix.e+ "," +matrix.f+ ")");
path.setAttributeNS(null, "d", glyphData[i]);
+ ti.parentNode.insertBefore(path, ti);
adv += advanceX[i];
matrix = null;
}