Clone in a terminal:
Commit 673024b
Johan Mattsson - 2015-08-18T22:46:39+00:00
673024ba0c219fcaad6f968915344367a77407eajohan.mattsson.m@gmail.com

Sort coverage table for ligatures

Changed files (2)

Diff

diff --git a/libbirdfont/OpenFontFormat/LigatureCollection.vala b/libbirdfont/OpenFontFormat/LigatureCollection.valaindex 4537ff9..a0e0ed4 100644--- a/libbirdfont/OpenFontFormat/LigatureCollection.vala+++ b/libbirdfont/OpenFontFormat/LigatureCollection.vala@@ -100,7 +100,14 @@ public class LigatureCollection : GLib.Object { 			lig_set = new LigatureSet (glyf_table); 			lig_set.add (new Ligature (l, characters)); 			ligature_sets.add (lig_set);-		}		+		}+		+		// make sure coverage table is sorted otherwise will substitution not work+		ligature_sets.sort ((a, b) => {+			LigatureSet la = (LigatureSet) a;+			LigatureSet lb = (LigatureSet) b;+			return Posix.strcmp (la.get_coverage_char (), lb.get_coverage_char ());+		}); 	}  	public FontData get_font_data (GlyfTable glyf_table) throws GLib.Error {@@ -115,7 +122,7 @@ public class LigatureCollection : GLib.Object { 		table_start = (uint16) fd.length_with_padding ();  		fd.add_ushort (1); // format identifier-		fd.add_ushort (6 + (uint16) 2 * ligature_sets.size); // offset to coverage+		fd.add_ushort (6 + (uint16) (2 * ligature_sets.size)); // offset to coverage 		fd.add_ushort ((uint16) ligature_sets.size); // number of ligature set tables  		// array of offsets to ligature setsdiff --git a/libbirdfont/OpenFontFormat/LigatureSet.vala b/libbirdfont/OpenFontFormat/LigatureSet.valaindex a836367..5613c3e 100644--- a/libbirdfont/OpenFontFormat/LigatureSet.vala+++ b/libbirdfont/OpenFontFormat/LigatureSet.vala@@ -101,7 +101,7 @@ public class LigatureSet : GLib.Object { 		fd.add_ushort ((uint16) gid); 		 		// number of components including the coverage glyph-		fd.add_ushort ((uint16) parts.length); +		fd.add_ushort ((uint16) parts.length);  		foreach (string p in parts) { 			if (p.has_prefix ("U+") || p.has_prefix ("u+")) {

Contact

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