Commit 12b4921
Fix double quadratic points in TTF generation
Changed files (3)
modifiedlibbirdfont/Path.valamodifiedlibbirdfont/TestBirdFont.valamodifiedlibbirdfont/TestCases.vala
Diff
@@ -1,5 +1,5 @@ /*- Copyright (C) 2012, 2013 Johan Mattsson+ Copyright (C) 2012, 2013, 2014 Johan Mattsson This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as @@ -1052,6 +1052,8 @@ public class Path { PointType left; PointType right; double x, y;+ Gee.ArrayList<EditPoint> middle_points = new Gee.ArrayList<EditPoint> ();+ Gee.ArrayList<EditPoint> first_points = new Gee.ArrayList<EditPoint> (); foreach (EditPoint next in points) { left = first.get_right_handle ().type;@@ -1076,10 +1078,15 @@ public class Path { next.get_left_handle ().type = PointType.QUADRATIC; next.type = PointType.QUADRATIC; - add_point_after (hidden, first);+ middle_points.add (hidden);+ first_points.add (first); } first = next; }+ + for (int i = 0; i < middle_points.size; i++) {+ add_point_after (middle_points.get (i), first_points.get (i));+ } } /** Convert quadratic bezier points to cubic representation of the glyph@@ -198,7 +198,9 @@ class TestBirdFont : GLib.Object { /** Run tests in main loop. */ public void run_all_tests () { TimeoutSource idle = new TimeoutSource (20); - MenuTab.new_file (); + + // FIXME: DELETE + // MenuTab.new_file (); idle.set_callback(() => { int s = AtomicInt.get (ref state); @@ -46,6 +46,7 @@ class TestCases { add (test_boundaries, "Boundaries"); add (test_extrema, "Extrema"); add (test_codepages, "Codepages");+ add (test_double_quadratic, "Double quadratic"); add_bechmark (benchmark_stroke, "Stroke"); }@@ -62,6 +63,22 @@ class TestCases { return test_cases; } + public static void test_double_quadratic () {+ Glyph g = MainWindow.get_current_glyph ();+ Gee.ArrayList<Path> paths = new Gee.ArrayList<Path> ();+ Path pn;+ + foreach (Path p in g.path_list) {+ pn = p.copy ();+ pn.add_hidden_double_points ();+ paths.add (pn);+ }+ + foreach (Path p in paths) {+ g.add_path (p);+ }+ }+ public static void test_codepages () { CodePageBits pages = new CodePageBits ();