Clone in a terminal:
Commit 893948d
Johan Mattsson - 2015-10-12T13:25:47+00:00
893948dc74656e44416f2c28faf27c433f07857djohan.mattsson.m@gmail.com

Fix backtrack sequence for contextual ligatures Generate contextual substitutions compatible with the currents version of Harfbuzz.

Changed files (3)

Diff

diff --git a/libbirdfont/Font.vala b/libbirdfont/Font.valaindex 03aed28..bfbb055 100644--- a/libbirdfont/Font.vala+++ b/libbirdfont/Font.vala@@ -944,6 +944,14 @@ public class Font : GLib.Object { 	 * @return glyph names 	 */ 	public Gee.ArrayList<string> get_names (string glyphs) {+		 return get_names_order (glyphs, false);+	}++	public Gee.ArrayList<string> get_names_in_reverse_order (string glyphs) {+		return get_names_order (glyphs, true);+	}+		+	public Gee.ArrayList<string> get_names_order (string glyphs, bool reverse) { 		Gee.ArrayList<string> names = new Gee.ArrayList<string> (); 		string[] parts = glyphs.strip ().split (" "); 								@@ -966,7 +974,11 @@ public class Font : GLib.Object { 			} 			 			if (p != "") {-				names.add (p);+				if (reverse) {+					names.insert (0, p);+				} else {+					names.add (p);+				} 			} 		} 		diff --git a/libbirdfont/OpenFontFormat/ContextualLigature.vala b/libbirdfont/OpenFontFormat/ContextualLigature.valaindex c460a4d..e87cc69 100644--- a/libbirdfont/OpenFontFormat/ContextualLigature.vala+++ b/libbirdfont/OpenFontFormat/ContextualLigature.vala@@ -48,7 +48,14 @@ public class ContextualLigature : GLib.Object { 		FontData fd = new FontData (); 		Font font = BirdFont.get_current_font (); // FIXME: thread safety? 		-		Gee.ArrayList<string> backtrack = font.get_names (backtrack);+		// FIXME: it looks like get_names is the right function+		// but harfbuzz assumes that glyphs appear in the other +		// order for latin scripts, get_names_in_reverse_order+		// creates an array of glyphs in reverse order.+		//+		// I have not found out why yet.+		+		Gee.ArrayList<string> backtrack = font.get_names_in_reverse_order (backtrack); 		Gee.ArrayList<string> input = font.get_names (input); 		Gee.ArrayList<string> lookahead = font.get_names (lookahead); 		diff --git a/libbirdfont/OpenFontFormat/LigatureSet.vala b/libbirdfont/OpenFontFormat/LigatureSet.valaindex 5613c3e..29aa90a 100644--- a/libbirdfont/OpenFontFormat/LigatureSet.vala+++ b/libbirdfont/OpenFontFormat/LigatureSet.vala@@ -85,8 +85,8 @@ public class LigatureSet : GLib.Object { 		bool first = true; 		int gid; 		string l;--		l = ligature.ligature;+		+		l = ligature.ligature.strip (); 		if (l.has_prefix ("U+") || l.has_prefix ("u+")) { 			l = (!) Font.to_unichar (l).to_string (); 		}

Contact

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