Commit 0ae563f
Use empty character as .notdef and fix text alignment in spin button
Changed files (2)
Diff
@@ -178,7 +178,7 @@ public class Text : Widget { g = cached_font.get_glyph_by_name (glyph_names.get (i)); } - glyph = (g == null) ? cached_font.get_not_def_character ().get_current () : (!) g;+ glyph = (g == null) ? new Glyph ("") : (!) g; iter (glyph, kern, i + 1 == word_with_ligatures.glyph.size); prev = g; wi++;@@ -301,9 +301,6 @@ public class Text : Widget { public override void draw (Context cr) { double descender = cached_font.bottom_limit + cached_font.base_line; double y = widget_y + get_height () + get_scale () * descender;- - cached_font.get_glyph_by_name ((!) text.get_char (0).to_string ());- draw_at_baseline (cr, widget_x, y); } @@ -449,14 +449,10 @@ public class SpinButton : Tool { public override void draw (Context cr) { double scale = Toolbox.get_scale ();- - double xt = x + w / 2;- double yt = y;-- double text_x = -13 * scale;- double text_y = 7 * scale;-- Text text = new Text (get_short_display_value (), 15);+ double text_height = 14 * scale;+ Text text = new Text (get_short_display_value (), text_height);+ double text_x = x + (w - text.get_sidebearing_extent ()) / 2;+ double text_y = y + (h - text_height) / 2; if (!show_icon_tool_icon || waiting_for_icon_switch) { if (is_selected ()) {@@ -482,8 +478,8 @@ public class SpinButton : Tool { Theme.text_color (text, "Tool Foreground"); } - text.widget_x = xt + text_x;- text.widget_y = yt + text_y;+ text.widget_x = text_x;+ text.widget_y = text_y; text.draw (cr); } }