Mercurial > MadButterfly
changeset 902:e86b4d56ddea
Parse font-style and font-weight of SVG text
author | Thinker K.F. Li <thinker@codemud.net> |
---|---|
date | Fri, 01 Oct 2010 12:20:26 +0800 |
parents | 74e3ba4d3fa1 |
children | 62ef69e02e85 55767e444436 |
files | nodejs/svg.js |
diffstat | 1 files changed, 11 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/nodejs/svg.js Fri Oct 01 12:05:23 2010 +0800 +++ b/nodejs/svg.js Fri Oct 01 12:20:26 2010 +0800 @@ -205,6 +205,8 @@ var tcoord = this.mb_rt.coord_new(coord); var style; var family = "Courier"; + var weight = 80; + var slant = 0; var sz = 10; var face; var k; @@ -221,8 +223,16 @@ family = style["font-family"]; if("font-size" in style) sz = _parse_font_size(style["font-size"]); + if("font-weight" in style) { + if(style["font-weight"] == "bold") + weight = 200; + } + if("font-style" in style) { + if(style["font-style"] == "oblique") + slant = 110; + } - face = this.mb_rt.font_face_query(family, 100, 210); + face = this.mb_rt.font_face_query(family, slant, weight); obj.set_style([[n.text().length, face, sz]]); tcoord.add_shape(obj);