Clone in a terminal:
Commit abee853
Johan Mattsson - 2015-03-19T19:32:25+00:00
abee853d6eef5ec61d1a2c069eb8fe5bd5e95940johan.mattsson.m@gmail.com

Don't generate empty kern list in GPOS table

Changed files (4)

Diff

diff --git a/libbirdfont/Glyph.vala b/libbirdfont/Glyph.valaindex 63e6b0b..e588608 100644--- a/libbirdfont/Glyph.vala+++ b/libbirdfont/Glyph.vala@@ -186,13 +186,13 @@ public class Glyph : FontDisplay { 		return active_paths.get (active_paths.size - 1); 	} 	-	public void boundaries (out double x1, out double y1, out double x2, out double y2) {+	public bool boundaries (out double x1, out double y1, out double x2, out double y2) { 		if (path_list.size == 0) { 			x1 = 0; 			y1 = 0; 			x2 = 0; 			y2 = 0;-			return;+			return false; 		}  		x1 = double.MAX;@@ -221,6 +221,8 @@ public class Glyph : FontDisplay { 				} 			} 		}+		+		return x1 != double.MAX; 	} 	 	public void selection_boundaries (out double x, out double y, out double w, out double h) {@@ -484,8 +486,7 @@ public class Glyph : FontDisplay { 	public double get_left_side_bearing () { 		double x1, y1, x2, y2; 		-		if (path_list.size > 0 && path_list.get (0).points.size > 0) {-			boundaries (out x1, out y1, out x2, out y2);+		if (boundaries (out x1, out y1, out x2, out y2)) { 			return x1 - left_limit; 		} else { 			return right_limit - left_limit;@@ -495,8 +496,7 @@ public class Glyph : FontDisplay { 	public double get_right_side_bearing () { 		double x1, y1, x2, y2; 		-		if (path_list.size > 0 && path_list.get (0).points.size > 0) {-			boundaries (out x1, out y1, out x2, out y2);+		if (boundaries (out x1, out y1, out x2, out y2)) { 			return right_limit - x2; 		} else { 			return right_limit - left_limit;diff --git a/libbirdfont/KerningClasses.vala b/libbirdfont/KerningClasses.valaindex d5740bb..f355149 100644--- a/libbirdfont/KerningClasses.vala+++ b/libbirdfont/KerningClasses.vala@@ -516,7 +516,6 @@ public class KerningClasses : GLib.Object { 		// add the right hand glyph and the kerning value 		foreach (Glyph character in left_glyphs) { 			KerningPair kl = new KerningPair (character);-			pairs.add (kl);  			foreach (GlyphRange r in classes_last) { 				foreach (UniRange u in r.ranges) {@@ -547,6 +546,15 @@ public class KerningClasses : GLib.Object { 				} 			} 			+			if (kl.kerning.size > 0) {+				pairs.add (kl);+			}+			+			if (kl.kerning.size == 0) {+				warning (@"No kerning pairs for character: $((kl.character.get_name ()))");+			}+			+						 			kl.sort (); 		} 		diff --git a/libbirdfont/Menu.vala b/libbirdfont/Menu.valaindex 6cb3469..ae5e524 100644--- a/libbirdfont/Menu.vala+++ b/libbirdfont/Menu.vala@@ -441,7 +441,7 @@ public class Menu : GLib.Object { 			show_menu = false; 		}); 		menu.items.add (description);-																																														+																						 		current_menu = menu; 		top_menu = menu; 		allocation = new WidgetAllocation ();@@ -465,7 +465,7 @@ public class Menu : GLib.Object { 				 				display = current_display.get_name (); 				-				if (!(display == "Kerning" && item.modifiers == NONE)) {+				if (!(display == "Kerning" && display == "Spacing" && item.modifiers == NONE)) { 					if (!SettingsDisplay.update_key_bindings  						&& (item.display == "" || item.display == display)) { 						item.action ();diff --git a/libbirdfont/OpenFontFormat/KernList.vala b/libbirdfont/OpenFontFormat/KernList.valaindex dc4bb13..e375622 100644--- a/libbirdfont/OpenFontFormat/KernList.vala+++ b/libbirdfont/OpenFontFormat/KernList.vala@@ -57,7 +57,7 @@ public class KernList : GLib.Object { 			pairs.add (current_pairs); 			 			if (unlikely (kerning_pair.kerning.size == 0)) {-				warning ("No pairs.");+				warning (@"No kerning pairs for character: $((kerning_pair.character.get_name ()))"); 			} 			 			i = 0;

Contact

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