The Birdfont Source Code


All Repositories / birdfont.git / commit – RSS feed

Fix rotation of stroked paths

These changes was commited to the Birdfont repository Sun, 15 Nov 2015 10:35:26 +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>
Sun, 15 Nov 2015 10:35:26 +0000 (11:35 +0100)
committer Johan Mattsson <johan.mattsson.m@gmail.com>
Sun, 15 Nov 2015 10:35:26 +0000 (11:35 +0100)
commit 619e86ad58c4370070c7d6cbc57df3ead0af7c70
tree 1ba6ba2185373f19cdab0abd71cc0897e8d4e06a
parent 47e78ef5c41dcbdd725225798f7acbe11bf0e5a9
Fix rotation of stroked paths

libbirdfont/MoveTool.vala
libbirdfont/Path.vala
libbirdfont/ResizeTool.vala
--- a/libbirdfont/MoveTool.vala +++ b/libbirdfont/MoveTool.vala @@ -309,6 +309,8 @@ py2 = -10000; foreach (Path p in glyph.active_paths) { + p.update_region_boundaries (); + if (px > p.xmin) { px = p.xmin; }
--- a/libbirdfont/Path.vala +++ b/libbirdfont/Path.vala @@ -1115,20 +1115,18 @@ ymax = 0; ymin = 0; } - - if (stroke == 0) { - all_segments ((a, b) => { - update_region_boundaries_for_segment (a, b); - return true; - }); - } else { - s = get_stroke_fast (); - foreach (Path p in s.paths) { - p.all_segments ((a, b) => { - update_region_boundaries_for_segment (a, b); - return true; - }); - } + + all_segments ((a, b) => { + update_region_boundaries_for_segment (a, b); + return true; + }); + + if (stroke > 0) { + double stroke2 = stroke / 2; + xmax += stroke2; + xmin -= stroke2; + ymax += stroke2; + ymin -= stroke2; } if (points.size == 1) {
--- a/libbirdfont/ResizeTool.vala +++ b/libbirdfont/ResizeTool.vala @@ -192,6 +192,7 @@ Glyph glyph = MainWindow.get_current_glyph (); double dx, dy, xc2, yc2, w, h; Path last_path; + foreach (Path p in glyph.active_paths) { p.rotate (angle, cx, cy); } @@ -334,7 +335,8 @@ // move paths relative to the updated xmin and xmax get_selection_min (out selection_minx, out selection_miny); dx = resize_pos_x - selection_minx; - dy = resize_pos_y - selection_miny; + dy = resize_pos_y - resize_pos_y; + foreach (Path selected_path in glyph.active_paths) { selected_path.move (dx, dy); }