The Birdfont Source Code


All Repositories / birdfont.git / commit – RSS feed

Add default characters if they are not present in font

These changes was commited to the Birdfont repository Thu, 30 Jun 2016 11:46:28 +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>
Thu, 30 Jun 2016 11:46:28 +0000 (13:46 +0200)
committer Johan Mattsson <johan.mattsson.m@gmail.com>
Thu, 30 Jun 2016 11:46:28 +0000 (13:46 +0200)
commit edab9dac1a67551ef70b74c54776994e2b2d1a6f
tree 9b1d1f87fc0c67ccc3fc1b71ab4ce3a03aa6d453
parent 01598bd5bb45e9323ff395fbf402c855e3a06a3b
Add default characters if they are not present in font

libbirdfont/Font.vala
--- a/libbirdfont/Font.vala +++ b/libbirdfont/Font.vala @@ -188,8 +188,19 @@ } public void add_default_characters () { - add_glyph_collection (get_notdef_character ()); - add_glyph_collection (get_space ()); + GlyphCollection notdef, space; + + notdef = get_notdef_character (); + + if (!has_glyph (notdef.get_name ()) { + add_glyph_collection (notdef); + } + + space = get_space (); + + if (!has_glyph (space.get_name ()) { + add_glyph_collection (space); + } } public Alternate? get_alternate (string glyph_name, string tag) {