The Birdfont Source Code


All Repositories / birdfont.git / commitdiff – RSS feed

Fix arc instruction and division by zero in remove points on points

These changes was commited to the Birdfont repository Sat, 09 Jul 2016 22:05:00 +0000.

Contributing

Send patches or pull requests to johan.mattsson.m@gmail.com.
Clone this repository: git clone https://github.com/johanmattssonm/birdfont.git
[Sat, 09 Jul 2016 22:05:00 +0000]

Updated Files

libbirdfont/Path.vala
libsvgbird/SvgPath.vala
--- a/libbirdfont/Path.vala +++ b/libbirdfont/Path.vala @@ -2264,7 +2264,7 @@ remove_deleted_points (); // remove tripple points - for (int i = 0; i < points.size + 1; i++) { + for (int i = 0; i < points.size + 1 && points.size > 0; i++) { EditPoint ep = points.get (i % points.size); EditPoint next = points.get ((i + 1) % points.size); EditPoint previous = points.get ((i - 1 + points.size) % points.size); @@ -2274,7 +2274,11 @@ i--; } } - + + if (points.size == 0) { + return; + } + // remove points on points for (int i = 0; i < points.size + 1; i++) { EditPoint ep = points.get (i % points.size);
--- a/libsvgbird/SvgPath.vala +++ b/libsvgbird/SvgPath.vala @@ -81,6 +81,10 @@ cr.translate (x, y); cr.rotate (rotation); cr.scale (rx, ry); + + double start_x = Math.cos (-angle_start); + double start_y = Math.sin (-angle_start); + cr.move_to (start_x, start_y); if (angle_extent > 0) { cr.arc_negative (0, 0, 1, -angle_start, -angle_start - angle_extent);