The Birdfont Source Code


All Repositories / birdfont.git / commitdiff – RSS feed

Calculate boundaries for multiple BirdFont paths

These changes was commited to the Birdfont repository Wed, 15 Jun 2016 14:43:12 +0000.

Contributing

Send patches or pull requests to johan.mattsson.m@gmail.com.
Clone this repository: git clone https://github.com/johanmattssonm/birdfont.git
[Wed, 15 Jun 2016 14:43:12 +0000]

Updated Files

libbirdfont/Glyph.vala
--- a/libbirdfont/Glyph.vala +++ b/libbirdfont/Glyph.vala @@ -706,12 +706,17 @@ foreach (SvgBird.Object object in objects) { - if (object is PathObject && object.stroke > 0) { + if (object is PathObject) { PathObject o = (PathObject) object; - pl = o.get_path ().get_stroke_fast (); + + if (object.stroke > 0) { + pl = o.get_path ().get_stroke_fast (); - foreach (Path part in pl.paths) { - boundaries_for_path (part, ref min_x, ref max_x, ref min_y, ref max_y); + foreach (Path part in pl.paths) { + boundaries_for_path (part, ref min_x, ref max_x, ref min_y, ref max_y); + } + } else { + boundaries_for_path (o.get_path (), ref min_x, ref max_x, ref min_y, ref max_y); } } else { boundaries_for_object (object, ref min_x, ref max_x, ref min_y, ref max_y); @@ -774,10 +779,21 @@ return true; }); - max_x = max_x2; - min_x = min_x2; - max_y = max_y2; - min_y = min_y2; + if (max_x2 > max_x) { + max_x = max_x2; + } + + if (min_x2 < min_x) { + min_x = min_x2; + } + + if (max_y2 < max_y) { + max_y = max_y2; + } + + if (min_x2 < min_y) { + min_y = min_y2; + } } bool has_top_line () {