t.prototype._list = null; //文字の位置を格納しておくリストのキャッシュ
t.prototype._length = 0; //全文字数
t.prototype._stx = t.prototype._sty = 0; //初めの文字の位置
- t.prototype._chars = 0; //tspan要素が全体の何文字目から始まっているか
+ t.prototype._chars = 0; //tspan (tref)要素が全体の何文字目から始まっているか
t.prototype._isYokogaki = true; //横書きかどうか
/*long*/ t.prototype.getNumberOfChars = function() {
return (this._length);
while (ti) {
if (ti.nodeType === /*Node.TEXT_NODE*/ 3) {
tt = ti._tars;
- /*tspan要素のx属性で指定された座標の個数よりも、文字数が多い場合は、祖先(親)のx属性を
+ /*tspan(tref)要素のx属性で指定された座標の個数よりも、文字数が多い場合は、祖先(親)のx属性を
*使う。また、属性が指定されていないときも同様に祖先や親を使う。
*もし、仮に祖先や親がx属性を指定されていなければ、現在のテキスト位置(変数xに格納している)を使う。
*この処理はdx属性やdy、y属性でも同様とする
ti = ti.parentNode;
}
ti = ti.nextSibling;
- } else if ((ti.localName === "tspan") && (ti.namespaceURI === "http://www.w3.org/2000/svg") && ti.firstChild) {
- /*現在のテキスト位置(x,y)の分だけ、tspan要素をずらしておく。
+ } else if (((ti.localName === "tspan") || (ti.localName === "tref"))
+ && (ti.namespaceURI === "http://www.w3.org/2000/svg") && ti.firstChild) {
+ /*現在のテキスト位置(x,y)の分だけ、tspan (tref)要素をずらしておく。
*さらに、現在のテキスト位置を更新する
*/
ti._stx = x;
function SVGTextElement(_doc) {
SVGTextPositioningElement.apply(this, arguments);
-
return this;
};
SVGTextElement.constructor = SVGTextPositioningElement;
function SVGTRefElement(_doc) {
SVGTextPositioningElement.apply(this, arguments);
+ this.addEventListener("DOMNodeInserted", function(evt){
+ if (evt.eventPhase === /*Event.BUBBLING_PHASE*/ 3) {
+ return; //強制終了させる
+ }
+ evt.target.setAttributeNS("http://www.w3.org/1999/xlink", "xlink:show", "embed");
+ }, false);
+ this.addEventListener("S_Load", function(evt){
+ var tar = evt.target,
+ tic = tar._instance.firstChild;
+ /*textノードのデータだけを処理*/
+ while (tic && (tic.nodeName !== "#text")) {
+ tic = tic.nextSibling;
+ }
+ tic && tar.appendChild(tar.ownerDocument.importNode(tic, false));
+ tar = tic = evtt = void 0;
+ }, false);
SVGURIReference.apply(this, arguments);
return this;
};