The Birdfont Source Code


All Repositories / birdfont.git / commitdiff – RSS feed

Fix postscript names for glyphs

These changes was commited to the Birdfont repository Tue, 13 Oct 2015 05:31:09 +0000.

Contributing

Send patches or pull requests to johan.mattsson.m@gmail.com.
Clone this repository: git clone https://github.com/johanmattssonm/birdfont.git
[Tue, 13 Oct 2015 05:31:09 +0000]

Updated Files

libbirdfont/OpenFontFormat/PostTable.vala
--- a/libbirdfont/OpenFontFormat/PostTable.vala +++ b/libbirdfont/OpenFontFormat/PostTable.vala @@ -1,5 +1,5 @@ /* - Copyright (C) 2012, 2013 Johan Mattsson + Copyright (C) 2012 2013 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 @@ -1075,7 +1075,8 @@ GlyphCollection gc; Glyph g; string ps_name; - + StringBuilder name; + fd.add_fixed (0x00020000); // Version fd.add_fixed (0x00000000); // italicAngle @@ -1116,7 +1117,19 @@ name_index = (int) names.size; // use font specific name fd.add_ushort ((uint16) name_index); - ps_name = create_ps_name (g.get_name ()); + name = new StringBuilder (); + if (gc.is_unassigned ()) { + name.append (g.get_name ()); + } else { + unichar c = gc.get_unicode_character (); + if (c < 0xFFFF) { + name.printf ("uni%04x", c); + } else { + name.printf ("u%05x", c); + } + } + + ps_name = create_ps_name (name.str); names.add (ps_name); }