From 64d633cd26563f9fc338d48b4455517e01055053 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Sat, 1 Jul 2023 21:07:06 -0600 Subject: [PATCH] amend/fix b490f7d2a115 to correctly (?) place marker text --- gtk2_ardour/marker.cc | 13 +++++++++---- gtk2_ardour/marker.h | 1 + 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/gtk2_ardour/marker.cc b/gtk2_ardour/marker.cc index 09108ee169..3ff1a7bb7d 100644 --- a/gtk2_ardour/marker.cc +++ b/gtk2_ardour/marker.cc @@ -357,13 +357,19 @@ ArdourMarker::ArdourMarker (PublicEditor& ed, ArdourCanvas::Item& parent, std::s int width; layout->set_font_description (name_font); - Gtkmm2ext::get_ink_pixel_size (layout, width, name_height); + Gtkmm2ext::get_ink_pixel_size_with_descent (layout, width, name_height, name_descent); + + /* compute descent below baseline, since pango returns the overall + height from descender to top ... what were they thinking? + */ + name_descent -= name_height; _name_item = new ArdourCanvas::Text (group); CANVAS_DEBUG_NAME (_name_item, string_compose ("ArdourMarker::_name_item for %1", annotation)); _name_item->set_font_description (name_font); _name_item->set_color (RGBA_TO_UINT (0,0,0,255)); - _name_item->set_position (ArdourCanvas::Duple (_label_offset, (marker_height - 4)*0.5 - (name_height) * .5 )); + + _name_item->set_position (ArdourCanvas::Duple (_label_offset, -name_descent)); apply_color (); @@ -611,8 +617,7 @@ ArdourMarker::setup_name_display () if (_name_flag) { _name_flag->set_y0 (0); - _name_flag->set_y1 (marker_height - 2.); - _name_item->set_position (ArdourCanvas::Duple (2., (name_height - marker_height - 2.))); + _name_flag->set_y1 (marker_height - padding); } } diff --git a/gtk2_ardour/marker.h b/gtk2_ardour/marker.h index 882e61fdf1..703c82cd80 100644 --- a/gtk2_ardour/marker.h +++ b/gtk2_ardour/marker.h @@ -145,6 +145,7 @@ protected: double _shift; Type _type; int name_height; + int name_descent; bool _selected; bool _entered; bool _shown;