From 3132a184f22b6ab007e0345c29f53b38e77e1a37 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Tue, 9 Sep 2014 02:26:58 +0200 Subject: have another go at vertical text alignment --- gtk2_ardour/ardour_button.cc | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'gtk2_ardour/ardour_button.cc') diff --git a/gtk2_ardour/ardour_button.cc b/gtk2_ardour/ardour_button.cc index 095c0f6053..b389d57f78 100644 --- a/gtk2_ardour/ardour_button.cc +++ b/gtk2_ardour/ardour_button.cc @@ -433,7 +433,7 @@ ArdourButton::render (cairo_t* cr, cairo_rectangle_t *) */ if (_xalign < 0) xa = ceil(.5 + (ww * fabs(_xalign) + text_margin)); - cairo_move_to (cr, xa, floor(ya)); + cairo_move_to (cr, xa, ya); pango_cairo_update_layout(cr, _layout->gobj()); pango_cairo_show_layout (cr, _layout->gobj()); cairo_restore (cr); @@ -583,13 +583,11 @@ ArdourButton::on_size_request (Gtk::Requisition* req) } if ((_elements & Text) && !_text.empty()) { - int ignored; - _text_height = char_pixel_height (); // if _layout does not exist, char_pixel_height() creates it, - _layout->get_pixel_size (_text_width, ignored); + req->height = std::max(req->height, (int) ceil(char_pixel_height() * BASELINESTRETCH + 1.0)); + _layout->get_pixel_size (_text_width, _text_height); req->width += rint(1.75 * char_pixel_width()); // padding req->width += _text_width; - req->height = std::max(req->height, (int) ceil(_text_height * BASELINESTRETCH + 1.0)); } else { _text_width = 0; _text_height = 0; -- cgit v1.2.3