client: Fix invalid conversion from points to pixels

CSS and WebKit expects font size in pixels, but not "actual device pixels".

This fixes incorrect font size when using font-scaling with WebKitGTK >= 2.48.
Under older WebKitGTK versions result will be the same.

Refs https://github.com/WebKit/WebKit/pull/40412#issuecomment-2690897270
This commit is contained in:
Serhii Tereshchenko 2024-11-15 20:55:01 +02:00 committed by Niels De Graef
parent 1f5cfb73e0
commit 851f188a06

View file

@ -192,13 +192,11 @@ public abstract class Components.WebView : WebKit.WebView, Geary.BaseInterface {
}
private static inline uint to_wk2_font_size(Pango.FontDescription font) {
Gdk.Screen? screen = Gdk.Screen.get_default();
double dpi = screen != null ? screen.get_resolution() : 96.0;
double size = font.get_size();
if (!font.get_size_is_absolute()) {
size = size / Pango.SCALE;
}
return (uint) (size * dpi / 72.0);
return (uint) WebKit.Settings.font_size_to_pixels((uint) size);
}
private static inline double get_text_scale () {