Updates font management for hidpi
Improvements: - Cleanup of default options files to use OS font by default - Comments updates - Simplify font size management as Pango/Gtk directly manage pt/px conversions Bug fix: - If Preference panel is closed by "cancel", font size was not reinitialized to previously saved one - Font size was specified in "RawTherapee.css" theme and so user choice could be ignored
This commit is contained in:
@@ -784,21 +784,12 @@ void FileBrowserEntry::drawStraightenGuide (Cairo::RefPtr<Cairo::Context> cr)
|
||||
}
|
||||
|
||||
Glib::RefPtr<Pango::Context> context = parent->getDrawingArea()->get_pango_context () ;
|
||||
Pango::FontDescription fontd = context->get_font_description ();
|
||||
Pango::FontDescription fontd = parent->getDrawingArea()->get_style_context()->get_font();
|
||||
fontd.set_weight (Pango::WEIGHT_BOLD);
|
||||
const int fontSize = 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
|
||||
// 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));
|
||||
// Non-absolute size is defined in "Pango units" and shall be multiplied by
|
||||
// Pango::SCALE from "pt":
|
||||
fontd.set_size (fontSize * Pango::SCALE);
|
||||
context->set_font_description (fontd);
|
||||
Glib::RefPtr<Pango::Layout> deglayout = parent->getDrawingArea()->create_pango_layout(Glib::ustring::compose ("%1 deg", Glib::ustring::format(std::setprecision(2), rot_deg)));
|
||||
|
||||
|
Reference in New Issue
Block a user