Clone in a terminal:
Commit cf52bf0
Johan Mattsson - 2015-10-12T14:22:22+00:00
cf52bf0f58c63cc029819bed802abc2e88c8b5e2johan.mattsson.m@gmail.com

Skip empty ligatures in kerning display

Changed files (2)

Diff

diff --git a/libbirdfont/GlyphSequence.vala b/libbirdfont/GlyphSequence.valaindex 3546435..b77dac7 100644--- a/libbirdfont/GlyphSequence.vala+++ b/libbirdfont/GlyphSequence.vala@@ -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.");diff --git a/libbirdfont/OpenFontFormat/ContextualLigature.vala b/libbirdfont/OpenFontFormat/ContextualLigature.valaindex e87cc69..d8b57db 100644--- a/libbirdfont/OpenFontFormat/ContextualLigature.vala+++ b/libbirdfont/OpenFontFormat/ContextualLigature.vala@@ -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;

Contact

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