Clone in a terminal:
Commit f7e5a15
Johan Mattsson - 2015-03-21T12:07:44+00:00
f7e5a15f05a299b602864c978ee6a9705637bbccjohan.mattsson.m@gmail.com

Make it possible to mix tied and symmetrical handles with straight lines

Changed files (5)

Diff

diff --git a/libbirdfont/DrawingTools.vala b/libbirdfont/DrawingTools.valaindex 9272dcc..1af17f4 100644--- a/libbirdfont/DrawingTools.vala+++ b/libbirdfont/DrawingTools.vala@@ -1113,7 +1113,7 @@ public class DrawingTools : ToolCollection  { 	} 			 	void show_point_tool_modifiers () {-		draw_tool_modifiers.set_headline (t_("Control Point Tools"));+		draw_tool_modifiers.set_headline (t_("Control Points")); 		 		tie_handles.set_tool_visibility (true); 		reflect_handle.set_tool_visibility (true);diff --git a/libbirdfont/EditPoint.vala b/libbirdfont/EditPoint.valaindex 6dd0999..82ba23f 100644--- a/libbirdfont/EditPoint.vala+++ b/libbirdfont/EditPoint.vala@@ -206,6 +206,11 @@ public class EditPoint : GLib.Object { 		if (next == null || get_next ().next != null) { 				return; 		}++		if (unlikely (reflective_point || tie_handles)) {+			warning ("Points on lines can't have tied handles.");+			return;+		} 		 		px = get_next ().get_next ().x; 		py = get_next ().get_next ().y;diff --git a/libbirdfont/ForesightTool.vala b/libbirdfont/ForesightTool.valaindex 751f38b..9319b7c 100644--- a/libbirdfont/ForesightTool.vala+++ b/libbirdfont/ForesightTool.vala@@ -195,7 +195,7 @@ public class ForesightTool : Tool { 						return; 					} 					last = PenTool.selected_points.get (PenTool.selected_points.size - 1);-					last.point.convert_to_curve ();+					//last.point.convert_to_curve (); 				} 				 				PenTool.move_selected_handle = true;diff --git a/libbirdfont/PenTool.vala b/libbirdfont/PenTool.valaindex 10b1cd7..774990a 100644--- a/libbirdfont/PenTool.vala+++ b/libbirdfont/PenTool.vala@@ -1494,7 +1494,9 @@ public class PenTool : Tool {  	static void set_default_handle_positions_on_path (Path path) { 		foreach (EditPoint e in path.points) {-			e.recalculate_linear_handles ();+			if (!e.tie_handles && !e.reflective_point) {+				e.recalculate_linear_handles ();+			} 		} 	} 	diff --git a/libbirdfont/TrackTool.vala b/libbirdfont/TrackTool.valaindex de3480f..156a540 100644--- a/libbirdfont/TrackTool.vala+++ b/libbirdfont/TrackTool.vala@@ -128,6 +128,9 @@ public class TrackTool : Tool { 			if (button == 1 && draw_freehand) { 				add_endpoint_and_merge (x, y); 			}+			+			set_tie ();+			 			BirdFont.get_current_font ().touch (); 		}); @@ -170,6 +173,21 @@ public class TrackTool : Tool { 			p.key_press_action (p, keyval); 		}); 	}+		+	void set_tie () {+		Glyph glyph = MainWindow.get_current_glyph ();+		Path p = glyph.path_list.get (glyph.path_list.size - 1);+		+		foreach (EditPoint ep in p.points) {+			if (ep.get_right_handle ().is_line () || ep.get_left_handle ().is_line ()) {+				ep.set_tie_handle (false);+			}++			if (!ep.get_right_handle ().is_line () || !ep.get_left_handle ().is_line ()) {+				ep.convert_to_curve ();+			}+		}+	}  	public void set_samples_per_point (double s) { 		samples_per_point = s;@@ -233,6 +251,7 @@ public class TrackTool : Tool { 			if (DrawingTools.get_selected_point_type () == PointType.QUADRATIC) { 				foreach (EditPoint e in p.points) { 					if (e.tie_handles) {+						e.convert_to_curve (); 						e.process_tied_handle ();							 					} 				}@@ -463,7 +482,9 @@ public class TrackTool : Tool { 		EditPoint average; 		Path p; 		Glyph glyph;-		Gee.ArrayList<EditPoint> points = new Gee.ArrayList<EditPoint> ();+		Gee.ArrayList<EditPoint> points;+		+		points = new Gee.ArrayList<EditPoint> (); 		 		if (added_points == 0) { 			warning ("No points to add.");@@ -515,6 +536,7 @@ public class TrackTool : Tool { 			if (p.points.size > 2) { 				PenTool.convert_point_to_line (average.get_prev (), true); 				average.get_prev ().process_tied_handle ();+				average.get_prev ().set_tie_handle (false); 			} 		} 

Contact

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