Clone in a terminal:
Commit 9e7a4dd
Johan Mattsson - 2016-07-07T14:14:35+00:00
9e7a4dd1f90b2f3cf7da001ab51ee0f9e3c14722johan.mattsson.m@gmail.com

Fix Illustrator paths

Changed files (2)

Diff

diff --git a/libbirdfont/Path.vala b/libbirdfont/Path.valaindex a97f2ca..80f9f00 100644--- a/libbirdfont/Path.vala+++ b/libbirdfont/Path.vala@@ -2262,16 +2262,25 @@ public class Path : GLib.Object { 		} 		 		remove_deleted_points ();-		++		// remove tripple points 		for (int i = 0; i < points.size + 1; i++) { 			EditPoint ep = points.get (i % points.size);-			n = points.get ((i + 1) % points.size);+			EditPoint next = points.get ((i + 1) % points.size); 			EditPoint previous = points.get ((i - 1 + points.size) % points.size); 			-			if (Path.distance_to_point (n, ep) < t && Path.distance_to_point (previous, ep) < t) {+			if (Path.distance_to_point (next, ep) < t && Path.distance_to_point (previous, ep) < t) { 				points.remove (ep); 				i--;-			} else if (Path.distance_to_point (n, ep) < t) {+			}+		}+	+		// remove points on points+		for (int i = 0; i < points.size + 1; i++) {+			EditPoint ep = points.get (i % points.size);+			n = points.get ((i + 1) % points.size);+			+			if (Path.distance_to_point (n, ep) < t) { 				remove.add (ep); 			} 		}diff --git a/libsvgbird/SvgFile.vala b/libsvgbird/SvgFile.valaindex 65d1073..19d14a3 100644--- a/libsvgbird/SvgFile.vala+++ b/libsvgbird/SvgFile.vala@@ -801,6 +801,7 @@ public class SvgFile : GLib.Object { 		// all instructions are padded  		for (int i = 0; i < points_size; i++) {+			print (@"$(bezier_points[i])\n"); 			// FIXME: add more types 			if (bezier_points[i].type == 'M') { 				if (i == 0) {@@ -878,11 +879,18 @@ public class SvgFile : GLib.Object { 				if (p.point_data.size > 8) { 					Points illustrator_points = new Points (); 					-					illustrator_points.x = p.point_data.get_double (p.point_data.size - 3);-					illustrator_points.y = p.point_data.get_double (p.point_data.size - 2);-						+					if (p.point_data.get_point_type (p.point_data.size - 8) == POINT_CUBIC) {+						illustrator_points.x = p.point_data.get_double (p.point_data.size - 3);+						illustrator_points.y = p.point_data.get_double (p.point_data.size - 2);+					} else {+						illustrator_points.x = p.point_data.get_double (p.point_data.size - 7);+						illustrator_points.y = p.point_data.get_double (p.point_data.size - 6);+					}+					 					int start = p.point_data.get_point_type (0) == POINT_CUBIC ? 8 : 0; 					+					start = 0;+					 					for (int i = start; i < p.point_data.size; i += 1) { 						illustrator_points.point_data.add (p.point_data.get_double (i)); 					}

Contact

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