The Birdfont Source Code


All Repositories / birdfont.git / blobdiff – RSS feed

Transform paths in SVG to BF conversion

Changes made to libsvgbird/SvgFile.vala

Contributing

Send patches or pull requests to johan.mattsson.m@gmail.com.
Clone this repository: git clone https://github.com/johanmattssonm/birdfont.git
--- libsvgbird/SvgFile.vala +++ libsvgbird/SvgFile.vala @@ -100,9 +100,15 @@ string aspect_ratio = ""; bool slice = true; bool preserve_aspect_ratio = true; + + if (tag.get_name () != "svg") { + warning (@"viewBox is not the svg tag: $(tag.get_name ())"); + return null; + } foreach (Attribute attribute in tag.get_attributes ()) { if (attribute.get_name () == "viewBox") { + print (@"$(attribute.get_name ()): $(attribute.get_content ())\n"); parameters = attribute.get_content (); } @@ -123,6 +129,7 @@ } } + print (@"parameters: $parameters\n"); arguments = parameters.replace (",", " "); while (arguments.index_of (" ") > -1) { @@ -131,8 +138,9 @@ string[] view_box_parameters = arguments.split (" "); - if (view_box_parameters.length != 4) { + if (unlikely (view_box_parameters.length != 4)) { warning ("Expecting four arguments in view box."); + warning (@"Content: $arguments ($parameters)"); return null; }