Bug 1967147 - Don't make per-theme font data dependent on font scale. r=stransky
This fixes wrong text sizes on text scale changes, like going to gnome settings -> Accessibility -> large text or so. Differential Revision: https://phabricator.services.mozilla.com/D249912
This commit is contained in:
committed by
ealvarez@mozilla.com
parent
cee51f4c6b
commit
1ca99ab9ac
@@ -1299,11 +1299,14 @@ static void GetSystemFontInfo(GtkStyleContext* aStyle, nsString* aFontName,
|
||||
|
||||
float size = float(pango_font_description_get_size(desc)) / PANGO_SCALE;
|
||||
|
||||
// |size| is now either pixels or pango-points (not Mozilla-points!)
|
||||
|
||||
if (!pango_font_description_get_size_is_absolute(desc)) {
|
||||
// |size| is now either pixels or pango-points, convert to scale-independent
|
||||
// pixels.
|
||||
if (pango_font_description_get_size_is_absolute(desc)) {
|
||||
// Undo the already-applied font scale.
|
||||
size /= gfxPlatformGtk::GetFontScaleFactor();
|
||||
} else {
|
||||
// |size| is in pango-points, so convert to pixels.
|
||||
size *= float(gfxPlatformGtk::GetFontScaleDPI()) / POINTS_PER_INCH_FLOAT;
|
||||
size *= 96 / POINTS_PER_INCH_FLOAT;
|
||||
}
|
||||
|
||||
// |size| is now pixels but not scaled for the hidpi displays,
|
||||
@@ -1348,11 +1351,12 @@ bool nsLookAndFeel::PerThemeData::GetFont(FontID aID, nsString& aFontName,
|
||||
break;
|
||||
}
|
||||
|
||||
// Convert GDK pixels to CSS pixels.
|
||||
// Convert GDK unscaled pixels to CSS pixels.
|
||||
// When "layout.css.devPixelsPerPx" > 0, this is not a direct conversion.
|
||||
// The difference produces a scaling of system fonts in proportion with
|
||||
// other scaling from the change in CSS pixel sizes.
|
||||
aFontStyle.size /= LookAndFeel::GetTextScaleFactor();
|
||||
aFontStyle.size *=
|
||||
gfxPlatformGtk::GetFontScaleFactor() / LookAndFeel::GetTextScaleFactor();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user