diff --git a/rtgui/cropwindow.cc b/rtgui/cropwindow.cc index 110555251..c2019ba17 100644 --- a/rtgui/cropwindow.cc +++ b/rtgui/cropwindow.cc @@ -67,8 +67,7 @@ CropWindow::CropWindow (ImageArea* parent, bool isLowUpdatePriority_, bool isDet const int fontSize = 8; // pt // Converting font size to "px" based on DPI and scale #ifndef __APPLE__ - const double fontScale = RTScalable::getDPI() / RTScalable::pangoDPI - * static_cast(RTScalable::getScale()); // Refer to notes in rtscalable.h + 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 @@ -2467,8 +2466,7 @@ void CropWindow::drawDecoration (Cairo::RefPtr cr) const int fontSize = 8; // pt // Converting font size to "px" based on DPI and scale #ifndef __APPLE__ - const double fontScale = RTScalable::getDPI() / RTScalable::pangoDPI - * static_cast(RTScalable::getScale()); // Refer to notes in rtscalable.h + 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 @@ -2544,8 +2542,7 @@ void CropWindow::drawStraightenGuide (Cairo::RefPtr cr) const int fontSize = 8; // pt // Converting font size to "px" based on DPI and scale #ifndef __APPLE__ - const double fontScale = RTScalable::getDPI() / RTScalable::pangoDPI - * static_cast(RTScalable::getScale()); // Refer to notes in rtscalable.h + 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 diff --git a/rtgui/filebrowserentry.cc b/rtgui/filebrowserentry.cc index 60691d8b6..504422d8d 100644 --- a/rtgui/filebrowserentry.cc +++ b/rtgui/filebrowserentry.cc @@ -792,8 +792,7 @@ void FileBrowserEntry::drawStraightenGuide (Cairo::RefPtr cr) const int fontSize = 8; // pt // Converting font size to "px" based on DPI and scale #ifndef __APPLE__ - const double fontScale = RTScalable::getDPI() / RTScalable::pangoDPI - * static_cast(RTScalable::getScale()); // Refer to notes in rtscalable.h + 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 diff --git a/rtgui/imagearea.cc b/rtgui/imagearea.cc index d60232ff9..90deb6ba0 100644 --- a/rtgui/imagearea.cc +++ b/rtgui/imagearea.cc @@ -158,8 +158,7 @@ void ImageArea::setInfoText (Glib::ustring text) const int fontSize = 10; // pt // Converting font size to "px" based on DPI and scale #ifndef __APPLE__ - const double fontScale = RTScalable::getDPI() / RTScalable::pangoDPI - * static_cast(RTScalable::getScale()); // Refer to notes in rtscalable.h + 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 diff --git a/rtgui/lockablecolorpicker.cc b/rtgui/lockablecolorpicker.cc index 22760c6a2..bd3be37d1 100644 --- a/rtgui/lockablecolorpicker.cc +++ b/rtgui/lockablecolorpicker.cc @@ -51,8 +51,7 @@ void LockableColorPicker::updateBackBuffer () 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(RTScalable::getScale()); // Refer to notes in rtscalable.h + 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 diff --git a/rtgui/preferences.cc b/rtgui/preferences.cc index c1a85d0d7..805e64e28 100644 --- a/rtgui/preferences.cc +++ b/rtgui/preferences.cc @@ -2494,9 +2494,9 @@ void Preferences::switchFontTo(const Glib::ustring &newFontFamily, const int new try { //GTK318 //#if GTK_MAJOR_VERSION == 3 && GTK_MINOR_VERSION < 20 -// fontcss->load_from_data (Glib::ustring::compose ("* { font-family: %1; font-size: %2px }", newFontFamily, newFontSize * RTScalable::getScale())); +// fontcss->load_from_data (Glib::ustring::compose ("* { font-family: %1; font-size: %2px }", newFontFamily, newFontSize)); //#else - fontcss->load_from_data (Glib::ustring::compose ("* { font-family: %1; font-size: %2pt }", newFontFamily, newFontSize * RTScalable::getScale())); + fontcss->load_from_data (Glib::ustring::compose ("* { font-family: %1; font-size: %2pt }", newFontFamily, newFontSize)); //#endif //GTK318 } catch (Glib::Error &err) { diff --git a/rtgui/rtscalable.cc b/rtgui/rtscalable.cc index 586d38dfa..0e90d34ad 100644 --- a/rtgui/rtscalable.cc +++ b/rtgui/rtscalable.cc @@ -267,8 +267,7 @@ int RTScalable::getScale () double RTScalable::getGlobalScale() { - return (RTScalable::getDPI() / RTScalable::baseDPI * - static_cast(RTScalable::getScale())); + return (RTScalable::getDPI() / RTScalable::baseDPI); } int RTScalable::scalePixelSize(const int pixel_size) diff --git a/rtgui/rtscalable.h b/rtgui/rtscalable.h index e96fdddfc..673ea5685 100644 --- a/rtgui/rtscalable.h +++ b/rtgui/rtscalable.h @@ -33,7 +33,7 @@ * - Absolute size (i.e. "px") * - Non-absolute size (i.e. "pt"): The default resolution is 72 DPI (i.e. pt per inch). To * convert the size to "px", use the following formula: - * "size in px" = "size in pt" * ("device resolution" / 72) * "device scale" + * "size in px" = "size in pt" * ("device resolution" / 72) * * Hi-DPI implementation according to the OS (source: GDK code): * - Windows: A default DPI of 96 is considered. Current DPI parameter is provided by the OS. @@ -41,7 +41,8 @@ * forced to 96. * - MacOS: Scale is calculated from OS parameters (= "Retina screen width" / "Virtual width"). * DPI is forced to 72. - * - Linux: DPI is calculated from OS parameter (= 96 * "text-scaling-factor"). + * - Linux: DPI is calculated from OS parameter (= 96 * "text-scaling-factor"). Note: "text-scaling-factor" + * is different from "device factor". */ class RTScalable { diff --git a/rtgui/rtwindow.cc b/rtgui/rtwindow.cc index 1281c5c83..fcef8101e 100755 --- a/rtgui/rtwindow.cc +++ b/rtgui/rtwindow.cc @@ -170,8 +170,7 @@ RTWindow::RTWindow () Glib::ustring css; #ifndef __APPLE__ - const double fontScale = RTScalable::getDPI() / RTScalable::pangoDPI - * static_cast(RTScalable::getScale()); // Refer to notes in rtscalable.h + 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 @@ -206,8 +205,7 @@ RTWindow::RTWindow () #ifndef __APPLE__ // Guessing that pixel size is given for a 96 DPI reference: - const double newFontScale = RTScalable::getDPI() / RTScalable::baseDPI - * static_cast(RTScalable::getScale()); // Refer to notes in rtscalable.h + const double newFontScale = RTScalable::getDPI() / RTScalable::baseDPI; // 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 diff --git a/rtgui/shcselector.cc b/rtgui/shcselector.cc index 132a5f1ef..021c09914 100644 --- a/rtgui/shcselector.cc +++ b/rtgui/shcselector.cc @@ -199,8 +199,7 @@ void SHCSelector::updateBackBuffer() const double fontSize = static_cast(h) * 0.8; // pt // Converting font size to "px" based on DPI and scale #ifndef __APPLE__ - const double fontScale = RTScalable::getDPI() / RTScalable::pangoDPI - * static_cast(RTScalable::getScale()); // Refer to notes in rtscalable.h + 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 diff --git a/rtgui/splash.cc b/rtgui/splash.cc index 5019e6834..ea3cb59e7 100644 --- a/rtgui/splash.cc +++ b/rtgui/splash.cc @@ -46,8 +46,7 @@ bool SplashImage::on_draw(const ::Cairo::RefPtr< Cairo::Context> &cr) const int fontSize = 12; // pt // Converting font size to "px" based on DPI and scale #ifndef __APPLE__ - const double fontScale = RTScalable::getDPI() / RTScalable::pangoDPI - * static_cast(RTScalable::getScale()); // Refer to notes in rtscalable.h + 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