Commit d5e1fdc
Fix TTF export and SVG font import
Changed files (4)
modifiedlibbirdfont/OpenFontFormat/load_font.cmodifiedlibbirdfont/Path.valamodifiedlibbirdfont/SvgFont.valamodifiedlibbirdfont/SvgParser.vala
Diff
@@ -1,5 +1,5 @@ /*- Copyright (C) 2013 Johan Mattsson+ Copyright (C) 2013 2014 Johan Mattsson This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as @@ -129,7 +129,7 @@ double remove_hidden_points (FT_Vector* points, char* flags, guint length, guint /** Add extra point where two ore more off curve points follow each other. */ void create_contour (guint unicode, FT_Vector* points, char* flags, int* length, FT_Vector** new_points, char** new_flags, int* err) { // This function has been tested with many fonts. ElsieSwashCaps-Regular- // is one of the more interesting fonts.+ // is one of the more interesting fonts I have seen. int i; int j; guint prev_is_curve;@@ -828,7 +828,7 @@ GString* load_freetype_font (char* file, int* err) { error = FT_Select_Charmap (face , FT_ENCODING_UNICODE); if (error) {- g_warning ("Freetype can not use unicode, error: %d\n", error);+ g_warning ("Freetype can not use Unicode, error: %d\n", error); *err = error; return bf; }@@ -1240,7 +1240,7 @@ public class Path { if (right == PointType.DOUBLE_CURVE || left == PointType.DOUBLE_CURVE) { double_bezier_vector (position, start.x, start.get_right_handle ().x, stop.get_left_handle ().x, stop.x, out x0, out x1);- double_bezier_vector (position, start.y, start.get_right_handle ().x, stop.get_left_handle ().y, stop.y, out y0, out y1);+ double_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.DOUBLE_CURVE); ep.get_right_handle ().set_point_type (PointType.DOUBLE_CURVE);@@ -1251,7 +1251,7 @@ public class Path { ep.type = PointType.DOUBLE_CURVE; } else if (right == PointType.QUADRATIC) { x0 = quadratic_bezier_vector (1 - position, stop.x, start.get_right_handle ().x, start.x);- y0 = quadratic_bezier_vector (1 - position, stop.y, start.get_right_handle ().x, start.y);+ y0 = quadratic_bezier_vector (1 - position, stop.y, start.get_right_handle ().y, start.y); ep.get_right_handle ().move_to_coordinate (x0, y0); ep.get_left_handle ().set_point_type (PointType.QUADRATIC); @@ -1262,7 +1262,7 @@ public class Path { ep.type = PointType.QUADRATIC; } else if (right == PointType.CUBIC || left == PointType.CUBIC) { 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 ().x, stop.get_left_handle ().y, stop.y, out y0, out y1);+ 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.CUBIC); ep.get_left_handle ().move_to_coordinate (x0, y0);@@ -236,6 +236,8 @@ class SvgFont : GLib.Object { string ligature = ""; SvgParser parser = new SvgParser (); + parser.set_format (SvgFormat.INKSCAPE);+ for (Xml.Attr* prop = node->properties; prop != null; prop = prop->next) { attr_name = prop->name; attr_content = prop->children->content;@@ -213,6 +213,9 @@ public class SvgParser { } } + /** @param path a path in the cartesian coordinate system+ * The other parameters are in the SVG coordinate system.+ */ public void apply_matrix (Path path, double a, double b, double c, double d, double e, double f){