# HG changeset patch # User Thinker K.F. Li # Date 1285417913 -28800 # Node ID d9d55bb50679273519e7bce99bcfe073a0abd883 # Parent a17c4e231e5410010ac1a02b2202c810288e1da9 Parse color and stroke width of tspan object correctly. Color and stroke width may inherited from parent node, a text. We can not use loadSVG._set_paint() that only parse current node. loadSVG._set_paint_style() are used to used inherited style by passing an aggreagated style. diff -r a17c4e231e54 -r d9d55bb50679 nodejs/svg.js --- a/nodejs/svg.js Sat Sep 25 20:12:45 2010 +0800 +++ b/nodejs/svg.js Sat Sep 25 20:31:53 2010 +0800 @@ -229,7 +229,7 @@ tcoord.set_text = tspan_set_text; tcoord.text = obj; - this._set_paint(n, obj); + this._set_paint_style(style, obj); this._set_bbox(n, obj); make_mbnames(this.mb_rt, n, tcoord); @@ -650,8 +650,7 @@ return 1; } -loadSVG.prototype._set_paint = function(node, tgt) { - var style; +loadSVG.prototype._set_paint_style = function(style, tgt) { var paint; var fill_alpha = 1; var stroke_alpha = 1; @@ -662,7 +661,6 @@ var black_paint; var i; - style = parse_style(node); if(style) { if('opacity' in style) alpha = parseFloat(style['opacity']); @@ -703,6 +701,13 @@ tgt.stroke_width = stroke_width; }; +loadSVG.prototype._set_paint = function(node, tgt) { + var style; + + style = parse_style(node); + this._set_paint_style(style, tgt); +}; + function formalize_path_data(d) { var posM, posm; var pos;