From 3280523e908595b57ace4473646a70f2e9a3168b Mon Sep 17 00:00:00 2001 From: Ben Loftis Date: Sat, 26 Feb 2022 08:47:40 -0600 Subject: [PATCH] trigger_ui: pixel pushing for mac --- gtk2_ardour/cuebox_ui.cc | 8 ++++++-- gtk2_ardour/trigger_master.cc | 23 ++++++++++++++++------- 2 files changed, 22 insertions(+), 9 deletions(-) diff --git a/gtk2_ardour/cuebox_ui.cc b/gtk2_ardour/cuebox_ui.cc index c5e4b1fb75..95d6f82818 100644 --- a/gtk2_ardour/cuebox_ui.cc +++ b/gtk2_ardour/cuebox_ui.cc @@ -181,11 +181,15 @@ CueEntry::render (ArdourCanvas::Rect const& area, Cairo::RefPtr //draw cue letter Glib::RefPtr layout = Pango::Layout::create (context); - layout->set_font_description (UIConfiguration::instance ().get_NormalFont ()); + int font_size = 8 * scale; + char font_name[128]; + snprintf (font_name, sizeof (font_name), "ArdourMono %d", font_size); + Pango::FontDescription pfd (font_name); + layout->set_font_description (pfd); layout->set_text (cue_marker_name (_cue_idx)); int tw, th; layout->get_pixel_size (tw, th); - context->translate (self.x0, self.y0 - 0.5); //canvas widget offset (sigh) + context->translate (self.x0 - 0.5*scale, self.y0 - 0.5*scale); context->move_to (width/2,height/2); //move to center context->rel_move_to (-tw/2, -th/2); //rel move to top-left of text context->set_source_rgb (0, 0, 0); //black diff --git a/gtk2_ardour/trigger_master.cc b/gtk2_ardour/trigger_master.cc index b0ecf37242..f8aadb00d0 100644 --- a/gtk2_ardour/trigger_master.cc +++ b/gtk2_ardour/trigger_master.cc @@ -89,7 +89,7 @@ Loopster::render (ArdourCanvas::Rect const& area, Cairo::RefPtr } context->set_identity_matrix (); - context->translate (self.x0, self.y0 - 0.5); + context->translate (self.x0, self.y0); float size = _rect.height (); @@ -189,34 +189,43 @@ TriggerMaster::render (ArdourCanvas::Rect const& area, Cairo::RefPtrdata_type () == ARDOUR::DataType::MIDI) { - layout->set_font_description (UIConfiguration::instance ().get_BigBoldMonospaceFont ()); + int font_size = 14 * scale; + char font_name[128]; + snprintf (font_name, sizeof (font_name), "ArdourSans %d", font_size); + Pango::FontDescription pfd (font_name); + layout->set_font_description (pfd); layout->set_text ("\u266b"); int tw, th; layout->get_pixel_size (tw, th); context->move_to (width / 2, height / 2); - context->rel_move_to (-tw / 2, -th / 2); + context->rel_move_to (-tw / 2, -2*scale -th / 2); Gtkmm2ext::set_source_rgba (context, UIConfiguration::instance ().color ("neutral:foreground")); layout->show_in_cairo_context (context); } + int font_size = 8 * scale; + char font_name[128]; + snprintf (font_name, sizeof (font_name), "ArdourSans %d", font_size); + Pango::FontDescription pfd (font_name); + if (play_text != "") { - layout->set_font_description (UIConfiguration::instance ().get_NormalFont ()); + layout->set_font_description (pfd); layout->set_text (play_text); int tw, th; layout->get_pixel_size (tw, th); context->move_to ( height + 4*scale, height / 2); //left side, but make room for loopster - context->rel_move_to ( 0, -th / 2); //vertically centered text + context->rel_move_to ( 0, -1*scale -th / 2); //vertically centered text Gtkmm2ext::set_source_rgba (context, UIConfiguration::instance ().color ("neutral:foreground")); layout->show_in_cairo_context (context); } if (loop_text != "") { - layout->set_font_description (UIConfiguration::instance ().get_NormalFont ()); + layout->set_font_description (pfd); layout->set_text (loop_text); int tw, th; layout->get_pixel_size (tw, th); context->move_to ( width-4*scale, height / 2); //right side - context->rel_move_to ( -tw, -th / 2); //right justified, vertically centered text + context->rel_move_to ( -tw, -1*scale -th / 2); //right justified, vertically centered text Gtkmm2ext::set_source_rgba (context, UIConfiguration::instance ().color ("neutral:foreground")); layout->show_in_cairo_context (context); }