The Birdfont Source Code


All Repositories / birdfont.git / commit – RSS feed

Replace libxml2 with libbirdxml

These changes was commited to the Birdfont repository Thu, 25 Sep 2014 16:20:24 +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>
Thu, 25 Sep 2014 16:20:24 +0000 (18:20 +0200)
committer Johan Mattsson <johan.mattsson.m@gmail.com>
Thu, 25 Sep 2014 16:21:01 +0000 (18:21 +0200)
commit 9cf394e2e99db9f934d65d99b1b02a7920075a60
tree fd5e690954e09f1f45997c6499a88da2ea1010e0
parent 68173e69cfb4b1dd3fc2ca6df0909d372f10aab5
Replace libxml2 with libbirdxml
This commit does also remove the deprecated ffi support. BirdFont 1.4
or older can be used to convert ffi files to the new bf font format.

12 files changed:
dodo.py
install.py
libbirdfont/BirdFontFile.vala
libbirdfont/Kerning.vala
libbirdfont/KerningClasses.vala
libbirdfont/OpenFontFormat/KerningPair.vala
libbirdfont/SvgFont.vala
libbirdfont/SvgParser.vala
libbirdxml/Tag.vala
libbirdxml/Xml.vala
scripts/build.py
diff --git a/dodo.py b/dodo.py
--- a/dodo.py +++ b/dodo.py @@ -44,7 +44,6 @@ # external Vala libs LIBS = [ 'glib-2.0', - 'libxml-2.0', 'gio-2.0', 'cairo', 'gdk-pixbuf-2.0', @@ -100,7 +99,7 @@ libbird = Vala(src='libbirdfont', build='build', library='birdfont', so_version=version.SO_VERSION, pkg_libs=LIBS, vala_deps=[libbirdxml]) def task_libbirdfont(): yield libbird.gen_c(valac_options) - yield libbird.gen_o(['-fPIC', """-D 'GETTEXT_PACKAGE="birdfont"'"""]) + yield libbird.gen_o(['-fPIC -I./build/', """-D 'GETTEXT_PACKAGE="birdfont"'"""]) yield libbird.gen_so() yield libbird.gen_ln()
--- a/install.py +++ b/install.py @@ -103,7 +103,7 @@ #library if not options.libdir: - if platform.dist()[0] == 'Ubuntu': + if platform.dist()[0] == 'Ubuntu' or platform.dist()[0] == 'Debian': process = subprocess.Popen(['dpkg-architecture', '-qDEB_HOST_MULTIARCH'], stdout=subprocess.PIPE) out, err = process.communicate() libdir = '/lib/' + out.rstrip ('\n')
--- a/libbirdfont/BirdFontFile.vala +++ b/libbirdfont/BirdFontFile.vala @@ -11,7 +11,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ - using Xml; + using Bird; namespace BirdFont { @@ -31,38 +31,30 @@ * @param path path to a valid .bf file */ public bool load (string path) { - TextReader tr; + string xml_data; + XmlParser parser; bool ok; - - Parser.init (); + + FileUtils.get_contents(path, out xml_data); font.background_images.clear (); - font.font_file = path; - tr = new TextReader.filename (path); - if (is_null (tr)) { - warning (@"Failed to create TextReader for path: $path"); - } - - ok = load_xml (tr); - - // This causes a crash on windows - // Parser.cleanup (); + parser = new XmlParser (xml_data); + ok = load_xml (parser); return ok; } public bool load_part (string bfp_file) { - TextReader tr; + string xml_data; + XmlParser parser; bool ok; - Parser.init (); - tr = new TextReader.filename (bfp_file); - ok = load_xml (tr); + + FileUtils.get_contents(bfp_file, out xml_data); + parser = new XmlParser (xml_data); + ok = load_xml (parser); - // This causes a crash on windows - // Parser.cleanup (); - return ok; } @@ -70,33 +62,23 @@ * @param xml_data data for a valid .bf file */ public bool load_data (string xml_data) { - TextReader tr; bool ok; + XmlParser parser; - Parser.init (); font.font_file = "typeface.bf"; - tr = new TextReader.for_doc (xml_data, ""); - ok = load_xml (tr); - Parser.cleanup (); + parser = new XmlParser (xml_data); + ok = load_xml (parser); return ok; } - private bool load_xml (TextReader tr) { + private bool load_xml (XmlParser parser) { bool ok = true; - Xml.Node* root; - tr.read (); - root = tr.expand (); - - if (!is_null (root)) { - create_background_files (root); - ok = parse_file (root); - } else { - warning ("No root element"); - } + create_background_files (parser.get_next_tag ()); - tr.close (); + parser.reparse (); + ok = parse_file (parser.get_next_tag ()); return ok; } @@ -593,98 +575,83 @@ } } - private bool parse_file (Xml.Node* root) { - Xml.Node* node = root; - for (Xml.Node* iter = node->children; iter != null; iter = iter->next) { + private bool parse_file (Tag tag) { + Tag t; + + tag.reparse (); + while (tag.has_more_tags ()) { + t = tag.get_next_tag (); - // this is a backup file set path to the original - if (iter->name == "backup") { - font.font_file = iter->children->content; - } - - // old glyph format - if (iter->name == "glyph") { - parse_ffi_glyph (iter); + // this is a backup file, but path pointing to the original file + if (t.get_name () == "backup") { + font.font_file = t.get_content (); } - // new glyph format - if (iter->name == "collection") { - parse_glyph_collection (iter); - } - - // horizontal lines in the old format - if (iter->name == "lines") { - parse_font_boundaries (iter); + // glyph format + if (t.get_name () == "collection") { + parse_glyph_collection (t); } // horizontal lines in the new format - if (iter->name == "horizontal") { - parse_horizontal_lines (iter); + if (t.get_name () == "horizontal") { + parse_horizontal_lines (t); } // grid buttons - if (iter->name == "grid") { - parse_grid (iter); + if (t.get_name () == "grid") { + parse_grid (t); } - if (iter->name == "background") { - parse_background (iter); - } - - if (iter->name == "images") { - parse_background_selection (iter); + if (t.get_name () == "background") { + parse_background (t); } - if (iter->name == "postscript_name" && iter->children != null) { - font.postscript_name = iter->children->content; + if (t.get_name () == "postscript_name") { + font.postscript_name = t.get_content (); } - if (iter->name == "name" && iter->children != null) { - font.name = iter->children->content; + if (t.get_name () == "name") { + font.name = t.get_content (); } - if (iter->name == "subfamily" && iter->children != null) { - font.subfamily = iter->children->content; + if (t.get_name () == "subfamily") { + font.subfamily = t.get_content (); } - if (iter->name == "bold" && iter->children != null) { - font.bold = bool.parse (iter->children->content); + if (t.get_name () == "bold") { + font.bold = bool.parse (t.get_content ()); } - if (iter->name == "italic" && iter->children != null) { - font.italic = bool.parse (iter->children->content); + if (t.get_name () == "italic") { + font.italic = bool.parse (t.get_content ()); } - if (iter->name == "full_name" && iter->children != null) { - font.full_name = iter->children->content; + if (t.get_name () == "full_name") { + font.full_name = t.get_content (); } - if (iter->name == "unique_identifier" && iter->children != null) { - font.unique_identifier = iter->children->content; + if (t.get_name () == "unique_identifier") { + font.unique_identifier = t.get_content (); } - if (iter->name == "version" && iter->children != null) { - font.version = iter->children->content; + if (t.get_name () == "version") { + font.version = t.get_content (); } - if (iter->name == "description" && iter->children != null) { - font.description = iter->children->content; + if (t.get_name () == "description") { + font.description = t.get_content (); } - if (iter->name == "copyright" && iter->children != null) { - font.copyright = iter->children->content; - } - - if (iter->name == "hkern") { - parse_old_kerning (iter); + if (t.get_name () == "copyright") { + font.copyright = t.get_content (); } - if (iter->name == "kerning") { - parse_kerning (iter); + if (t.get_name () == "kerning") { + parse_kerning (t); } - if (iter->name == "spacing") { - parse_spacing_class (iter); + if (t.get_name () == "spacing") { + parse_spacing_class (t); } TooltipArea.show_text (t_("Loading XML data.")); @@ -694,15 +661,18 @@ return true; } - private void create_background_files (Xml.Node* root) requires (root != null) { - for (Xml.Node* iter = root->children; iter != null; iter = iter->next) { - if (iter->name == "name" && iter->children != null) { - font.set_name (iter->children->content); - } + private void create_background_files (Tag root) { + Tag child; + while (root.has_more_tags ()) { + child = root.get_next_tag (); - if (iter->name == "background-image") { - parse_background_image (iter); + if (child.get_name () == "name") { + font.set_name (child.get_content ()); } + + if (child.get_name () == "background-image") { + parse_background_image (child); + } } } @@ -725,56 +695,54 @@ return GlyphRange.get_serialized_char (c); } - private void parse_spacing_class (Xml.Node* node) { - string attr_name; - string attr_content; + private void parse_spacing_class (Tag tag) { string first, next; SpacingClassTab spacing_class_tab = MainWindow.get_spacing_class_tab (); + Attribute attr; first = ""; next = ""; - for (Xml.Attr* prop = node->properties; prop != null; prop = prop->next) { - attr_name = prop->name; - attr_content = prop->children->content; + tag.reparse (); + while (tag.has_more_attributes ()) { + attr = tag.get_next_attribute (); - if (attr_name == "first") { - first = (!) Font.to_unichar (attr_content).to_string (); + if (attr.get_name () == "first") { + first = (!) Font.to_unichar (attr.get_content ()).to_string (); } - if (attr_name == "next") { - next = (!) Font.to_unichar (attr_content).to_string (); + if (attr.get_name () == "next") { + next = (!) Font.to_unichar (attr.get_content ()).to_string (); } } spacing_class_tab.add_class (first, next); } - private void parse_kerning (Xml.Node* node) { - string attr_name; - string attr_content; + private void parse_kerning (Tag tag) { GlyphRange range_left, range_right; double hadjustment = 0; KerningRange kerning_range; + Attribute attr; try { range_left = new GlyphRange (); range_right = new GlyphRange (); - - for (Xml.Attr* prop = node->properties; prop != null; prop = prop->next) { - attr_name = prop->name; - attr_content = prop->children->content; - - if (attr_name == "left") { - range_left.parse_ranges (unserialize (attr_content)); + + tag.reparse (); + while (tag.has_more_attributes ()) { + attr = tag.get_next_attribute (); + + if (attr.get_name () == "left") { + range_left.parse_ranges (unserialize (attr.get_content ())); } - if (attr_name == "right") { - range_right.parse_ranges (unserialize (attr_content)); + if (attr.get_name () == "right") { + range_right.parse_ranges (unserialize (attr.get_content ())); } - if (attr_name == "hadjustment") { - hadjustment = double.parse (attr_content); + if (attr.get_name () == "hadjustment") { + hadjustment = double.parse (attr.get_content ()); } } @@ -797,55 +765,8 @@ } } - private void parse_old_kerning (Xml.Node* node) { - string attr_name; - string attr_content; - string left = ""; - string right = ""; - string kern = ""; - GlyphRange grr, grl; - - StringBuilder b; - - for (Xml.Attr* prop = node->properties; prop != null; prop = prop->next) { - attr_name = prop->name; - attr_content = prop->children->content; - - if (attr_name == "left") { - b = new StringBuilder (); - b.append_unichar (Font.to_unichar (attr_content)); - left = @"$(b.str)"; - } - - if (attr_name == "right") { - b = new StringBuilder (); - b.append_unichar (Font.to_unichar (attr_content)); - right = @"$(b.str)"; - } - - if (attr_name == "kerning") { - kern = attr_content; - } - } - - try { - grl = new GlyphRange (); - grl.parse_ranges (left); - - grr = new GlyphRange (); - grr.parse_ranges (right); - - KerningClasses.get_instance ().set_kerning (grl, grr, double.parse (kern)); - } catch (MarkupError e) { - warning (e.message); - } - } - - private void parse_background_image (Xml.Node* node) - requires (node != null) - { - string attr_name; - string attr_content; + private void parse_background_image (Tag tag) { + Attribute attr; string file = ""; string data = ""; @@ -855,20 +776,16 @@ FileOutputStream file_stream; DataOutputStream png_stream; - for (Xml.Attr* prop = node->properties; prop != null; prop = prop->next) { - return_if_fail (!is_null (prop->name)); - return_if_fail (!is_null (prop->children)); - return_if_fail (!is_null (prop->children->content)); + tag.reparse (); + while (tag.has_more_attributes ()) { + attr = tag.get_next_attribute (); - attr_name = prop->name; - attr_content = prop->children->content; - - if (attr_name == "sha1") { - file = attr_content; + if (attr.get_name () == "sha1") { + file = attr.get_content (); } - - if (attr_name == "data") { - data = attr_content; + + if (attr.get_name () == "data") { + data = attr.get_content (); } } @@ -899,125 +816,75 @@ } } - private void parse_background (Xml.Node* node) - requires (node != null) - { - string attr_name; - string attr_content; - - for (Xml.Attr* prop = node->properties; prop != null; prop = prop->next) { + private void parse_background (Tag tag) { + Attribute attr; + + tag.reparse (); + while (tag.has_more_attributes ()) { + attr = tag.get_next_attribute (); - return_if_fail (!is_null (prop->name)); - return_if_fail (!is_null (prop->children)); - return_if_fail (!is_null (prop->children->content)); - - attr_name = prop->name; - attr_content = prop->children->content; - - if (attr_name == "scale") { - font.background_scale = attr_content; + if (attr.get_name () == "scale") { + font.background_scale = attr.get_content (); } } } - private void parse_background_selection (Xml.Node* node) { - string attr_name = ""; - string attr_content; + private void parse_grid (Tag tag) { + Attribute attr; - return_if_fail (node != null); - - for (Xml.Node* iter = node->children; iter != null; iter = iter->next) { - if (iter->name == "img") { - for (Xml.Attr* prop = iter->properties; prop != null; prop = prop->next) { - attr_name = prop->name; - attr_content = prop->children->content; - - if (attr_name == "src") { - font.background_images.add (attr_content); - } - } - } - } - } - - private void parse_grid (Xml.Node* node) { - for (Xml.Attr* prop = node->properties; prop != null; prop = prop->next) { - string attr_name = prop->name; - string attr_content = prop->children->content; + tag.reparse (); + while (tag.has_more_attributes ()) { + attr = tag.get_next_attribute (); - if (attr_name == "width") { - font.grid_width.add (attr_content); + if (attr.get_name () == "width") { + font.grid_width.add (attr.get_content ()); } } } - private void parse_horizontal_lines (Xml.Node* node) { - for (Xml.Node* iter = node->children; iter != null; iter = iter->next) { - if (iter->name == "top_limit" && "" != iter->children->content) { - font.top_limit = parse_double_from_node (iter); + private void parse_horizontal_lines (Tag tag) { + Tag t; + + tag.reparse (); + while (tag.has_more_tags ()) { + t = tag.get_next_tag (); + if (t.get_name () == "top_limit" && t.get_content () != "") { + font.top_limit = parse_double_from_node (t); } - if (iter->name == "top_position" && "" != iter->children->content) { - font.top_position = parse_double_from_node (iter); + if (t.get_name () == "top_position" && t.get_content () != "") { + font.top_position = parse_double_from_node (t); } - if (iter->name == "x-height" && "" != iter->children->content) { - font.xheight_position = parse_double_from_node (iter); + if (t.get_name () == "x-height" && t.get_content () != "") { + font.xheight_position = parse_double_from_node (t); } - if (iter->name == "base_line" && "" != iter->children->content) { - font.base_line = parse_double_from_node (iter); + if (t.get_name () == "base_line" && t.get_content () != "") { + font.base_line = parse_double_from_node (t); } - if (iter->name == "bottom_position" && "" != iter->children->content) { - font.bottom_position = parse_double_from_node (iter); + if (t.get_name () == "bottom_position" && t.get_content () != "") { + font.bottom_position = parse_double_from_node (t); } - if (iter->name == "bottom_limit" && "" != iter->children->content) { - font.bottom_limit = parse_double_from_node (iter); + if (t.get_name () == "bottom_limit" && t.get_content () != "") { + font.bottom_limit = parse_double_from_node (t); } } } - /** @deprecated horizontal in older .bf files */ - private void parse_font_boundaries (Xml.Node* node) { - for (Xml.Node* iter = node->children; iter != null; iter = iter->next) { - if (iter->name == "top_limit" && "" != iter->children->content) { - font.top_limit = -parse_double_from_node (iter); - } - - if (iter->name == "top_position" && "" != iter->children->content) { - font.top_position = -parse_double_from_node (iter); - } - - if (iter->name == "x-height" && "" != iter->children->content) { - font.xheight_position = -parse_double_from_node (iter); - } - - if (iter->name == "base_line" && "" != iter->children->content) { - font.base_line = -parse_double_from_node (iter); - } - - if (iter->name == "bottom_position" && "" != iter->children->content) { - font.bottom_position = -parse_double_from_node (iter); - } - - if (iter->name == "bottom_limit" && "" != iter->children->content) { - font.bottom_limit = -parse_double_from_node (iter); - } - } - } - - private double parse_double_from_node (Xml.Node* iter) { + private double parse_double_from_node (Tag tag) { double d; - bool r = double.try_parse (iter->children->content, out d); + bool r = double.try_parse (tag.get_content (), out d); + string s; if (unlikely (!r)) { - string? s = iter->content; - if (s == null) { - warning (@"Content is null for node $(iter->name)\n"); + s = tag.get_content (); + if (s == "") { + warning (@"No content for node\n"); } else { - warning (@"Failed to parse double for \"$(iter->content)\"\n"); + warning (@"Failed to parse double for \"$(tag.get_content ())\"\n"); } } @@ -1025,23 +892,22 @@ } /** Parse the new glyph format */ - private void parse_glyph_collection (Xml.Node* node) { + private void parse_glyph_collection (Tag tag) { unichar unicode = 0; GlyphCollection gc; GlyphCollection? current_gc; bool new_glyph_collection; - string attr_name; - string attr_content; StringBuilder b; string name = ""; int selected_id = -1; - - for (Xml.Attr* prop = node->properties; prop != null; prop = prop->next) { - attr_name = prop->name; - attr_content = prop->children->content; - - if (attr_name == "unicode") { - unicode = Font.to_unichar (attr_content); + Attribute attribute; + Tag t; + + tag.reparse (); + while (tag.has_more_attributes ()) { + attribute = tag.get_next_attribute (); + if (attribute.get_name () == "unicode") { + unicode = Font.to_unichar (attribute.get_content ()); b = new StringBuilder (); b.append_unichar (unicode); name = b.str; @@ -1056,16 +922,22 @@ new_glyph_collection = (current_gc == null); gc = (!new_glyph_collection) ? (!) current_gc : new GlyphCollection (unicode, name); - for (Xml.Node* iter = node->children; iter != null; iter = iter->next) { - if (iter->name == "selected") { - selected_id = parse_selected (iter); + tag.reparse (); + while (tag.has_more_tags ()) { + t = tag.get_next_tag (); + + if (t.get_name () == "selected") { + selected_id = parse_selected (t); gc.set_selected_version (selected_id); } } - - for (Xml.Node* iter = node->children; iter != null; iter = iter->next) { - if (iter->name == "glyph") { - parse_glyph (iter, gc, name, unicode, selected_id); + + tag.reparse (); + while (tag.has_more_tags ()) { + t = tag.get_next_tag (); + + if (t.get_name () == "glyph") { + parse_glyph (t, gc, name, unicode, selected_id); } } @@ -1074,18 +946,17 @@ } } - private int parse_selected (Xml.Node* node) { - string attr_name; - string attr_content; + private int parse_selected (Tag tag) { int id = 1; bool has_selected_tag = false; + Attribute attribute; - for (Xml.Attr* prop = node->properties; prop != null; prop = prop->next) { - attr_name = prop->name; - attr_content = prop->children->content; - - if (attr_name == "id") { - id = int.parse (attr_content); + tag.reparse (); + while (tag.has_more_attributes ()) { + attribute = tag.get_next_attribute (); + + if (attribute.get_name () == "id") { + id = int.parse (attribute.get_content ()); has_selected_tag = true; break; } @@ -1098,47 +969,49 @@ return id; } - private void parse_glyph (Xml.Node* node, GlyphCollection gc, string name, unichar unicode, int selected_id) { - string attr_name; - string attr_content; + private void parse_glyph (Tag tag, GlyphCollection gc, string name, unichar unicode, int selected_id) { Glyph glyph = new Glyph (name, unicode); Path path; bool selected = false; bool has_id = false; int id = 1; + Attribute attr; + Tag t; - for (Xml.Attr* prop = node->properties; prop != null; prop = prop->next) { - attr_name = prop->name; - attr_content = prop->children->content; + tag.reparse (); + while (tag.has_more_attributes ()) { + attr = tag.get_next_attribute (); - if (attr_name == "left") { - glyph.left_limit = double.parse (attr_content); + if (attr.get_name () == "left") { + glyph.left_limit = double.parse (attr.get_content ()); } - if (attr_name == "right") { - glyph.right_limit = double.parse (attr_content); + if (attr.get_name () == "right") { + glyph.right_limit = double.parse (attr.get_content ()); } // id is unique within the glyph collection - if (attr_name == "id") { - id = int.parse (attr_content); + if (attr.get_name () == "id") { + id = int.parse (attr.get_content ()); has_id = true; } // old way of selecting a glyph in the version list - if (attr_name == "selected") { - selected = bool.parse (attr_content); + if (attr.get_name () == "selected") { + selected = bool.parse (attr.get_content ()); } } - for (Xml.Node* iter = node->children; iter != null; iter = iter->next) { - if (iter->name == "path") { - path = parse_path (iter); + tag.reparse (); + while (tag.has_more_tags ()) { + t = tag.get_next_tag (); + if (t.get_name () == "path") { + path = parse_path (t); glyph.add_path (path); } - if (iter->name == "background") { - parse_background_scale (glyph, iter); + if (t.get_name () == "background") { + parse_background_scale (glyph, t); } } @@ -1146,33 +1019,32 @@ gc.insert_glyph (glyph, selected || selected_id == id); } - private Path parse_path (Xml.Node* node) { - string attr_name; - string attr_content; + private Path parse_path (Tag tag) { Path path = new Path (); + Attribute attr; - for (Xml.Attr* prop = node->properties; prop != null; prop = prop->next) { - attr_name = prop->name; - attr_content = prop->children->content; + tag.reparse (); + while (tag.has_more_attributes ()) { + attr = tag.get_next_attribute (); - if (attr_name == "data") { - path = parse_path_data (attr_content); + if (attr.get_name () == "data") { + path = parse_path_data (attr.get_content ()); } } - for (Xml.Attr* prop = node->properties; prop != null; prop = prop->next) { - attr_name = prop->name; - attr_content = prop->children->content; + tag.reparse (); + while (tag.has_more_attributes ()) { + attr = tag.get_next_attribute (); - if (attr_name == "stroke") { - path.set_stroke (double.parse (attr_content)); + if (attr.get_name () == "stroke") { + path.set_stroke (double.parse (attr.get_content ())); } - if (attr_name == "skew") { - path.skew = (double.parse (attr_content)); - } + if (attr.get_name () == "skew") { + path.skew = double.parse (attr.get_content ()); + } + } - } if (path.points.size == 0) { warning ("Empty path"); } @@ -1462,110 +1334,19 @@ return 0; } - /** Parse one glyph in the old ffi format. */ - private void parse_ffi_glyph (Xml.Node* node) { - string name = ""; - int left = 0; - int right = 0; - unichar uni = 0; - int version = 0; - bool selected = false; - Glyph g; - GlyphCollection? gc; - - for (Xml.Attr* prop = node->properties; prop != null; prop = prop->next) { - string attr_name = prop->name; - string attr_content = prop->children->content; - StringBuilder b; - - if (attr_name == "unicode") { - uni = Font.to_unichar (attr_content); - b = new StringBuilder (); - b.append_unichar (uni); - name = b.str; - } - - if (attr_name == "left") { - left = int.parse (attr_content); - } - - if (attr_name == "right") { - right = int.parse (attr_content); - } - - if (attr_name == "version") { - version = int.parse (attr_content); - } - - if (attr_name == "selected") { - selected = bool.parse (attr_content); - } - } - - g = new Glyph (name, uni); - - g.left_limit = left; - g.right_limit = right; - - parse_content (g, node); - - gc = font.get_glyph_collection (g.get_name ()); - - if (g.get_name () == "") { - warning ("No name set for glyph."); - } - - if (gc == null) { - gc = new GlyphCollection (uni, name); - ((!) gc).insert_glyph (g, selected); - font.add_glyph_collection ((!) gc); - } else { - ((!)gc).insert_glyph (g, selected); - } - } - - /** Parse visual objects and paths - * @deprecated ffi format use bf - */ - private void parse_content (Glyph g, Xml.Node* node) { - Xml.Node* i; - return_if_fail (node != null); - - for (Xml.Node* iter = node->children; iter != null; iter = iter->next) { - if (iter->name == "object") { - Path p = new Path (); - - for (i = iter->children; i != null; i = i->next) { - if (i->name == "point") { - parse_point (p, i); - } - } - - p.close (); - g.add_path (p); - } - - if (iter->name == "background") { - parse_background_scale (g, iter); - } - } - } - - private void parse_background_scale (Glyph g, Xml.Node* node) { + private void parse_background_scale (Glyph g, Tag tag) { BackgroundImage img; BackgroundImage? new_img = null; - - string attr_name = ""; - string attr_content; + Attribute attr; File img_file = font.get_backgrounds_folder ().get_child ("parts"); - for (Xml.Attr* prop = node->properties; prop != null; prop = prop->next) { - attr_name = prop->name; - attr_content = prop->children->content; + tag.reparse (); + while (tag.has_more_attributes ()) { + attr = tag.get_next_attribute (); - if (attr_name == "sha1") { - img_file = img_file.get_child (attr_content + ".png"); + if (attr.get_name () == "sha1") { + img_file = img_file.get_child (attr.get_content () + ".png"); if (!img_file.query_exists ()) { warning (@"Background file has not been created yet. $((!) img_file.get_path ())"); @@ -1577,122 +1358,40 @@ } if (unlikely (new_img == null)) { - warning (@"No source for image found for $attr_name in $(g.name)"); + warning ("No source for image found."); return; } img = (!) new_img; - for (Xml.Attr* prop = node->properties; prop != null; prop = prop->next) { - attr_name = prop->name; - attr_content = prop->children->content; + tag.reparse (); + while (tag.has_more_attributes ()) { + attr = tag.get_next_attribute (); - if (attr_name == "x") { - img.img_x = double.parse (attr_content); + if (attr.get_name () == "x") { + img.img_x = double.parse (attr.get_content ()); } - if (attr_name == "y") { - img.img_y = double.parse (attr_content); + if (attr.get_name () == "y") { + img.img_y = double.parse (attr.get_content ()); } - if (attr_name == "scale_x") { - img.img_scale_x = double.parse (attr_content); + if (attr.get_name () == "scale_x") { + img.img_scale_x = double.parse (attr.get_content ()); } - if (attr_name == "scale_y") { - img.img_scale_y = double.parse (attr_content); + if (attr.get_name () == "scale_y") { + img.img_scale_y = double.parse (attr.get_content ()); } - if (attr_name == "rotation") { - img.img_rotation = double.parse (attr_content); + if (attr.get_name () == "rotation") { + img.img_rotation = double.parse (attr.get_content ()); } } img.set_position (img.img_x, img.img_y); - } - - private void parse_point (Path p, Xml.Node* iter) { - double x = 0; - double y = 0; - - double angle_right = 0; - double angle_left = 0; - - double length_right = 0; - double length_left = 0; - - PointType type_right = PointType.LINE_CUBIC; - PointType type_left = PointType.LINE_CUBIC; - - bool tie_handles = false; - - EditPoint ep; - - for (Xml.Attr* prop = iter->properties; prop != null; prop = prop->next) { - string attr_name = prop->name; - string attr_content = prop->children->content; - - if (attr_name == "x") x = double.parse (attr_content); - if (attr_name == "y") y = double.parse (attr_content); - - if (attr_name == "right_type" && attr_content == "linear") { - type_right = PointType.LINE_CUBIC; - } - - if (attr_name == "left_type" && attr_content == "linear") { - type_left = PointType.LINE_CUBIC; - } - - if (attr_name == "right_type" && attr_content == "quadratic") { - type_right = PointType.QUADRATIC; - } - - if (attr_name == "left_type" && attr_content == "quadratic") { - type_left = PointType.QUADRATIC; - } - - if (attr_name == "right_type" && attr_content == "cubic") { - type_right = PointType.CUBIC; - } - - if (attr_name == "left_type" && attr_content == "cubic") { - type_left = PointType.CUBIC; - } - - if (attr_name == "right_angle") angle_right = double.parse (attr_content); - if (attr_name == "right_length") length_right = double.parse (attr_content); - if (attr_name == "left_angle") angle_left = double.parse (attr_content); - if (attr_name == "left_length") length_left = double.parse (attr_content); - - if (attr_name == "tie_handles") tie_handles = bool.parse (attr_content); - } - - // backward compabtility - if (type_right == PointType.LINE_CUBIC && length_right != 0) { - type_right = PointType.CUBIC; - } - - if (type_left == PointType.LINE_CUBIC && length_left != 0) { - type_left = PointType.CUBIC; - } - - ep = new EditPoint (x, y); - - ep.right_handle.angle = angle_right; - ep.right_handle.length = length_right; - ep.right_handle.type = type_right; - - ep.left_handle.angle = angle_left; - ep.left_handle.length = length_left; - ep.left_handle.type = type_left; - - ep.tie_handles = tie_handles; - - ep.type = type_right; - - p.add_point (ep); } } }
--- a/libbirdfont/Kerning.vala +++ b/libbirdfont/Kerning.vala @@ -13,7 +13,7 @@ */ using Cairo; - using Xml; + using Bird; namespace BirdFont {
--- a/libbirdfont/KerningClasses.vala +++ b/libbirdfont/KerningClasses.vala @@ -13,7 +13,7 @@ */ using Cairo; - using Xml; + using Bird; using Math; using Gee;
--- a/libbirdfont/OpenFontFormat/KerningPair.vala +++ b/libbirdfont/OpenFontFormat/KerningPair.vala @@ -13,7 +13,7 @@ */ using Cairo; - using Xml; + using Bird; namespace BirdFont {
--- a/libbirdfont/SvgFont.vala +++ b/libbirdfont/SvgFont.vala @@ -12,7 +12,7 @@ Lesser General Public License for more details. */ - using Xml; + using Bird; namespace BirdFont { @@ -27,44 +27,48 @@ /** Load svg font from file. */ public void load (string path) { - Xml.Doc* doc; - Xml.Node* root = null; - - Parser.init (); - doc = Parser.parse_file (path); - root = doc->get_root_element (); - return_if_fail (root != null); - parse_svg_font (root); - delete doc; - Parser.cleanup (); + string data; + XmlParser xml_parser; + try { + FileUtils.get_contents (path, out data); + xml_parser = new XmlParser (data); + parse_svg_font (xml_parser.get_next_tag ()); + } catch (GLib.Error e) { + warning (e.message); + } } - void parse_svg_font (Xml.Node* node) { - for (Xml.Node* iter = node->children; iter != null; iter = iter->next) { - if (iter->name == "defs") { - parse_svg_font (iter); + void parse_svg_font (Tag tag) { + Tag t; + + tag.reparse (); + while (tag.has_more_tags ()) { + t = tag.get_next_tag (); + + if (t.get_name () == "defs") { + parse_svg_font (t); } - if (iter->name == "font") { - parse_font_tag (iter); - parse_svg_font (iter); + if (t.get_name () == "font") { + parse_font_tag (t); + parse_svg_font (t); } - if (iter->name == "font-face") { - parse_font_limits (iter); + if (t.get_name () == "font-face") { + parse_font_limits (t); } - if (iter->name == "hkern") { - parse_hkern (iter); + if (t.get_name () == "hkern") { + parse_hkern (t); } - if (iter->name == "glyph") { - parse_glyph (iter); + if (t.get_name () == "glyph") { + parse_glyph (t); } } } - void parse_hkern (Xml.Node* node) { + void parse_hkern (Tag tag) { string left = ""; string right = ""; string left_name = ""; @@ -72,35 +76,34 @@ double kerning = 0; unichar l, r; StringBuilder sl, sr; - string attr_name = ""; - string attr_content; GlyphRange grr, grl; + Attribute attr; - for (Xml.Attr* prop = node->properties; prop != null; prop = prop->next) { - attr_name = prop->name; - attr_content = prop->children->content; + tag.reparse (); + while (tag.has_more_attributes ()) { + attr = tag.get_next_attribute (); // left - if (attr_name == "u1") { - left = attr_content; + if (attr.get_name () == "u1") { + left = attr.get_content (); } // right - if (attr_name == "u2") { - right = attr_content; + if (attr.get_name () == "u2") { + right = attr.get_content (); } - if (attr_name == "g1") { - left_name = attr_content; + if (attr.get_name () == "g1") { + left_name = attr.get_content (); } - if (attr_name == "g2") { - right_name = attr_content; + if (attr.get_name () == "g2") { + right_name = attr.get_content (); } // kerning - if (attr_name == "k") { - kerning = double.parse (attr_content) * units; + if (attr.get_name () == "k") { + kerning = double.parse (attr.get_content ()) * units; } } @@ -131,31 +134,30 @@ } } - void parse_font_limits (Xml.Node* node) { - string attr_name = ""; - string attr_content; + void parse_font_limits (Tag tag) { double top_limit = 0; double bottom_limit = 0; + Attribute attr; - for (Xml.Attr* prop = node->properties; prop != null; prop = prop->next) { - attr_name = prop->name; - attr_content = prop->children->content; + tag.reparse (); + while (tag.has_more_attributes ()) { + attr = tag.get_next_attribute (); - if (attr_name == "units-per-em") { - units = 100.0 / double.parse (attr_content); + if (attr.get_name () == "units-per-em") { + units = 100.0 / double.parse (attr.get_content ()); } } - for (Xml.Attr* prop = node->properties; prop != null; prop = prop->next) { - attr_name = prop->name; - attr_content = prop->children->content; + tag.reparse (); + while (tag.has_more_attributes ()) { + attr = tag.get_next_attribute (); - if (attr_name == "ascent") { - top_limit = double.parse (attr_content); + if (attr.get_name () == "ascent") { + top_limit = double.parse (attr.get_content ()); } - if (attr_name == "descent") { - bottom_limit = double.parse (attr_content); + if (attr.get_name () == "descent") { + bottom_limit = double.parse (attr.get_content ()); } } @@ -166,20 +168,19 @@ font.top_limit = top_limit; } - void parse_font_tag (Xml.Node* node) { - string attr_name = ""; - string attr_content; + void parse_font_tag (Tag tag) { + Attribute attr; - for (Xml.Attr* prop = node->properties; prop != null; prop = prop->next) { - attr_name = prop->name; - attr_content = prop->children->content; + tag.reparse (); + while (tag.has_more_attributes ()) { + attr = tag.get_next_attribute (); - if (attr_name == "horiz-adv-x") { - font_advance = double.parse (attr_content); + if (attr.get_name () == "horiz-adv-x") { + font_advance = double.parse (attr.get_content ()); } - if (attr_name == "id") { - font.set_name (attr_content); + if (attr.get_name () == "id") { + font.set_name (attr.get_content ()); } } } @@ -224,9 +225,7 @@ return v.char_count () > 1; } - void parse_glyph (Xml.Node* node) { - string attr_name = ""; - string attr_content; + void parse_glyph (Tag tag) { unichar unicode_value = 0; string glyph_name = ""; string svg = ""; @@ -235,36 +234,37 @@ double advance = font_advance; string ligature = ""; SvgParser parser = new SvgParser (); + Attribute attr; parser.set_format (SvgFormat.INKSCAPE); - for (Xml.Attr* prop = node->properties; prop != null; prop = prop->next) { - attr_name = prop->name; - attr_content = prop->children->content; + tag.reparse (); + while (tag.has_more_attributes ()) { + attr = tag.get_next_attribute (); - if (attr_name == "unicode") { - unicode_value = get_unichar (attr_content); + if (attr.get_name () == "unicode") { + unicode_value = get_unichar (attr.get_content ()); if (glyph_name == "") { - glyph_name = attr_content; + glyph_name = attr.get_content (); } - if (is_ligature (attr_content)) { - ligature = attr_content; + if (is_ligature (attr.get_content ())) { + ligature = attr.get_content (); } } // svg data - if (attr_name == "d") { - svg = attr_content; + if (attr.get_name () == "d") { + svg = attr.get_content (); } - if (attr_name == "glyph-name") { - glyph_name = attr_content; + if (attr.get_name () == "glyph-name") { + glyph_name = attr.get_content (); } - if (attr_name == "horiz-adv-x") { - advance = double.parse (attr_content); + if (attr.get_name () == "horiz-adv-x") { + advance = double.parse (attr.get_content ()); } }
--- a/libbirdfont/SvgParser.vala +++ b/libbirdfont/SvgParser.vala @@ -11,7 +11,8 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ - using Xml; + + using Bird; using Math; namespace BirdFont { @@ -52,13 +53,12 @@ public static void import_svg_data (string xml_data, SvgFormat format = SvgFormat.NONE) { PathList path_list = new PathList (); Glyph glyph; - Xml.Node* root = null; string[] lines = xml_data.split ("\n"); - string xml_document; bool has_format = false; StringBuilder sb = new StringBuilder (); SvgParser parser = new SvgParser (); - TextReader tr; + XmlParser xmlparser; + Tag root; foreach (string l in lines) { if (l.index_of ("Illustrator") > -1 || l.index_of ("illustrator") > -1) { @@ -69,51 +69,22 @@ if (l.index_of ("Inkscape") > -1 || l.index_of ("inkscape") > -1) { parser.set_format (SvgFormat.INKSCAPE); has_format = true; - } - - // FIXME: libxml2 (2.7.8) refuses to parse svg files created with Adobe Illustrator on - // windows. This is a way around it. - if (l.index_of ("<!") == -1 - && l.index_of ("]>") == -1 - && l.index_of ("http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd") == -1) { - sb.append (l); - sb.append ("\n"); } } if (format != SvgFormat.NONE) { parser.set_format (format); } - - xml_document = sb.str; - - // Remove Inkscape specific namespaces - xml_document = replace (xml_document, "<metadata", "</metadata>", ""); - xml_document = replace (xml_document, "<sodipodi:namedview", "</sodipodi:namedview>", ""); - xml_document = xml_document.replace ("inkscape:", ""); - - // CS6 compability - xml_document = replace (xml_document, "<svg", ">", "<svg>"); - xml_document = replace (xml_document, "<foreignObject", "</foreignObject>", ""); - xml_document = replace (xml_document, "<i:pgf", "</i:pgf>", ""); - xml_document = xml_document.replace ("i:", ""); - xml_document = xml_document.replace ("sodipodi:", ""); - + // parse the file if (!has_format) { warn_if_test ("No format identifier found in SVG parser.\n"); } - Parser.init (); + xmlparser = new XmlParser (xml_data); - tr = new TextReader.for_doc (xml_document, ""); - tr.read (); - root = tr.expand (); - - if (root == null) { - warning ("Failed to load SVG file"); - return; - } + xmlparser.reparse (); + root = xmlparser.get_next_tag (); path_list = parser.parse_svg_file (root); @@ -156,66 +127,65 @@ import_svg_data (svg_data); } - private PathList parse_svg_file (Xml.Node* root) { - Xml.Node* node; + private PathList parse_svg_file (Tag tag) { + Tag t; PathList pl = new PathList (); - node = root; - - for (Xml.Node* iter = node->children; iter != null; iter = iter->next) { - if (iter->name == "g") { - parse_layer (iter, pl); + tag.reparse (); + while (tag.has_more_tags ()) { + t = tag.get_next_tag (); + + if (t.get_name () == "g") { + parse_layer (t, pl); } - if (iter->name == "switch") { - parse_layer (iter, pl); + if (t.get_name () == "switch") { + parse_layer (t, pl); } - if (iter->name == "path") { - parse_path (iter, pl); + if (t.get_name () == "path") { + parse_path (t, pl); } - if (iter->name == "polygon") { - parse_polygon (iter, pl); + if (t.get_name () == "polygon") { + parse_polygon (t, pl); } } return pl; } - private void parse_layer (Xml.Node* node, PathList pl) { - string attr_name = ""; - string attr_content = ""; + private void parse_layer (Tag tag, PathList pl) { PathList layer = new PathList (); + Tag t; + Attribute attr; - return_if_fail (node != null); - return_if_fail (node->children != null); - - for (Xml.Node* iter = node->children; iter != null; iter = iter->next) { - if (iter->name == "path") { - parse_path (iter, layer); + tag.reparse (); + while (tag.has_more_tags ()) { + t = tag.get_next_tag (); + + if (t.get_name () == "path") { + parse_path (t, layer); } - if (iter->name == "g") { - parse_layer (iter, layer); + if (t.get_name () == "g") { + parse_layer (t, layer); } - if (iter->name == "polygon") { - parse_polygon (iter, layer); + if (t.get_name () == "polygon") { + parse_polygon (t, layer); } } - if (!is_null (node) && !is_null (node->properties)) { - for (Xml.Attr* prop = node->properties; prop != null; prop = prop->next) { - attr_name = prop->name; - attr_content = prop->children->content; - - if (attr_name == "transform") { - transform (attr_content, layer); - } + tag.reparse (); + while (tag.has_more_attributes ()) { + attr = tag.get_next_attribute (); + + if (attr.get_name () == "transform") { + transform (attr.get_content (), layer); } } - + pl.append (layer); } @@ -374,45 +344,44 @@ return param; } - private void parse_polygon (Xml.Node* node, PathList pl) { - string attr_name = ""; - string attr_content; + private void parse_polygon (Tag tag, PathList pl) { Glyph glyph = MainWindow.get_current_glyph (); Path p; + Attribute attr; + + tag.reparse (); + while (tag.has_more_attributes ()) { + attr = tag.get_next_attribute (); - for (Xml.Attr* prop = node->properties; prop != null; prop = prop->next) { - attr_name = prop->name; - attr_content = prop->children->content; - - if (attr_name == "points") { - p = parse_polygon_data (attr_content, glyph); + if (attr.get_name () == "points") { + p = parse_polygon_data (attr.get_content (), glyph); pl.add (p); } } } - private void parse_path (Xml.Node* node, PathList pl) { - string attr_name = ""; - string attr_content; + private void parse_path (Tag tag, PathList pl) { Glyph glyph = MainWindow.get_current_glyph (); PathList path_list = new PathList (); + Tag t; + Attribute attr; + + tag.reparse (); + while (tag.has_more_attributes ()) { + attr = tag.get_next_attribute (); - for (Xml.Attr* prop = node->properties; prop != null; prop = prop->next) { - attr_name = prop->name; - attr_content = prop->children->content; - - if (attr_name == "d") { - path_list = parse_svg_data (attr_content, glyph); + if (attr.get_name () == "d") { + path_list = parse_svg_data (attr.get_content (), glyph); pl.append (path_list); } } - for (Xml.Attr* prop = node->properties; prop != null; prop = prop->next) { - attr_name = prop->name; - attr_content = prop->children->content; + tag.reparse (); + while (tag.has_more_attributes ()) { + attr = tag.get_next_attribute (); - if (attr_name == "transform") { - transform (attr_content, path_list); + if (attr.get_name () == "transform") { + transform (attr.get_content (), path_list); } } }
--- a/libbirdxml/Tag.vala +++ b/libbirdxml/Tag.vala @@ -33,10 +33,7 @@ this.name = name; this.data = content; this.attributes = attributes; - tag_index = 0; - attribute_index = 0; - next_tag = obtain_next_tag (); - next_attribute = obtain_next_attribute (); + reparse (); } internal Tag.empty () { @@ -56,6 +53,11 @@ /** @return the name of this tag. */ public string get_name () { return name; + } + + /** @return data between the starty and end tag. */ + public string get_content () { + return data; } /** @return true if there is one more tags left */ @@ -65,17 +67,19 @@ /** @return the next tag. **/ public Tag get_next_tag () { - Tag r = (!) next_tag; + Tag r = next_tag == null ? new Tag.empty () : (!) next_tag; next_tag = obtain_next_tag (); return r; } + /** @return true is there is one or more attributes to obtain with get_next_attribute */ public bool has_more_attributes () { return has_attributes; } + /** @return next attribute. */ public Attribute get_next_attribute () { - Attribute r = (!) next_attribute; + Attribute r = next_attribute == null ? new Attribute.empty () : (!) next_attribute; next_attribute = obtain_next_attribute (); return r; } @@ -119,6 +123,10 @@ } name = data.substring (index, separator - index); + + if (name.has_prefix ("!")) { + continue; + } end = data.index_of (">", start); attributes = data.substring (separator, end - separator); @@ -135,7 +143,6 @@ data.get_next_char (ref end_tag_index, out c); } - print (@"$(this.name) New tag end_tag_index $end_tag_index, $name, $attributes, $content\n"); return new Tag (name, attributes, content); } }
--- a/libbirdxml/Xml.vala +++ b/libbirdxml/Xml.vala @@ -14,12 +14,12 @@ namespace Bird { /** A small xml parser originally written for the BirdFont project. */ - public class Xml : GLib.Object { + public class XmlParser : GLib.Object { Tag root; string data; - public Xml (string data) { + public XmlParser (string data) { this.data = data; reparse (); } @@ -31,12 +31,13 @@ root_index = find_root_tag (); if (root_index == -1) { warning ("No root tag found."); + root = new Tag.empty (); + } else { + root = new Tag ("", "", data.substring (root_index)); } - - root = new Tag ("", "", data.substring (root_index)); } - /** @return the next tag. **/ + /** @return the root tag. **/ public Tag get_next_tag () { return root.get_next_tag (); } @@ -61,7 +62,7 @@ if (c == '<') { modifier = index; data.get_next_char (ref modifier, out c); - if (c != '?' && c != '[') { + if (c != '?' && c != '[' && c != '!') { return prev_index; } }
--- a/scripts/build.py +++ b/scripts/build.py @@ -36,6 +36,7 @@ -C \ """ + valaflags + """ \ --vapidir=./ \ + --vapidir=./build \ --basedir build/libbirdfont/ \ """ + experimentalNonNull + """ \ --enable-experimental \ @@ -44,10 +45,10 @@ libbirdfont/*.vala \ libbirdfont/OpenFontFormat/*.vala \ --pkg """ + config.GEE + """ \ - --pkg libxml-2.0 \ --pkg gio-2.0 \ --pkg cairo \ - --pkg gdk-pixbuf-2.0 + --pkg gdk-pixbuf-2.0 \ + --pkg birdxml \ """) #copy c sources @@ -61,7 +62,6 @@ -fPIC \ -D 'GETTEXT_PACKAGE="birdfont"' \ $(pkg-config --cflags """ + config.GEE + """) \ - $(pkg-config --cflags libxml-2.0) \ $(pkg-config --cflags gio-2.0) \ $(pkg-config --cflags cairo) \ $(pkg-config --cflags glib-2.0) \ @@ -80,7 +80,6 @@ build/libbirdfont/*.o \ $(freetype-config --libs) \ $(pkg-config --libs """ + config.GEE + """) \ - $(pkg-config --libs libxml-2.0) \ $(pkg-config --libs gio-2.0) \ $(pkg-config --libs cairo) \ $(pkg-config --libs glib-2.0) \ @@ -180,7 +179,6 @@ --define=MAC birdfont-export/* \ --vapidir=./ \ --pkg """ + config.GEE + """ \ - --pkg libxml-2.0 \ --pkg gio-2.0 \ --pkg cairo \ --pkg gdk-pixbuf-2.0 \ @@ -192,7 +190,6 @@ -c ./build/libbirdfont/birdfont.h build/birdfont-export/*.c \ -D 'GETTEXT_PACKAGE="birdfont"' \ $(pkg-config --cflags """ + config.GEE + """) \ - $(pkg-config --cflags libxml-2.0) \ $(pkg-config --cflags gio-2.0) \ $(pkg-config --cflags cairo) \ $(pkg-config --cflags glib-2.0) \ @@ -205,7 +202,6 @@ -Lbuild/bin/ -lbirdfont \ -lm \ $(pkg-config --libs """ + config.GEE + """) \ - $(pkg-config --libs libxml-2.0) \ $(pkg-config --libs gio-2.0) \ $(pkg-config --libs cairo) \ $(pkg-config --libs glib-2.0) \ @@ -242,7 +238,6 @@ --define=MAC birdfont-import/* \ --vapidir=./ \ --pkg """ + config.GEE + """ \ - --pkg libxml-2.0 \ --pkg gio-2.0 \ --pkg cairo \ --pkg gdk-pixbuf-2.0 \ @@ -254,7 +249,6 @@ -c ./build/libbirdfont/birdfont.h build/birdfont-import/*.c \ -D 'GETTEXT_PACKAGE="birdfont"' \ $(pkg-config --cflags """ + config.GEE + """) \ - $(pkg-config --cflags libxml-2.0) \ $(pkg-config --cflags gio-2.0) \ $(pkg-config --cflags cairo) \ $(pkg-config --cflags glib-2.0) \ @@ -267,7 +261,6 @@ -Lbuild/bin/ -lbirdfont \ -lm \ $(pkg-config --libs """ + config.GEE + """) \ - $(pkg-config --libs libxml-2.0) \ $(pkg-config --libs gio-2.0) \ $(pkg-config --libs cairo) \ $(pkg-config --libs glib-2.0) \ @@ -289,7 +282,6 @@ --define=MAC birdfont-autotrace/* \ --vapidir=./ \ --pkg """ + config.GEE + """ \ - --pkg libxml-2.0 \ --pkg gio-2.0 \ --pkg cairo \ --pkg gdk-pixbuf-2.0 \ @@ -301,7 +293,6 @@ -c ./build/libbirdfont/birdfont.h build/birdfont-autotrace/*.c \ -D 'GETTEXT_PACKAGE="birdfont"' \ $(pkg-config --cflags """ + config.GEE + """) \ - $(pkg-config --cflags libxml-2.0) \ $(pkg-config --cflags gio-2.0) \ $(pkg-config --cflags cairo) \ $(pkg-config --cflags glib-2.0) \ @@ -314,7 +305,6 @@ -Lbuild/bin/ -lbirdfont \ -lm \ $(pkg-config --libs """ + config.GEE + """) \ - $(pkg-config --libs libxml-2.0) \ $(pkg-config --libs gio-2.0) \ $(pkg-config --libs cairo) \ $(pkg-config --libs glib-2.0) \ @@ -337,7 +327,6 @@ --enable-experimental \ --vapidir=./ \ --pkg """ + config.GEE + """ \ - --pkg libxml-2.0 \ --pkg gio-2.0 \ --pkg cairo \ --pkg libsoup-2.4 \ @@ -351,7 +340,6 @@ -c ./build/libbirdfont/birdfont.h build/birdfont/*.c \ -D 'GETTEXT_PACKAGE="birdfont"' \ $(pkg-config --cflags """ + config.GEE + """) \ - $(pkg-config --cflags libxml-2.0) \ $(pkg-config --cflags gio-2.0) \ $(pkg-config --cflags cairo) \ $(pkg-config --cflags glib-2.0) \ @@ -365,7 +353,6 @@ build/birdfont/*.o \ -Lbuild/bin/ -lbirdfont \ $(pkg-config --libs """ + config.GEE + """) \ - $(pkg-config --libs libxml-2.0) \ $(pkg-config --libs gio-2.0) \ $(pkg-config --libs cairo) \ $(pkg-config --libs glib-2.0) \