The Birdfont Source Code


All Repositories / birdfont.git / commit – RSS feed

Export open paths

These changes was commited to the Birdfont repository Thu, 05 Nov 2015 20:57:12 +0000.

Contributing

Send patches or pull requests to johan.mattsson.m@gmail.com.
Clone this repository: git clone https://github.com/johanmattssonm/birdfont.git
author Johan Mattsson <johan.mattsson.m@gmail.com>
Thu, 05 Nov 2015 20:57:12 +0000 (21:57 +0100)
committer Johan Mattsson <johan.mattsson.m@gmail.com>
Thu, 05 Nov 2015 20:57:12 +0000 (21:57 +0100)
commit ea8f1e774c761660cda8ec4b60f57d70aec4525e
tree d9863d31a89dfc5d909b7e539ec28fd36f7debaa
parent d45a73e67441907c42c1d9f0ff9b725b4b8e5a6c
Export open paths
Special fonts needs this.

libbirdfont/OpenFontFormat/load_font.c
libbirdfont/PointConverter.vala
--- a/libbirdfont/OpenFontFormat/load_font.c +++ b/libbirdfont/OpenFontFormat/load_font.c @@ -180,7 +180,8 @@ i++; } - if (len > 2 && is_quadratic (flags[0]) && !is_quadratic (flags[1])) { // first point is of curve but it is not part of a double curve + // first point is of curve but it is not part of a double curve + if (len > 2 && is_quadratic (flags[0]) && !is_quadratic (flags[1])) { first_normal_off_curve = TRUE; } @@ -385,11 +386,13 @@ gchar* coordinate = (gchar*) &coordinate_buffer; double units = get_units (units_per_em); guint prev_is_curve; + int points_length; if (length == 0) { return bf; } + points_length = length; create_contour (unicode, points, flags, &length, &new_points, &new_flags, err); x0 = new_points[0].x * units;
--- a/libbirdfont/PointConverter.vala +++ b/libbirdfont/PointConverter.vala @@ -47,13 +47,15 @@ PenTool.convert_point_segment_type (e, e.get_next (), PointType.DOUBLE_CURVE); } } - - if (quadratic_path.get_last_point ().get_right_handle ().type == PointType.CUBIC) { - PenTool.convert_point_segment_type (quadratic_path.get_last_point (), - quadratic_path.get_first_point (), - PointType.DOUBLE_CURVE); + + if (!original_path.is_open ()) { + if (quadratic_path.get_last_point ().get_right_handle ().type == PointType.CUBIC) { + PenTool.convert_point_segment_type (quadratic_path.get_last_point (), + quadratic_path.get_first_point (), + PointType.DOUBLE_CURVE); + } } - + quadratic_path.add_hidden_double_points (); return quadratic_path; @@ -76,6 +78,11 @@ size = quadratic_path.points.size; segment_start = quadratic_path.get_first_point (); + + if (original_path.is_open ()) { + size--; + } + for (int i = 0; i < size; i++) { segment_stop = (i == size -1) ? quadratic_path.get_first_point ()