The Birdfont Source Code


All Repositories / birdfont.git / commitdiff – RSS feed

Fix spacing class bug

These changes was commited to the Birdfont repository Thu, 25 Jun 2015 12:25:40 +0000.

Contributing

Send patches or pull requests to johan.mattsson.m@gmail.com.
Clone this repository: git clone https://github.com/johanmattssonm/birdfont.git
[Thu, 25 Jun 2015 12:25:40 +0000]

Updated Files

libbirdfont/Glyph.vala
libbirdfont/GlyphCollection.vala
libbirdfont/VersionList.vala
--- a/libbirdfont/Glyph.vala +++ b/libbirdfont/Glyph.vala @@ -67,8 +67,22 @@ public unichar unichar_code = 0; // FIXME: name and unichar should be moved to to glyph collection public string name; - public double left_limit; + public double left_limit { + get { + return _left_limit; + } + + set { + if (value == 0) { + warning (@"zero left_limit in $(get_name ())"); + } + + _left_limit = value; + } + } public double right_limit; + + private double _left_limit = 0; // x-height, lsb, etc. public Gee.ArrayList<Line> vertical_help_lines = new Gee.ArrayList<Line> (); @@ -508,17 +522,16 @@ left_line.set_metrics (get_left_side_bearing ()); }); - left_line.position_updated (left_limit); - + left_line.set_metrics (get_left_side_bearing ()); + right_line = new Line ("right", right_limit, true); right_line.rsb = true; right_line.position_updated.connect ((pos) => { right_limit = pos; update_other_spacing_classes (); - right_line.set_metrics (get_right_side_bearing ()); }); - right_line.position_updated (right_limit); + right_line.set_metrics (get_right_side_bearing ()); // lists of lines are sorted and lines are added only if // they are relevant for a particular glyph. @@ -2238,8 +2251,14 @@ if (g != null) { gc = (!) g; glyph = gc.get_current (); + + if (glyph.left_limit == glyph.right_limit) { + warning ("Zero width glyph in kerning class."); + } + left_limit = glyph.left_limit; right_limit = glyph.right_limit; + break; } } @@ -2267,7 +2286,6 @@ glyph = gc.get_current (); glyph.left_limit = left_limit; glyph.right_limit = right_limit; - // FIXME: DELETE glyph.add_help_lines (); } } } @@ -2278,7 +2296,6 @@ } public bool has_cache (string key) { - // FIXME: DELETE print (@"glyph_cache.keys.size $(glyph_cache.keys.size)\n"); return glyph_cache.has_key (key); }
--- a/libbirdfont/GlyphCollection.vala +++ b/libbirdfont/GlyphCollection.vala @@ -77,9 +77,11 @@ } public Glyph get_current () { - if (0 <= selected < glyphs.size) { + if (likely (0 <= selected < glyphs.size)) { return glyphs.get (selected); } + + warning (@"No glyph selected for $(name): $selected glyphs.size: $(glyphs.size)"); return new Glyph ("", '\0'); }
--- a/libbirdfont/VersionList.vala +++ b/libbirdfont/VersionList.vala @@ -73,7 +73,9 @@ add_glyph (g, false); } - set_selected_version (gc.get_current ().version_id, false); + if (gc.length () > 0) { + set_selected_version (gc.get_current ().version_id, false); + } } private void delete_item (int index) {