The Birdfont Source Code


All Repositories / birdfont.git / commit – RSS feed

Fix duplicated grid buttons

These changes was commited to the Birdfont repository Thu, 13 Dec 2018 13:29:46 +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, 13 Dec 2018 13:29:46 +0000 (14:29 +0100)
committer Johan Mattsson <johan.mattsson.m@gmail.com>
Thu, 13 Dec 2018 13:29:46 +0000 (14:29 +0100)
commit 134ebe2ec304fbdc91a0df78245c1abfd834c5f8
tree cd29c9d15e02a4d68a45aec3a675d4bfe58a05dd
parent bbb358cf698ead489e6d44bcf778d150ed78861c
Fix duplicated grid buttons

libbirdfont/BirdFontFile.vala
--- a/libbirdfont/BirdFontFile.vala +++ b/libbirdfont/BirdFontFile.vala @@ -1195,12 +1195,24 @@ font.background_scale = attr.get_content (); } } + } + + private bool has_grid (string v) { + foreach (string g in font.grid_width) { + if (g == v) { + return true; + } + } + + return false; } private void parse_grid (Tag tag) { foreach (Attribute attr in tag.get_attributes ()) { - if (attr.get_name () == "width") { - font.grid_width.add (attr.get_content ()); + string v = attr.get_content (); + + if (attr.get_name () == "width" && !has_grid (v)) { + font.grid_width.add (v); } } }