The Birdfont Source Code


All Repositories / birdfont.git / commitdiff – RSS feed

Merge branch '2.x' of github.com:johanmattssonm/birdfont

These changes was commited to the Birdfont repository Thu, 21 Jan 2016 14:21:33 +0000.

Contributing

Send patches or pull requests to johan.mattsson.m@gmail.com.
Clone this repository: git clone https://github.com/johanmattssonm/birdfont.git
[Thu, 21 Jan 2016 14:21:33 +0000]

Updated Files

libbirdfont/SvgParser.vala
--- a/libbirdfont/SvgParser.vala +++ b/libbirdfont/SvgParser.vala @@ -661,7 +661,7 @@ bezier_points[1].y0 = y2; g = MainWindow.get_current_glyph (); - move_and_resize (bezier_points, 4, false, 1, g); + move_and_resize (bezier_points, 2, false, 1, g); p = new Path (); @@ -1354,8 +1354,10 @@ first_left_x = 0; first_left_y = 0; - // FIXME: array boundaries - for (int i = 0; i < num_b; i++) { + ep = new EditPoint (); + + for (int i = 0; i < num_b; i++) { + warning (@"$(b[i])\n"); if (b[i].type == '\0') { warning ("Parser error."); return path_list; @@ -1393,8 +1395,7 @@ path = new Path (); first_point = true; - } else if (b[i].type == 'M') { - } else if (b[i].type == 'L') { + } else if (b[i].type == 'L' || b[i].type == 'M') { if (first_point) { first_left_x = b[i].x0; @@ -1402,12 +1403,11 @@ } ep = path.add (b[i].x0, b[i].y0); - ep.set_point_type (PointType.LINE_CUBIC); // TODO: quadratic + ep.set_point_type (PointType.CUBIC); // TODO: quadratic ep.get_right_handle ().set_point_type (PointType.LINE_CUBIC); - if (b[i -1].type == 'L' || first_point) { - // ep.get_left_handle ().set_point_type (PointType.LINE_CUBIC); - } + ep.get_left_handle ().set_point_type (PointType.CUBIC); + ep.get_left_handle ().move_to_coordinate (b[i].x0 - 0.00001, b[i].y0 - 0.00001); if (b[i + 1].type == 'C' || b[i + 1].type == 'S') { return_val_if_fail (i + 1 < num_b, path_list); @@ -1425,25 +1425,25 @@ first_left_x = b[i].x0; first_left_y = b[i].y0; } - + ep = path.add (b[i].x2, b[i].y2); ep.set_point_type (PointType.CUBIC); ep.get_right_handle ().set_point_type (PointType.CUBIC); ep.get_left_handle ().set_point_type (PointType.CUBIC); - + ep.get_left_handle ().move_to_coordinate (b[i].x1, b[i].y1); if (b[i].type == 'S') { smooth_points.add (ep); } - if (b[i + 1].type != 'z') { + if (b[i + 1].type != 'z' && i != num_b - 1) { ep.get_right_handle ().move_to_coordinate (b[i + 1].x0, b[i + 1].y0); } else { ep.get_right_handle ().move_to_coordinate (first_left_x, first_left_y); } - + first_point = false; } else { warning ("Unknown control point type."); @@ -1452,9 +1452,9 @@ } foreach (EditPoint e in smooth_points) { - e.set_point_type (PointType.LINE_DOUBLE_CURVE); - e.get_right_handle ().set_point_type (PointType.LINE_DOUBLE_CURVE); - e.get_left_handle ().set_point_type (PointType.LINE_DOUBLE_CURVE); + e.set_point_type (PointType.LINE_CUBIC); + e.get_right_handle ().set_point_type (PointType.LINE_CUBIC); + e.get_left_handle ().set_point_type (PointType.LINE_CUBIC); } foreach (EditPoint e in smooth_points) { @@ -1464,6 +1464,8 @@ for (int i = 0; i < 3; i++) { foreach (EditPoint e in smooth_points) { e.set_tie_handle (true); + e.get_right_handle ().set_point_type (PointType.CUBIC); + e.get_left_handle ().set_point_type (PointType.CUBIC); e.process_tied_handle (); } }