commit b51c2770abcc9d5e3fcd5989ac6a5baa613ebd7d
parent 4f076ff63ec3f06253dc323e2a75062be429fbf0
Author: Pier Angelo Vendrame <pierov@torproject.org>
Date: Mon, 8 Dec 2025 19:29:50 +0100
fixup! BB 43140: Tighten up fonts on Linux.
BB 44410: Use UI system font size.
After tor-browser#44286, the browser UI font size is too small in some
system.
So, hardcode only a few properties, but still query the system for the
font size.
Diffstat:
1 file changed, 11 insertions(+), 8 deletions(-)
diff --git a/widget/gtk/nsLookAndFeel.cpp b/widget/gtk/nsLookAndFeel.cpp
@@ -1268,13 +1268,6 @@ static void GetSystemFontInfo(GtkStyleContext* aStyle, nsString* aFontName,
gfxFontStyle* aFontStyle) {
aFontStyle->style = FontSlantStyle::NORMAL;
-#ifdef BASE_BROWSER_VERSION
- *aFontName = u"\"Arimo\"";
- aFontStyle->systemFont = true;
- aFontStyle->weight = FontWeight::NORMAL;
- aFontStyle->stretch = FontStretch::NORMAL;
- aFontStyle->size = 14;
-#else
// As in
// https://git.gnome.org/browse/gtk+/tree/gtk/gtkwidget.c?h=3.22.19#n10333
PangoFontDescription* desc;
@@ -1283,6 +1276,16 @@ static void GetSystemFontInfo(GtkStyleContext* aStyle, nsString* aFontName,
aFontStyle->systemFont = true;
+#ifdef BASE_BROWSER_VERSION
+ // tor-browser#44410: Set a few properties (especially the font name), but not
+ // the size, as strange scale methods might be in use in the system.
+ // We normalize the font size with RFP anyway, so this should not enable
+ // fingerprinting.
+ *aFontName = u"\"Arimo\"";
+ aFontStyle->systemFont = true;
+ aFontStyle->weight = FontWeight::NORMAL;
+ aFontStyle->stretch = FontStretch::NORMAL;
+#else
constexpr auto quote = u"\""_ns;
NS_ConvertUTF8toUTF16 family(pango_font_description_get_family(desc));
*aFontName = quote + family + quote;
@@ -1292,6 +1295,7 @@ static void GetSystemFontInfo(GtkStyleContext* aStyle, nsString* aFontName,
// FIXME: Set aFontStyle->stretch correctly!
aFontStyle->stretch = FontStretch::NORMAL;
+#endif
float size = float(pango_font_description_get_size(desc)) / PANGO_SCALE;
@@ -1309,7 +1313,6 @@ static void GetSystemFontInfo(GtkStyleContext* aStyle, nsString* aFontName,
aFontStyle->size = size;
pango_font_description_free(desc);
-#endif
}
bool nsLookAndFeel::NativeGetFont(FontID aID, nsString& aFontName,