Updated Files
libbirdfont/Svg.vala |
libbirdfont/SvgParser.vala |
--- a/libbirdfont/Svg.vala
+++ b/libbirdfont/Svg.vala
@@ -106,13 +106,14 @@
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));
@@ -126,7 +127,9 @@
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;
@@ -139,7 +142,7 @@
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));
@@ -150,8 +153,8 @@
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 ();
@@ -163,7 +166,8 @@
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;
@@ -177,10 +181,10 @@
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");
@@ -196,7 +200,8 @@
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;
@@ -210,13 +215,13 @@
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");
--- a/libbirdfont/SvgParser.vala
+++ b/libbirdfont/SvgParser.vala
@@ -1149,11 +1149,11 @@
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;
}
}
}