Commit 7ac9f3a
Center label in background selection
Changed files (2)
Diff
@@ -35,7 +35,7 @@ public class BackgroundSelectionTool : CutBackgroundTool { double x, y, w, h; BackgroundImage bg; Text label = new Text ();- double tx, ty, font_height;+ double tx, ty, font_height, glyph_height; if (glyph.get_background_image () == null) { warning ("No image");@@ -72,9 +72,7 @@ public class BackgroundSelectionTool : CutBackgroundTool { label.set_text ((!) bs.assigned_glyph); label.set_font_size (font_height); tx = x + w - label.get_width () / 2.0;- ty = y + h;- ty += label.get_height () / 2.0;- ty -= label.get_decender (font_height);+ ty = y + h + label.get_acender () / 2.0 - label.get_decender (); label.set_font_size (font_height); label.draw_at_baseline (cr, tx, ty); }@@ -218,7 +218,7 @@ public class Text : Widget { return font_size; } - public double get_glyph_height () {+ public double get_acender () { double ratio = get_scale (); double max_height = 0; @@ -232,7 +232,7 @@ public class Text : Widget { } }); - return max_height * ratio;+ return max_height * ratio - font.base_line * ratio; } public override double get_width () {@@ -262,7 +262,7 @@ public class Text : Widget { return x; } - public double get_decender (double font_size_in_pixels) {+ public double get_decender () { double ratio = get_scale (); double min_y = 0; double decender;@@ -277,7 +277,7 @@ public class Text : Widget { } }); - decender = font.base_line - (min_y * ratio);+ decender = font.base_line * ratio - min_y * ratio; return decender > 0 ? decender : 0; }