Clone in a terminal:
Commit 555d0fe
Johan Mattsson - 2013-02-21T14:52:40+00:00
555d0fe9fa8794cee2ce45263134d6e7949dc638johan.mattsson.m@gmail.com

rename PointType.CURVE to PointType.CUBIC

Changed files (9)

Diff

diff --git a/libbirdfont/EditPoint.vala b/libbirdfont/EditPoint.valaindex b502e52..9b2966d 100644--- a/libbirdfont/EditPoint.vala+++ b/libbirdfont/EditPoint.vala@@ -22,8 +22,8 @@ namespace BirdFont { public enum PointType { 	NONE, 	NORMAL,-	LINE,-	CURVE,+	LINE_CUBIC,+	CUBIC, 	QUADRATIC, 	DOUBLE_CURVE, 	END,@@ -54,7 +54,7 @@ public class EditPoint { 	 	public bool tie_handles = false; 	-	public EditPoint (double nx = 0, double ny = 0, PointType nt = PointType.LINE) {+	public EditPoint (double nx = 0, double ny = 0, PointType nt = PointType.LINE_CUBIC) { 		x = nx; 		y = ny; 		type = nt;@@ -120,7 +120,7 @@ public class EditPoint { 			n = get_prev ().data; 			h = get_left_handle (); 			-			if (h.type == PointType.LINE) {+			if (h.type == PointType.LINE_CUBIC) { 				nx = x + ((n.x - x) / 3); 				ny = y + ((n.y - y) / 3); 			@@ -132,7 +132,7 @@ public class EditPoint { 			// on the other side 			h = n.get_right_handle (); 			-			if (h.type == PointType.LINE) {+			if (h.type == PointType.LINE_CUBIC) { 				nx = n.x + ((x - n.x) / 3); 				ny = n.y + ((y - n.y) / 3); 			@@ -145,7 +145,7 @@ public class EditPoint { 			n = get_next ().data; 			h = get_right_handle (); 			-			if (h.type == PointType.LINE) {+			if (h.type == PointType.LINE_CUBIC) { 				nx = x + ((n.x - x) / 3); 				ny = y + ((n.y - y) / 3); 				@@ -154,7 +154,7 @@ public class EditPoint {  			h = n.get_left_handle (); 			-			if (h.type == PointType.LINE) {+			if (h.type == PointType.LINE_CUBIC) { 				nx = n.x + ((x - n.x) / 3); 				ny = n.y + ((y - n.y) / 3); @@ -189,8 +189,8 @@ public class EditPoint { 			angle = -acos (a / length) + PI; 		} 		-		left_handle.type = PointType.CURVE;-		right_handle.type = PointType.CURVE;+		left_handle.type = PointType.CUBIC;+		right_handle.type = PointType.CUBIC; 		 		right_handle.angle = angle; 		left_handle.angle = angle;diff --git a/libbirdfont/EditPointHandle.vala b/libbirdfont/EditPointHandle.valaindex 28cd2c7..ecb80cc 100644--- a/libbirdfont/EditPointHandle.vala+++ b/libbirdfont/EditPointHandle.vala@@ -33,7 +33,7 @@ public class EditPointHandle  { 		this.parent = none; 		this.angle = 0; 		this.length = 10;-		this.type = PointType.LINE;+		this.type = PointType.LINE_CUBIC; 		this.active = false; 	} 	@@ -41,7 +41,7 @@ public class EditPointHandle  { 		this.parent = parent; 		this.angle = angle; 		this.length = length;-		this.type = PointType.LINE;+		this.type = PointType.LINE_CUBIC; 		this.active = false; 	} diff --git a/libbirdfont/Font.vala b/libbirdfont/Font.valaindex 9c7f3ec..3e783cb 100644--- a/libbirdfont/Font.vala+++ b/libbirdfont/Font.vala@@ -728,11 +728,11 @@ public class Font : GLib.Object { 			foreach (var ep in p.points) { 				os.put_string (@"<point x=\"$(ep.x)\" y=\"$(ep.y)\" "); 				-				if (ep.right_handle.type == PointType.CURVE) {+				if (ep.right_handle.type == PointType.CUBIC) { 					os.put_string (@"right_type=\"cubic\" "); 				} -				if (ep.left_handle.type == PointType.CURVE) {+				if (ep.left_handle.type == PointType.CUBIC) { 					os.put_string (@"left_type=\"cubic\" "); 				} @@ -744,25 +744,25 @@ public class Font : GLib.Object { 					os.put_string (@"left_type=\"quadratic\" "); 				} -				if (ep.right_handle.type == PointType.LINE) {+				if (ep.right_handle.type == PointType.LINE_CUBIC) { 					os.put_string (@"right_type=\"linear\" "); 				} -				if (ep.left_handle.type == PointType.LINE) {+				if (ep.left_handle.type == PointType.LINE_CUBIC) { 					os.put_string (@"left_type=\"linear\" "); 				} 								-				if (ep.right_handle.type == PointType.CURVE || ep.right_handle.type == PointType.QUADRATIC) {+				if (ep.right_handle.type == PointType.CUBIC || ep.right_handle.type == PointType.QUADRATIC) { 					os.put_string (@"right_angle=\"$(ep.right_handle.angle)\" "); 					os.put_string (@"right_length=\"$(ep.right_handle.length)\" "); 				} 				-				if (ep.left_handle.type == PointType.CURVE) {+				if (ep.left_handle.type == PointType.CUBIC) { 					os.put_string (@"left_angle=\"$(ep.left_handle.angle)\" "); 					os.put_string (@"left_length=\"$(ep.left_handle.length)\" ");						 				} 				-				if (ep.right_handle.type == PointType.CURVE || ep.left_handle.type == PointType.CURVE) {+				if (ep.right_handle.type == PointType.CUBIC || ep.left_handle.type == PointType.CUBIC) { 					os.put_string (@"tie_handles=\"$(ep.tie_handles)\" "); 				} 				@@ -1400,8 +1400,8 @@ public class Font : GLib.Object { 		double length_right = 0; 		double length_left = 0; 		-		PointType type_right = PointType.LINE;-		PointType type_left = PointType.LINE;+		PointType type_right = PointType.LINE_CUBIC;+		PointType type_left = PointType.LINE_CUBIC; 		 		bool tie_handles = false; 		@@ -1415,11 +1415,11 @@ public class Font : GLib.Object { 			if (attr_name == "y") y = double.parse (attr_content);  			if (attr_name == "right_type" && attr_content == "linear") {-				type_right = PointType.LINE;+				type_right = PointType.LINE_CUBIC; 			}	  			if (attr_name == "left_type" && attr_content == "linear") {-				type_left = PointType.LINE;+				type_left = PointType.LINE_CUBIC; 			}	  			if (attr_name == "right_type" && attr_content == "quadratic") {@@ -1431,11 +1431,11 @@ public class Font : GLib.Object { 			}  			if (attr_name == "right_type" && attr_content == "cubic") {-				type_right = PointType.CURVE;+				type_right = PointType.CUBIC; 			}	  			if (attr_name == "left_type" && attr_content == "cubic") {-				type_left = PointType.CURVE;+				type_left = PointType.CUBIC; 			} 			 			if (attr_name == "right_angle") angle_right = double.parse (attr_content);@@ -1447,12 +1447,12 @@ public class Font : GLib.Object { 		} 	 		// backward compabtility-		if (type_right == PointType.LINE && length_right != 0) {-			type_right = PointType.CURVE;+		if (type_right == PointType.LINE_CUBIC && length_right != 0) {+			type_right = PointType.CUBIC; 		} -		if (type_left == PointType.LINE && length_left != 0) {-			type_left = PointType.CURVE;+		if (type_left == PointType.LINE_CUBIC && length_left != 0) {+			type_left = PointType.CUBIC; 		} 		 		ep = new EditPoint (x, y);diff --git a/libbirdfont/Glyph.vala b/libbirdfont/Glyph.valaindex f819357..3e6fdd2 100644--- a/libbirdfont/Glyph.vala+++ b/libbirdfont/Glyph.vala@@ -870,10 +870,10 @@ public class Glyph : FontDisplay { 			return_if_fail (e.prev != null); 			 			p.add_point (e);-			e.type = PointType.CURVE;+			e.type = PointType.CUBIC; 			-			e.right_handle.type = PointType.CURVE;-			e.left_handle.type = PointType.CURVE;+			e.right_handle.type = PointType.CUBIC;+			e.left_handle.type = PointType.CUBIC; 			 			paths.append (p); 			add_active_path (p);@@ -1088,7 +1088,7 @@ public class Glyph : FontDisplay { 			} 			 			if (p.points.length () == 2) {-				if (p.points.first ().data.type == PointType.LINE && p.points.last ().data.type == PointType.LINE) {+				if (p.points.first ().data.type == PointType.LINE_CUBIC && p.points.last ().data.type == PointType.LINE_CUBIC) { 					path_list.remove (p); 					continue; 				}diff --git a/libbirdfont/ImportSvg.vala b/libbirdfont/ImportSvg.valaindex 7e4ff8e..236dfd3 100644--- a/libbirdfont/ImportSvg.vala+++ b/libbirdfont/ImportSvg.vala@@ -744,7 +744,7 @@ public class ImportSvg {  				// start with line handles 				ep1 = path.points.last ().data;-				ep1.get_right_handle ().type = PointType.LINE;+				ep1.get_right_handle ().type = PointType.LINE_CUBIC; 				 				lx = ep1.x + ((x2 - ep1.x) / 3); 				ly = ep1.y + ((y2 - ep1.y) / 3);@@ -755,14 +755,14 @@ public class ImportSvg { 				// set curve handles 				ep1 = path.points.last ().data; 				ep1.recalculate_linear_handles ();-				ep1.get_right_handle ().type = PointType.CURVE;+				ep1.get_right_handle ().type = PointType.CUBIC; 				ep1.get_right_handle ().move_to_coordinate (x0, y0);				  				path.add (x2, y2); 								 				ep2 = path.points.last ().data; 				ep2.recalculate_linear_handles ();-				ep2.get_left_handle ().type = PointType.CURVE;+				ep2.get_left_handle ().type = PointType.CUBIC; 				ep2.get_left_handle ().move_to_coordinate (x1, y1); 			 				ep1.recalculate_linear_handles ();diff --git a/libbirdfont/OpenFontFormatWriter.vala b/libbirdfont/OpenFontFormatWriter.valaindex 644608c..afb650b 100644--- a/libbirdfont/OpenFontFormatWriter.vala+++ b/libbirdfont/OpenFontFormatWriter.vala@@ -1281,8 +1281,8 @@ class GlyfTable : Table { 					edit_point.get_left_handle ().set_point_type (PointType.NONE);
 					edit_point.get_left_handle ().length = 0;
 						
-					edit_point.type = PointType.CURVE;
-					edit_point.get_right_handle ().set_point_type (PointType.CURVE);
+					edit_point.type = PointType.CUBIC;
+					edit_point.get_right_handle ().set_point_type (PointType.CUBIC);
 					edit_point.get_right_handle ().move_to_coordinate (x, y);
 					
 					prev_is_curve = true;
@@ -1304,19 +1304,19 @@ class GlyfTable : Table { 				x = xcoordinates[first_point] * 1000.0 / units_per_em; // in proportion to em width
 				y = ycoordinates[first_point] * 1000.0 / units_per_em;
 
-				edit_point.get_left_handle ().set_point_type (PointType.CURVE);
+				edit_point.get_left_handle ().set_point_type (PointType.CUBIC);
 				edit_point.get_left_handle ().length = 0;
 					
-				edit_point.type = PointType.CURVE;
-				edit_point.get_right_handle ().set_point_type (PointType.CURVE);
+				edit_point.type = PointType.CUBIC;
+				edit_point.get_right_handle ().set_point_type (PointType.CUBIC);
 				edit_point.get_right_handle ().move_to_coordinate (x, y);
 			}
 			
 			// curve last to first
 			x = xcoordinates[first_point] * 1000.0 / units_per_em; // in proportion to em width
 			y = ycoordinates[first_point] * 1000.0 / units_per_em;
-			edit_point.type = PointType.CURVE;
-			edit_point.get_right_handle ().set_point_type (PointType.CURVE);
+			edit_point.type = PointType.CUBIC;
+			edit_point.get_right_handle ().set_point_type (PointType.CUBIC);
 			edit_point.get_right_handle ().move_to_coordinate (x, y);
 			
 			path.close ();
@@ -1418,7 +1418,7 @@ class GlyfTable : Table { 			foreach (EditPoint e in p.points) {
 				end_point++;
 				
-				if (e.get_right_handle ().type == PointType.CURVE) {
+				if (e.get_right_handle ().type == PointType.CUBIC) {
 					end_point++;
 				}
 			}
@@ -1460,7 +1460,7 @@ class GlyfTable : Table { 				flags.append (Coordinate.ON_PATH);
 				nflags++;
 				
-				if (e.get_right_handle ().type == PointType.CURVE) {
+				if (e.get_right_handle ().type == PointType.CUBIC) {
 					fd.add_byte (Coordinate.NONE);
 					flags.append (Coordinate.NONE);
 					nflags++;
@@ -1491,7 +1491,7 @@ class GlyfTable : Table { 				 				prev = rint (e.x * UNITS - g.left_limit * UNITS);
 				-				if (e.get_right_handle ().type == PointType.CURVE) {
+				if (e.get_right_handle ().type == PointType.CUBIC) {
 					x = rint (e.get_right_handle ().x () * UNITS - prev - g.left_limit * UNITS);
 
 					fd.add_16 ((int16) x);
@@ -1514,7 +1514,7 @@ class GlyfTable : Table { 				
 				prev = rint (e.y * UNITS + font.base_line * UNITS);
 
-				if (e.get_right_handle ().type == PointType.CURVE) {
+				if (e.get_right_handle ().type == PointType.CUBIC) {
 					y = rint (e.get_right_handle ().y () * UNITS - prev + font.base_line * UNITS);
 					
 					fd.add_16 ((int16) y);
diff --git a/libbirdfont/Path.vala b/libbirdfont/Path.valaindex 52e19c6..0e7b284 100644--- a/libbirdfont/Path.vala+++ b/libbirdfont/Path.vala@@ -742,7 +742,7 @@ public class Path { 	 * to the new item in list. 	 */ 	public unowned List<EditPoint> add_after (double x, double y, List<EditPoint>? previous_point) {-		EditPoint p = new EditPoint (x, y, PointType.LINE);	+		EditPoint p = new EditPoint (x, y, PointType.LINE_CUBIC);	 		return add_point_after (p, previous_point); 	} 	@@ -982,7 +982,7 @@ public class Path { 		eh.length = 0;  		eh = ((!)quadratic_path.points.last ().prev).data.get_right_handle ();-		eh.set_point_type (PointType.CURVE);+		eh.set_point_type (PointType.CUBIC); 		eh.length *= 1.6;  		return quadratic_path;@@ -1002,7 +1002,7 @@ public class Path { 		eh.length = 0; 		 		eh = start.get_right_handle ();-		eh.set_point_type (PointType.CURVE);+		eh.set_point_type (PointType.CUBIC); 		eh.move_to_coordinate (curve_x, curve_y); 	} @@ -1085,7 +1085,7 @@ public class Path { 		ny = bezier_path (0.5, start.y, start.get_right_handle ().y (), stop.get_left_handle ().y (), stop.y);  		if (Math.fabs (distance) > 0.01) {-			EditPoint new_edit_point = new EditPoint (nx, ny, PointType.CURVE);+			EditPoint new_edit_point = new EditPoint (nx, ny, PointType.CUBIC);  			new_edit_point.next = middle.get_next (); 			new_edit_point.prev = middle.get_prev ();@@ -1114,9 +1114,9 @@ public class Path { 		start = ep.get_prev ().data; 		stop = ep.get_next ().data; -		if (start.get_right_handle ().type == PointType.CURVE || stop.get_left_handle ().type  == PointType.CURVE) {-			start.get_right_handle ().type = PointType.CURVE;-			stop.get_left_handle ().type = PointType.CURVE;+		if (start.get_right_handle ().type == PointType.CUBIC || stop.get_left_handle ().type  == PointType.CUBIC) {+			start.get_right_handle ().type = PointType.CUBIC;+			stop.get_left_handle ().type = PointType.CUBIC; 		}  		add_point_after (ep, ep.get_prev ());@@ -1137,9 +1137,9 @@ public class Path { 		});  		// this is a point on a line-		if (start.get_right_handle ().type == PointType.LINE && stop.get_left_handle ().type  == PointType.LINE) {-			ep.get_right_handle ().set_point_type (PointType.LINE);-			ep.get_left_handle ().set_point_type (PointType.LINE);+		if (start.get_right_handle ().type == PointType.LINE_CUBIC && stop.get_left_handle ().type  == 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 (start.get_right_handle ().type == PointType.QUADRATIC) {  			x0 = quadratic_bezier_vector (1 - position, stop.x, start.get_right_handle ().x (), start.x);@@ -1152,10 +1152,10 @@ public class Path { 			bezier_vector (position, start.x, start.get_right_handle ().x (), stop.get_left_handle ().x (), stop.x, out x0, out x1); 			bezier_vector (position, start.y, start.get_right_handle ().y (), stop.get_left_handle ().y (), stop.y, out y0, out y1); -			ep.get_left_handle ().set_point_type (PointType.CURVE);+			ep.get_left_handle ().set_point_type (PointType.CUBIC); 			ep.get_left_handle ().move_to_coordinate (x0, y0); 			-			ep.get_right_handle ().set_point_type (PointType.CURVE);+			ep.get_right_handle ().set_point_type (PointType.CUBIC); 			ep.get_right_handle ().move_to_coordinate (x1, y1); 		} @@ -1733,8 +1733,8 @@ public class Path { 			if (il.has_edit_point (ex)) { 				s = (!) il.get_intersection (ex); 			-				en.type = PointType.CURVE;-				en.right_handle.type = PointType.CURVE;+				en.type = PointType.CUBIC;+				en.right_handle.type = PointType.CUBIC; 				en.right_handle.angle  = s.editpoint_b.right_handle.angle; 				en.right_handle.length = s.editpoint_b.right_handle.length; 							@@ -1773,8 +1773,8 @@ public class Path { 					} 				} -				en.type = PointType.CURVE;-				en.right_handle.type = PointType.CURVE;+				en.type = PointType.CUBIC;+				en.right_handle.type = PointType.CUBIC; 				en.right_handle.angle  = s.editpoint_a.right_handle.angle; 				en.right_handle.length = s.editpoint_a.right_handle.length; 								@@ -1825,7 +1825,7 @@ public class Path { 		// link points at the other end 		first = points.first ().data; 		handle = path.points.first ().data.right_handle;-		handle.type = PointType.CURVE;+		handle.type = PointType.CUBIC; 		handle.angle = first.right_handle.angle; 		handle.length = first.right_handle.length; 		path.points.remove_link (path.points.first ());@@ -1839,7 +1839,7 @@ public class Path { 		first = points.first ().data; 		points.remove_link (points.first ()); 		handle = points.last ().data.right_handle;-		handle.type = PointType.CURVE;+		handle.type = PointType.CUBIC; 		handle.angle = first.right_handle.angle; 		handle.length = first.right_handle.length; 	diff --git a/libbirdfont/PenTool.vala b/libbirdfont/PenTool.valaindex e957c64..bbf5bf4 100644--- a/libbirdfont/PenTool.vala+++ b/libbirdfont/PenTool.vala@@ -171,8 +171,8 @@ public class PenTool : Tool { 		 		// move curve handles 		if (move_selected_handle) {-			if (selected_handle.type == PointType.LINE) {-				selected_handle.set_point_type (PointType.CURVE); // TODO: quadratic+			if (selected_handle.type == PointType.LINE_CUBIC) {+				selected_handle.set_point_type (PointType.CUBIC); // TODO: quadratic 			} 				 			if (GridTool.is_visible ()) {diff --git a/libbirdfont/Svg.vala b/libbirdfont/Svg.valaindex 0599e6d..dfdcc8a 100644--- a/libbirdfont/Svg.vala+++ b/libbirdfont/Svg.vala@@ -80,7 +80,7 @@ class Svg { 	private static void add_abs_next (EditPoint start, EditPoint end, StringBuilder svg, Glyph g, bool do_glyph) { 		if (end.get_left_handle ().type == PointType.QUADRATIC) { 			add_quadratic_abs_path (end, start, svg, g, do_glyph);-		} else if (start.right_handle.type == PointType.LINE && end.left_handle.type == PointType.LINE) {+		} else if (start.right_handle.type == PointType.LINE_CUBIC && end.left_handle.type == PointType.LINE_CUBIC) { 			add_abs_line_to (end, start, svg, g, do_glyph); 		} else { 			add_cubic_abs_path (end, start, svg, g, do_glyph);

Contact

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