Clone in a terminal:
Commit bd0535c
Johan Mattsson - 2016-07-05T08:21:14+00:00
bd0535cdef587a67a2adc905f5193f4850b52a64johan.mattsson.m@gmail.com

Merge ../birdfont-2.x

Changed files (2)

Diff

diff --git a/libbirdfont/Svg.vala b/libbirdfont/Svg.valaindex 14a1915..e7ebf9b 100644--- a/libbirdfont/Svg.vala+++ b/libbirdfont/Svg.vala@@ -106,13 +106,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));@@ -126,7 +127,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; 		@@ -139,7 +142,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));@@ -150,8 +153,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 ();@@ -163,7 +166,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; 		@@ -177,10 +181,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");@@ -196,7 +200,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; 		@@ -210,13 +215,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");diff --git a/libbirdfont/SvgParser.vala b/libbirdfont/SvgParser.valaindex 205c6ee..2da2c83 100644--- a/libbirdfont/SvgParser.vala+++ b/libbirdfont/SvgParser.vala@@ -1149,11 +1149,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; 			} 		} 	}

Contact

Email: johan.mattsson.m@gmail.com
Mastodon: typo.social/@birdfont
GitHub: johanmattssonm
LinkedIn: johan-mattsson-2ab324112