The Birdfont Source Code


All Repositories / birdfont.git / commit – RSS feed

Merge ../birdfont-2.x

These changes was commited to the Birdfont repository Tue, 05 Jul 2016 08:21:14 +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>
Tue, 05 Jul 2016 08:21:14 +0000 (10:21 +0200)
committer Johan Mattsson <johan.mattsson.m@gmail.com>
Tue, 05 Jul 2016 08:21:14 +0000 (10:21 +0200)
commit bd0535cdef587a67a2adc905f5193f4850b52a64
tree 800ef397a9491fd0bc4a5996e96629da708f630b
parent b2633aca97d09f7481e1a86f13a76d81be36df3d
parent 9646ef0f904cbcabbc369f611a3ca489c214d148
Merge ../birdfont-2.x

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; } } }