The Birdfont Source Code


All Repositories / birdfont.git / commit – RSS feed

Round of small values to zero in spacing tab

These changes was commited to the Birdfont repository Wed, 25 Mar 2015 22:24:02 +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>
Wed, 25 Mar 2015 22:24:02 +0000 (23:24 +0100)
committer Johan Mattsson <johan.mattsson.m@gmail.com>
Wed, 25 Mar 2015 22:24:02 +0000 (23:24 +0100)
commit 4ab201ae578fbbdbf62f1bce247e7ad60c500d14
tree c50c75034c20f9c6cb4d3274a5cf74377b618db1
parent fd63e9b4179887adf9d6061ccb8677bb0ac853d8
Round of small values to zero in spacing tab

libbirdfont/Glyph.vala
libbirdfont/KerningTools.vala
libbirdfont/SpacingTab.vala
--- a/libbirdfont/Glyph.vala +++ b/libbirdfont/Glyph.vala @@ -493,6 +493,9 @@ double x1, y1, x2, y2; if (boundaries (out x1, out y1, out x2, out y2)) { + if (get_name () == "g") { + print (@"G: $right_limit - $x2 left_limit - x2\n"); + } return right_limit - x2; } else { return right_limit - left_limit;
--- a/libbirdfont/KerningTools.vala +++ b/libbirdfont/KerningTools.vala @@ -257,9 +257,10 @@ public override Gee.ArrayList<string> get_displays () { Gee.ArrayList<string> d = new Gee.ArrayList<string> (); d.add ("Kerning"); + d.add ("Spacing"); return d; } } }
--- a/libbirdfont/SpacingTab.vala +++ b/libbirdfont/SpacingTab.vala @@ -119,6 +119,11 @@ cap.draw_at_baseline (cr, cap.widget_x, cap.widget_y); l = g.get_left_side_bearing (); + + if (Math.fabs (l) < 0.001) { + l = 0; + } + left = new Text (truncate (l, 5), 17); Theme.text_color (left, "Foreground 3"); left.widget_x = middle - box_size / 2.0 + (box_size / 2.0 - left.get_extent ()) / 2.0; @@ -126,6 +131,11 @@ left.draw_at_baseline (cr, left.widget_x, left.widget_y); r = g.get_right_side_bearing (); + + if (Math.fabs (r) < 0.001) { + r = 0; + } + right = new Text (truncate (r, 5), 17); Theme.text_color (right, "Foreground 3"); right.widget_x = end - (box_size / 2.0 - right.get_extent ()) / 2.0 - right.get_extent (); @@ -200,13 +210,20 @@ void update_lsb (Glyph? g) { TextListener listener; string submitted_value = ""; - + double l; + if (g == null) { return; } + l = text_input_glyph.get_left_side_bearing (); + + if (Math.fabs (r) < 0.001) { + l = 0; + } + text_input_glyph = (!) g; - listener = new TextListener (t_("Left"), @"$(text_input_glyph.get_left_side_bearing ())", t_("Set")); + listener = new TextListener (t_("Left"), @"$(l)", t_("Set")); listener.signal_text_input.connect ((text) => { submitted_value = text; @@ -237,13 +254,20 @@ void update_rsb (Glyph? g) { TextListener listener; string submitted_value = ""; - + double r; + if (g == null) { return; } + r = text_input_glyph.get_right_side_bearing (); + + if (Math.fabs (r) < 0.001) { + r = 0; + } + text_input_glyph = (!) g; - listener = new TextListener (t_("Right"), @"$(text_input_glyph.get_right_side_bearing ())", t_("Set")); + listener = new TextListener (t_("Right"), @"$(r)", t_("Set")); listener.signal_text_input.connect ((text) => { submitted_value = text;