The Birdfont Source Code


All Repositories / birdfont.git / commitdiff – RSS feed

Put ligatures last in TTF fonts

These changes was commited to the Birdfont repository Sun, 04 Oct 2015 08:26:27 +0000.

Contributing

Send patches or pull requests to johan.mattsson.m@gmail.com.
Clone this repository: git clone https://github.com/johanmattssonm/birdfont.git
[Sun, 04 Oct 2015 08:26:27 +0000]

Updated Files

libbirdfont/ExportTool.vala
libbirdfont/OpenFontFormat/CmapSubtableFormat12.vala
libbirdfont/OpenFontFormat/CmapSubtableFormat4.vala
libbirdfont/OpenFontFormat/GlyfTable.vala
--- a/libbirdfont/ExportTool.vala +++ b/libbirdfont/ExportTool.vala @@ -384,7 +384,7 @@ <span class="capstosmallcaps">OTF</span> features, <span class="swashes">like swashes </span> <span class="alternates">alternates & </span> - <span class="smallcaps">small caps</span>, can be been added + <span class="smallcaps">small caps</span>, can be added to the font.</span> </p> </div>
--- a/libbirdfont/OpenFontFormat/CmapSubtableFormat12.vala +++ b/libbirdfont/OpenFontFormat/CmapSubtableFormat12.vala @@ -24,8 +24,15 @@ GlyphRange glyph_range = new GlyphRange (); Gee.ArrayList<UniRange> ranges; FontData fd = new FontData (); - uint32 first_assigned = 1 + glyf_table.number_of_unassigned_glyphs; + uint32 first_assigned; uint32 indice; + + first_assigned = 0; + foreach (GlyphCollection g in glyf_table.glyphs) { + if (!g.is_unassigned () && g.get_unicode_character () == '\0') { + first_assigned++; + } + } foreach (GlyphCollection g in glyf_table.glyphs) { if (!g.is_unassigned () && g.get_unicode_character () < 0xFFFFFFFF) {
--- a/libbirdfont/OpenFontFormat/CmapSubtableFormat4.vala +++ b/libbirdfont/OpenFontFormat/CmapSubtableFormat4.vala @@ -188,7 +188,14 @@ uint16 gid_length = 0; uint32 indice; - uint32 first_assigned = 1 + glyf_table.number_of_unassigned_glyphs; + uint32 first_assigned; + + first_assigned = 0; + foreach (GlyphCollection g in glyf_table.glyphs) { + if (!g.is_unassigned () && g.get_unicode_character () == '\0') { + first_assigned++; + } + } foreach (GlyphCollection g in glyf_table.glyphs) { if (!g.is_unassigned () && g.get_unicode_character () < 0xFFFF) {
--- a/libbirdfont/OpenFontFormat/GlyfTable.vala +++ b/libbirdfont/OpenFontFormat/GlyfTable.vala @@ -44,7 +44,6 @@ // sorted array of glyphs public Gee.ArrayList<GlyphCollection> glyphs; public Gee.ArrayList<GlyfData> glyf_data; - public uint number_of_unassigned_glyphs = 0; uint16 max_points = 0; uint16 max_contours = 0; @@ -184,10 +183,16 @@ glyphs.add (gc); } } + + glyphs.sort ((a, b) => { + GlyphCollection g1, g2; + g1 = (GlyphCollection) a; + g2 = (GlyphCollection) b; + return (int) (g1.get_unicode_character () - g2.get_unicode_character ()); + }); foreach (GlyphCollection ug in unassigned_glyphs) { - glyphs.insert (1, ug); - number_of_unassigned_glyphs++; + glyphs.add (ug); } }