Bug 1211547 - Don't round font scaling for GTK. r=emilio

Differential Revision: https://phabricator.services.mozilla.com/D219821
This commit is contained in:
Matthijs Velsink 2024-08-23 22:22:08 +00:00
parent 3ab31975ef
commit c4ff19bf2f

View File

@ -479,28 +479,9 @@ int32_t gfxPlatformGtk::GetFontScaleDPI() {
}
double gfxPlatformGtk::GetFontScaleFactor() {
// Integer scale factors work well with GTK window scaling, image scaling, and
// pixel alignment, but there is a range where 1 is too small and 2 is too
// big.
//
// An additional step of 1.5 is added because this is common scale on WINNT
// and at this ratio the advantages of larger rendering outweigh the
// disadvantages from scaling and pixel mis-alignment.
//
// A similar step for 1.25 is added as well, because this is the scale that
// "Large text" settings use in gnome, and it seems worth to allow, especially
// on already-hidpi environments.
int32_t dpi = GetFontScaleDPI();
if (dpi < 120) {
return 1.0;
}
if (dpi < 132) {
return 1.25;
}
if (dpi < 168) {
return 1.5;
}
return round(dpi / 96.0);
// Modern GTK works fine with non-integer scaling, and scaling factors like
// 1.25 are common as "Large text" in gnome as well, so no need to round.
return GetFontScaleDPI() / 96.0;
}
gfxImageFormat gfxPlatformGtk::GetOffscreenFormat() {