The Birdfont Source Code


All Repositories / birdfont.git / commit – RSS feed

Fix rotate and resize in embedded SVG files

These changes was commited to the Birdfont repository Sat, 01 Oct 2016 09:23:25 +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>
Sat, 01 Oct 2016 09:23:25 +0000 (11:23 +0200)
committer Johan Mattsson <johan.mattsson.m@gmail.com>
Sat, 01 Oct 2016 09:23:25 +0000 (11:23 +0200)
commit fb7ce963c1cdeb29477b07a1ec970a111181a1d0
tree 1a458d830b2a1bf234a7646d376d6bae39025574
parent 52c570ae9412f33ea1008b7e28e603439033e221
Fix rotate and resize in embedded SVG files

libbirdfont/EmbeddedSvg.vala
libbirdfont/ResizeTool.vala
--- a/libbirdfont/EmbeddedSvg.vala +++ b/libbirdfont/EmbeddedSvg.vala @@ -21,6 +21,8 @@ public class EmbeddedSvg : SvgBird.Object { public string svg_data = ""; + + // the view matrix belongs to the drawing public SvgDrawing drawing = new SvgDrawing (); public double x;
--- a/libbirdfont/ResizeTool.vala +++ b/libbirdfont/ResizeTool.vala @@ -268,8 +268,10 @@ EmbeddedSvg svg = (EmbeddedSvg) p; x = selection_box_left - svg.x + selection_box_width / 2; y = selection_box_top + svg.y + selection_box_height / 2; - p.transforms.rotate (angle, x, y); - rotation = p.transforms.total_rotation; + double theta = angle - svg.drawing.transforms.rotation; + svg.drawing.transforms.rotate (theta, x, y); + svg.drawing.transforms.collapse_transforms (); + rotation = svg.drawing.transforms.total_rotation; } else if (p is PathObject) { Path path = ((PathObject) p).get_path (); SvgTransforms transform = new SvgTransforms (); @@ -396,8 +398,10 @@ EmbeddedSvg svg = (EmbeddedSvg) p; x = selection_box_left - svg.x; y = selection_box_top + svg.y + selection_box_height; - p.transforms.resize (ratio_x, ratio_y, x, y); - glyph.layers.update_boundaries_for_object (); + svg.drawing.transforms.resize (ratio_x, ratio_y, x, y); + svg.drawing.transforms.collapse_transforms (); + svg.drawing.update_view_matrix (); + svg.drawing.update_boundaries_for_object (); } else if (p is PathObject) { Path path = ((PathObject) p).get_path (); x = selection_box_center_x - selection_box_width / 2; @@ -411,6 +415,7 @@ } if (glyph.active_paths.size > 0) { + glyph.layers.update_boundaries_for_object (); update_resized_boundaries (); objects_resized (resized_width, resized_height); }