Add other font size scaling
Minor fixes: - Fixes some incorrect cast - fixes some incorrect comments
This commit is contained in:
@@ -48,7 +48,20 @@ void LockableColorPicker::updateBackBuffer ()
|
||||
Pango::FontDescription fontd = pangoContext->get_font_description();
|
||||
// set font family and size
|
||||
fontd.set_family(options.CPFontFamily == "default" ? "sans" : options.CPFontFamily);
|
||||
fontd.set_size((options.CPFontFamily == "default" ? 8 : options.CPFontSize) * Pango::SCALE);
|
||||
const int fontSize = options.CPFontFamily == "default" ? 8 : options.CPFontSize; // pt
|
||||
// Converting font size to "px" based on DPI and scale
|
||||
#ifndef __APPLE__
|
||||
const double fontScale = RTScalable::getDPI() / RTScalable::pangoDPI
|
||||
* static_cast<double>(RTScalable::getScale()); // 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));
|
||||
fontd.set_weight(Pango::WEIGHT_NORMAL);
|
||||
pangoContext->set_font_description (fontd);
|
||||
|
||||
|
Reference in New Issue
Block a user