Clone in a terminal:
Commit 12b4921
Johan Mattsson - 2014-06-07T14:45:09+00:00
12b492157f70412cb80ded5c3a94203ecff4f714johan.mattsson.m@gmail.com

Fix double quadratic points in TTF generation

Changed files (3)

Diff

diff --git a/libbirdfont/Path.vala b/libbirdfont/Path.valaindex 0a5af2c..203f016 100644--- a/libbirdfont/Path.vala+++ b/libbirdfont/Path.vala@@ -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 glyphdiff --git a/libbirdfont/TestBirdFont.vala b/libbirdfont/TestBirdFont.valaindex d87f11b..34f71be 100644--- a/libbirdfont/TestBirdFont.vala+++ b/libbirdfont/TestBirdFont.vala@@ -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);
diff --git a/libbirdfont/TestCases.vala b/libbirdfont/TestCases.valaindex 1622a3a..210da9d 100644--- a/libbirdfont/TestCases.vala+++ b/libbirdfont/TestCases.vala@@ -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 (); 		

Contact

Email: johan.mattsson.m@gmail.com
Mastodon: typo.social/@birdfont
GitHub: johanmattssonm
LinkedIn: johan-mattsson-2ab324112