summaryrefslogtreecommitdiff
path: root/gtk2_ardour/ardour_button.cc
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2014-09-09 02:26:58 +0200
committerRobin Gareus <robin@gareus.org>2014-09-09 02:26:58 +0200
commit3132a184f22b6ab007e0345c29f53b38e77e1a37 (patch)
treee5b3edb3cd5992e9cdd4c1de83fb2bd4845371f4 /gtk2_ardour/ardour_button.cc
parentca5eea2056216bf88d2d3658ce6a769fd3f16cfc (diff)
have another go at vertical text alignment
Diffstat (limited to 'gtk2_ardour/ardour_button.cc')
-rw-r--r--gtk2_ardour/ardour_button.cc8
1 files changed, 3 insertions, 5 deletions
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;