Commit 9646ef0
Fix SVG import
Changed files (2)
Diff
@@ -104,13 +104,14 @@ public class Svg { private static void add_abs_start (EditPoint ep, StringBuilder svg, Glyph g, bool to_glyph) { double left = g.left_limit; double baseline = -BirdFont.get_current_font ().base_line;- double height = g.get_height ();+ Font font = BirdFont.get_current_font ();+ double height = font.top_limit - font.base_line; svg.append_printf ("M"); if (!to_glyph) { svg.append_printf ("%s ", round (ep.x - left));- svg.append_printf ("%s ", round (-ep.y + height / 2));+ svg.append_printf ("%s ", round (-ep.y + height)); } else { svg.append_printf ("%s ", round (ep.x - left)); svg.append_printf ("%s ", round (ep.y + baseline));@@ -124,7 +125,9 @@ public class Svg { private static void add_abs_line_to (EditPoint start, EditPoint stop, StringBuilder svg, Glyph g, bool to_glyph) { double baseline = -BirdFont.get_current_font ().base_line; double left = g.left_limit;- double height = g.get_height ();+ Font font = BirdFont.get_current_font ();+ double height = font.top_limit - font.base_line; + double xa, ya, xb, yb; @@ -137,7 +140,7 @@ public class Svg { if (!to_glyph) { svg.append_printf ("%s ", round (xb - center_x - left));- svg.append_printf ("%s ", round (yb - center_y + height / 2)); + svg.append_printf ("%s ", round (yb - center_y + height)); } else { svg.append_printf ("%s ", round (xb - center_x - left)); svg.append_printf ("%s ", round (-yb + center_y + baseline));@@ -148,8 +151,8 @@ public class Svg { EditPoint middle; double x, y; - x = start.get_right_handle ().x + (end.get_left_handle ().x - start.get_right_handle ().x) / 2;- y = start.get_right_handle ().y + (end.get_left_handle ().y - start.get_right_handle ().y) / 2;+ x = start.get_right_handle ().x + (end.get_left_handle ().x - start.get_right_handle ().x);+ y = start.get_right_handle ().y + (end.get_left_handle ().y - start.get_right_handle ().y); middle = new EditPoint (x, y, PointType.QUADRATIC); middle.right_handle = end.get_left_handle ().copy ();@@ -161,7 +164,8 @@ public class Svg { private static void add_quadratic_abs_path (EditPoint start, EditPoint end, StringBuilder svg, Glyph g, bool to_glyph) { double left = g.left_limit; double baseline = -BirdFont.get_current_font ().base_line;- double height = g.get_height ();+ Font font = BirdFont.get_current_font ();+ double height = font.top_limit - font.base_line; double xa, ya, xb, yb, xc, yc, xd, yd; @@ -175,10 +179,10 @@ public class Svg { svg.append_printf ("Q"); svg.append_printf ("%s ", round (xb - center_x - left));- svg.append_printf ("%s ", round (yb - center_y + height / 2));+ svg.append_printf ("%s ", round (yb - center_y + height)); svg.append_printf ("%s ", round (xd - center_x - left));- svg.append_printf ("%s ", round (yd - center_y + height / 2));+ svg.append_printf ("%s ", round (yd - center_y + height)); } else { svg.append_printf ("Q");@@ -194,7 +198,8 @@ public class Svg { private static void add_cubic_abs_path (EditPoint start, EditPoint end, StringBuilder svg, Glyph g, bool to_glyph) { double left = g.left_limit; double baseline = -BirdFont.get_current_font ().base_line;- double height = g.get_height ();+ Font font = BirdFont.get_current_font ();+ double height = font.top_limit - font.base_line; double xa, ya, xb, yb, xc, yc, xd, yd; @@ -208,13 +213,13 @@ public class Svg { svg.append_printf ("C"); svg.append_printf ("%s ", round (xb - center_x - left));- svg.append_printf ("%s ", round (yb - center_y + height / 2));+ svg.append_printf ("%s ", round (yb - center_y + height)); svg.append_printf ("%s ", round (xc - center_x - left));- svg.append_printf ("%s ", round (yc - center_y + height / 2));+ svg.append_printf ("%s ", round (yc - center_y + height)); svg.append_printf ("%s ", round (xd - center_x - left));- svg.append_printf ("%s ", round (yd - center_y + height / 2)); + svg.append_printf ("%s ", round (yd - center_y + height)); } else { svg.append_printf ("C");@@ -1614,11 +1614,11 @@ public class SvgParser { b[i].y2 += font.base_line; } else { b[i].x0 += glyph.left_limit;- b[i].y0 += font.top_position;+ b[i].y0 += font.top_limit; b[i].x1 += glyph.left_limit;- b[i].y1 += font.top_position;+ b[i].y1 += font.top_limit; b[i].x2 += glyph.left_limit;- b[i].y2 += font.top_position;+ b[i].y2 += font.top_limit; } } }