[bugreport/feature request] Linux: Zotero is scaling too big/too small at certain zoom levels

Since current Zotero is based on Firefox ESR, currently 128, it will not follow the user's desktop scaling, but only use the arbitrary display scaling factors of 1.25, 1.5 and 2.0. At any other display scaling factor, it will round up or down. If I set my display to a factor of less than 1.75, Zotero will scale down to 1.5, rendering the interface too small, If I set the factor to 1.75, Zotero will scale to 2.0, rending everything too big.

Firefox closed this bug, by introducing a small change in version 131, that brought Firefox on Linux to the same level as the other platforms:

> https://bugzilla.mozilla.org/show_bug.cgi?id=1211547

diff --git a/gfx/thebes/gfxPlatformGtk.cpp b/gfx/thebes/gfxPlatformGtk.cpp
--- a/gfx/thebes/gfxPlatformGtk.cpp
+++ b/gfx/thebes/gfxPlatformGtk.cpp
@@ -477,32 +477,13 @@
sDPI = dpi;
return dpi;
}

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() {
// Make sure there is a screen
GdkScreen* screen = gdk_screen_get_default();

I backported it to current ESR and I'm using it since 2 months with no adverse side effects. Could you also backport that patch to your copy of Firefox? This change will automatically come with the Firefox ESR 140, but that will be a few months too half a year until it lands in Zotero.
Sign In or Register to comment.