Commit cf52bf0
Skip empty ligatures in kerning display
Changed files (2)
Diff
@@ -81,8 +81,12 @@ public class GlyphSequence : GLib.Object { ligatures = font.get_ligatures (); foreach (ContextualLigature c in ligatures.contextual_ligatures) {- ligature_sequence.replace_contextual (c.get_backtrack (),- c.get_input (), c.get_lookahead (), c.get_ligature_sequence ()); + if (c.is_valid ()) {+ ligature_sequence.replace_contextual (c.get_backtrack (),+ c.get_input (),+ c.get_lookahead (),+ c.get_ligature_sequence ()); + } } ligatures.get_single_substitution_ligatures ((substitute, ligature) => {@@ -156,7 +160,7 @@ public class GlyphSequence : GLib.Object { glyph = substitute (i + backtrack.length (), input.length (), replacement); advance = backtrack.length () + replacement.length ();- i += advance;+ i += advance + 1; if (advance <= 0) { warning ("No advancement.");@@ -1,5 +1,5 @@ /*- Copyright (C) 2014 Johan Mattsson+ Copyright (C) 2014 2015 Johan Mattsson This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as @@ -141,7 +141,35 @@ public class ContextualLigature : GLib.Object { public GlyphSequence get_ligature_sequence () { return get_sequence (ligatures); }+ + public bool is_valid () {+ foreach (string s in font.get_names (backtrack)) {+ if (font.get_glyph_collection_by_name (s) == null) {+ return false;+ }+ } + foreach (string s in font.get_names (input)) {+ if (font.get_glyph_collection_by_name (s) == null) {+ return false;+ }+ }++ foreach (string s in font.get_names (lookahead)) {+ if (font.get_glyph_collection_by_name (s) == null) {+ return false;+ }+ }++ foreach (string s in font.get_names (ligatures)) {+ if (font.get_glyph_collection_by_name (s) == null) {+ return false;+ }+ }+ + return true;+ }+ GlyphSequence get_sequence (string context) { GlyphCollection? gc; GlyphSequence gs;