The Birdfont Source Code


All Repositories / birdfont.git / commit – RSS feed

Use the SVG stroke style

These changes was commited to the Birdfont repository Wed, 20 May 2015 11:18:29 +0000.

Contributing

Send patches or pull requests to johan.mattsson.m@gmail.com.
Clone this repository: git clone https://github.com/johanmattssonm/birdfont.git
author Johan Mattsson <johan.mattsson.m@gmail.com>
Wed, 20 May 2015 11:18:29 +0000 (13:18 +0200)
committer Johan Mattsson <johan.mattsson.m@gmail.com>
Wed, 20 May 2015 11:19:12 +0000 (13:19 +0200)
commit 5949cad5dbf1b781152401263d3d7de30328481f
tree 1ea40ac792bff2169b79a7a2f9153980cf57bd6b
parent d05c39a521f30c8247d298372182fe144b60016b
Use the SVG stroke style

README.md
libbirdfont/SvgParser.vala
libbirdfont/SvgStyle.vala
--- a/README.md +++ b/README.md @@ -22,6 +22,7 @@ python-gtk2-dev libwebkitgtk-3.0-dev libnotify-dev + libsqlite3-dev unicode-data (unicode character database) BirdFont have two build systems, one python script that builds all
--- a/libbirdfont/SvgParser.vala +++ b/libbirdfont/SvgParser.vala @@ -534,7 +534,12 @@ pl.paths.append (path_list); foreach (Path p in path_list.paths) { - p.stroke = style.get_stroke_width (); + if (style.has_stroke ()) { + p.stroke = style.get_stroke_width (); + } else { + p.stroke = 0; + } + p.line_cap = style.get_line_cap (); p.reset_stroke (); p.update_region_boundaries ();
--- a/libbirdfont/SvgStyle.vala +++ b/libbirdfont/SvgStyle.vala @@ -43,6 +43,16 @@ return LineCap.BUTT; } + public bool has_stroke () { + bool s = true; + + if (style.has_key ("stroke")) { + s = style.get ("stroke") != "none"; + } + + return get_stroke_width () > 0 && s; + } + public double get_stroke_width () { if (!style.has_key ("stroke-width")) { return 0;