The Birdfont Source Code


All Repositories / birdfont.git / commit – RSS feed

Add missing ligatures

These changes was commited to the Birdfont repository Mon, 17 Aug 2015 14:56:49 +0000.

Contributing

Send patches or pull requests to johan.mattsson.m@gmail.com.
Clone this repository: git clone https://github.com/johanmattssonm/birdfont.git
author Johan Mattsson <johan.mattsson.m@gmail.com>
Mon, 17 Aug 2015 14:56:49 +0000 (16:56 +0200)
committer Johan Mattsson <johan.mattsson.m@gmail.com>
Mon, 17 Aug 2015 14:57:45 +0000 (16:57 +0200)
commit 2df6b0cbf3174ea45f381f258ebf32e1e575c5a6
tree ecc330d2d3655f1a0c7ee2b57d0b0a018518684e
parent 6fd04cc00b187264f7233afaf4289b7e70c1b57a
Add missing ligatures

libbirdfont/OpenFontFormat/LigatureCollection.vala
--- a/libbirdfont/OpenFontFormat/LigatureCollection.vala +++ b/libbirdfont/OpenFontFormat/LigatureCollection.vala @@ -42,6 +42,7 @@ Font font = BirdFont.get_current_font (); Ligatures ligatures = font.get_ligatures (); + int i = 0; ligatures.get_ligatures ((parts, ligature) => { add_ligatures (glyf_table, parts, ligature); }); @@ -49,7 +50,7 @@ void add_contextual_ligatures (GlyfTable glyf_table, ContextualLigature cl) { foreach (string l in cl.ligatures.strip ().split (" ")) { - add_ligatures (glyf_table, cl.input, l); // FIXME: DELETE parts = "r" ? + add_ligatures (glyf_table, cl.input, l); } } @@ -60,6 +61,7 @@ Font font = BirdFont.get_current_font (); string[] parts = characters.strip ().split (" "); string l = ligatures; + bool has_set = false; if (l.has_prefix ("U+") || l.has_prefix ("u+")) { l = (!) Font.to_unichar (l).to_string (); @@ -86,13 +88,19 @@ return; } - if (last_set.starts_with (parts[0])) { + foreach (LigatureSet s in ligature_sets) { + if (s.starts_with (parts[0])) { + has_set = true; + last_set = s; + } + } + + if (has_set) { last_set.add (new Ligature (l, characters)); } else { lig_set = new LigatureSet (glyf_table); lig_set.add (new Ligature (l, characters)); ligature_sets.add (lig_set); - last_set = lig_set; } }