Commit fa973f4
separate files for zoom view and path list
Changed files (10)
modifiedlibbirdfont/BackgroundTool.valamodifiedlibbirdfont/CharDatabase.valamodifiedlibbirdfont/ClipTool.valamodifiedlibbirdfont/EotWriter.valamodifiedlibbirdfont/OpenFontFormat/GlyfTable.valamodifiedlibbirdfont/Path.valaaddedlibbirdfont/PathList.valamodifiedlibbirdfont/Tool.valamodifiedlibbirdfont/ZoomTool.valaaddedlibbirdfont/ZoomView.vala
Diff
@@ -34,7 +34,6 @@ class BackgroundTool : Tool { public static double bottom_limit; bool move_bg;- bool resize_bg; // DEL public BackgroundTool (string name) { base (name, _("Move, resize and rotate background image"));@@ -91,7 +90,6 @@ class BackgroundTool : Tool { ((!)bg).handler_release (x, y); move_bg = false;- resize_bg = false; }); move_action.connect((self, x, y) => { @@ -118,7 +116,9 @@ class BackgroundTool : Tool { bg.handler_move (x, y); - if (!(move_bg || resize_bg)) return;+ if (move_bg) {+ return;+ } dx = x - begin_x; dy = y - begin_y;@@ -52,6 +52,7 @@ class CharDatabase { case 'j': return true; case 'p': return true; case 'q': return true;+ case 'y': return true; } return false; @@ -26,7 +26,7 @@ public class ClipTool : Tool { string inkscape_svg; if (fd is OverView) {- // TODO:+ // TODO: copy glyphs in overview } if (fd is Glyph) { @@ -95,17 +95,17 @@ class EotWriter : GLib.Object { fd.add (0); // italic set to regular fd.add_littleendian_u32 (400); // weight- fd.add_littleendian_u16 (0); // 0 drm, designer must know that notified+ fd.add_littleendian_u16 (0); // 0 drm, designer must be notified fd.add_littleendian_u16 (0x504C); // magic number - // FIXA:+ // FIXME: // unicode ranges fd.add_littleendian_u32 (0); fd.add_littleendian_u32 (0); fd.add_littleendian_u32 (0); fd.add_littleendian_u32 (0); - // FIXA:+ // FIXME: // code page range fd.add_littleendian_u32 (0); fd.add_littleendian_u32 (0);@@ -207,7 +207,7 @@ class GlyfTable : Table { g.remove_empty_paths (); if (g.path_list.length () == 0) {- // location_offsets == location_offset + 1 to tell parser that this glyf does not have a body+ // location_offsets will be equal to location_offset + 1 to tell parser that this glyf does not have a body return; } @@ -575,10 +575,7 @@ public class Path { } } - /** Resize path relative to bottom left coordinates.- * @param cx xmin position during resize- * @param cy ymin position during resize- */+ /** Resize path relative to bottom left coordinates. */ public void resize (double ratio) { foreach (var p in points) { p.x *= ratio;@@ -1006,6 +1003,10 @@ public class Path { quadratic_path = copy (); + if (quadratic_path.points.length () < 2) {+ return quadratic_path;+ }+ // add hidden points quadratic_path.add_hidden_double_points (); @@ -1166,10 +1167,14 @@ public class Path { ep.get_right_handle ().set_point_type (PointType.LINE_QUADRATIC); ep.get_left_handle ().set_point_type (PointType.LINE_QUADRATIC); ep.recalculate_linear_handles ();- } else if (right == PointType.LINE_CUBIC && left == PointType.LINE_CUBIC) {+ } else if (right == PointType.LINE_CUBIC && left == PointType.LINE_CUBIC) { ep.get_right_handle ().set_point_type (PointType.LINE_CUBIC); ep.get_left_handle ().set_point_type (PointType.LINE_CUBIC); ep.recalculate_linear_handles ();+ } else if (right == PointType.LINE_DOUBLE_CURVE && left == PointType.LINE_DOUBLE_CURVE) {+ ep.get_right_handle ().set_point_type (PointType.LINE_DOUBLE_CURVE);+ ep.get_left_handle ().set_point_type (PointType.LINE_DOUBLE_CURVE);+ ep.recalculate_linear_handles (); } else if (right == PointType.DOUBLE_CURVE || left == PointType.DOUBLE_CURVE) { double_bezier_vector (position, start.x, start.get_right_handle ().x (), stop.get_left_handle ().x (), stop.x, out x0, out x1); double_bezier_vector (position, start.y, start.get_right_handle ().y (), stop.get_left_handle ().y (), stop.y, out y0, out y1);@@ -1177,9 +1182,6 @@ public class Path { ep.get_left_handle ().move_to_coordinate (x1, y1); ep.get_right_handle ().move_to_coordinate (x0, y0); -// ep.get_left_handle ().length = length0;-// ep.get_right_handle ().length = length1;- ep.get_left_handle ().set_point_type (PointType.DOUBLE_CURVE); ep.get_right_handle ().set_point_type (PointType.DOUBLE_CURVE); } else if (right == PointType.QUADRATIC) { @@ -1965,17 +1967,4 @@ public class Path { } } -public class PathList : GLib.Object {- public List<Path> paths = new List<Path> ();- - public PathList () {- }- - public void clear () {- while (paths.length () > 0) {- paths.remove_link (paths.first ());- }- }-}- }new file mode 100644@@ -0,0 +1,33 @@+/*+ Copyright (C) 2013 Johan Mattsson++ This program is free software: you can redistribute it and/or modify+ it under the terms of the GNU General Public License as published by+ the Free Software Foundation, either version 3 of the License, or+ (at your option) any later version.++ This program is distributed in the hope that it will be useful,+ but WITHOUT ANY WARRANTY; without even the implied warranty of+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+ GNU General Public License for more details.++ You should have received a copy of the GNU General Public License+ along with this program. If not, see <http://www.gnu.org/licenses/>.+*/++namespace BirdFont {++public class PathList : GLib.Object {+ public List<Path> paths = new List<Path> ();+ + public PathList () {+ }+ + public void clear () {+ while (paths.length () > 0) {+ paths.remove_link (paths.first ());+ }+ }+}++}@@ -303,7 +303,7 @@ public class Tool : GLib.Object { Tool.yield (); } - /** Run pending events in main loop before continue. */+ /** Run pending events in main loop before continuing. */ public static void @yield () { int t = 0; var time = new TimeoutSource (500);@@ -137,19 +137,5 @@ class ZoomTool : Tool { MainWindow.get_glyph_canvas ().redraw (); } }--class ZoomView : GLib.Object {- public double x;- public double y;- public double zoom;- public Allocation allocation;- - public ZoomView (double x, double y, double zoom, Allocation allocation) {- this.x = x;- this.y = y;- this.zoom = zoom;- this.allocation = allocation;- }-} }new file mode 100644@@ -0,0 +1,34 @@+/*+ Copyright (C) 2012 Johan Mattsson++ This program is free software: you can redistribute it and/or modify+ it under the terms of the GNU General Public License as published by+ the Free Software Foundation, either version 3 of the License, or+ (at your option) any later version.++ This program is distributed in the hope that it will be useful,+ but WITHOUT ANY WARRANTY; without even the implied warranty of+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+ GNU General Public License for more details.++ You should have received a copy of the GNU General Public License+ along with this program. If not, see <http://www.gnu.org/licenses/>.+*/++namespace BirdFont {++class ZoomView : GLib.Object {+ public double x;+ public double y;+ public double zoom;+ public Allocation allocation;+ + public ZoomView (double x, double y, double zoom, Allocation allocation) {+ this.x = x;+ this.y = y;+ this.zoom = zoom;+ this.allocation = allocation;+ }+}++}