The Birdfont Source Code


All Repositories / birdfont.git / commit – RSS feed

Move imported and exported SVG files

These changes was commited to the Birdfont repository Fri, 24 Jun 2016 16:24:40 +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>
Fri, 24 Jun 2016 16:24:40 +0000 (18:24 +0200)
committer Johan Mattsson <johan.mattsson.m@gmail.com>
Fri, 24 Jun 2016 16:24:40 +0000 (18:24 +0200)
commit e943183a5ea57ab1ec626169ac46779ab2785d29
tree fb3721adae741f0ea710c812b918b4ca7683bbb5
parent 0c8dd22e9f5d4eccfe94e5bebd7683414a73018b
Move imported and exported SVG files

libbirdfont/ExportTool.vala
libbirdfont/SvgParser.vala
--- a/libbirdfont/ExportTool.vala +++ b/libbirdfont/ExportTool.vala @@ -36,8 +36,10 @@ public static string export_to_string (Glyph glyph, bool only_selected_paths) { string name; - StringBuilder s; - + StringBuilder s; + Font font; + + font = BirdFont.get_current_font (); name = XmlParser.encode (glyph.get_name ()); s = new StringBuilder (); @@ -50,7 +52,7 @@ x="0px" y="0px" width=""" + "\"" + @"$(glyph.get_width ())" + """px" - height=""" + "\"" + @"$(glyph.get_height ())" + """px"> + height=""" + "\"" + @"$(font.top_position - font.bottom_position)" + """px"> """); s.append (@"<g id=\"$(name)\">\n");
--- a/libbirdfont/SvgParser.vala +++ b/libbirdfont/SvgParser.vala @@ -66,6 +66,12 @@ public static void import_color_svg (Glyph glyph, string path) { EmbeddedSvg drawing = SvgParser.parse_embedded_svg_file (path); glyph.add_object (drawing); + drawing.update_boundaries_for_object (); + + Font font = BirdFont.get_current_font (); + + drawing.x = glyph.left_limit; + drawing.y = font.top_position - font.base_line; } public static void import_folder (SvgType type) {