Commit abee853
Don't generate empty kern list in GPOS table
Changed files (4)
modifiedlibbirdfont/Glyph.valamodifiedlibbirdfont/KerningClasses.valamodifiedlibbirdfont/Menu.valamodifiedlibbirdfont/OpenFontFormat/KernList.vala
Diff
@@ -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;@@ -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 (); } @@ -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 ();@@ -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;