The Birdfont Source Code


All Repositories / birdfont.git / commit – RSS feed

Fix SVG font export

These changes was commited to the Birdfont repository Sat, 03 Dec 2016 19:28:36 +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>
Sat, 03 Dec 2016 19:28:36 +0000 (20:28 +0100)
committer Johan Mattsson <johan.mattsson.m@gmail.com>
Sat, 03 Dec 2016 19:34:21 +0000 (20:34 +0100)
commit 5685625bc81b6f853e1991edb1cd472c79e85c36
tree 98b874cf458ca6de181d4fde8a0da4f0728fbeb6
parent e6ed46b64dcae27927d420e2c8f5be6a2b96c1a6
Fix SVG font export

Remove space in id, export font name and store default advancement

libbirdfont/SvgFontFormatWriter.vala
--- a/libbirdfont/SvgFontFormatWriter.vala +++ b/libbirdfont/SvgFontFormatWriter.vala @@ -59,8 +59,16 @@ put ("<defs>"); - put (@"<font id=\"$font_name\" horiz-adv-x=\"250\" >"); + string font_id = font_name.replace (" ", "-"); + Glyph space = font.get_space ().get_current (); + double space_width = space.get_width (); + + put (@"<font id=\"$font_id\" horiz-adv-x=\"$(to_float (space_width))\" >"); put (@"<font-face units-per-em=\"$(to_float (units_per_em))\" ascent=\"$(to_float (ascent))\" descent=\"$(to_float (descent))\" />"); + + put (@"<font-src>"); + put (@"\t<font-face-name=\"$font_name\">"); + put (@"</font-src>"); // (missing-glyph goes here)