Fixing last review comments

This commit is contained in:
Pandagrapher
2023-10-13 19:10:21 +02:00
parent 488a157476
commit 0495b9b151
4 changed files with 678 additions and 15 deletions

View File

@@ -183,20 +183,10 @@ void SHCSelector::updateDrawingArea (const ::Cairo::RefPtr< Cairo::Context> &cr)
// Update font
fontd.set_weight (Pango::WEIGHT_NORMAL);
const double fontSize = static_cast<double>(h) * 0.8; // pt
// Converting font size to "px" based on DPI and scale
#ifndef __APPLE__
const double fontScale = RTScalable::getDPI() / RTScalable::pangoDPI; // Refer to notes in rtscalable.h
#else
// On MacOS, font is already scaled by the System library
// Refer to https://gitlab.gnome.org/GNOME/gtk/-/blob/gtk-3-24/gdk/quartz/gdkscreen-quartz.c
const double fontScale = 1.;
#endif
const double absoluteFontSize = static_cast<double>(fontSize) * fontScale; // px
const double fontSize = static_cast<double>(h) * 0.8; // px
// Absolute size is defined in "Pango units" and shall be multiplied by
// Pango::SCALE from "px":
fontd.set_absolute_size (absoluteFontSize * static_cast<double>(Pango::SCALE));
fontd.set_absolute_size (fontSize * static_cast<double>(Pango::SCALE));
context->set_font_description (fontd);
Glib::RefPtr<Pango::Layout> layout = create_pango_layout(Glib::ustring::format(std::setprecision(2), positions[i]));