From 851f188a0619401441d5df606b8cf879caf030b8 Mon Sep 17 00:00:00 2001 From: Serhii Tereshchenko Date: Fri, 15 Nov 2024 20:55:01 +0200 Subject: [PATCH] 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 --- src/client/components/components-web-view.vala | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/client/components/components-web-view.vala b/src/client/components/components-web-view.vala index 62a35006..8d7dab92 100644 --- a/src/client/components/components-web-view.vala +++ b/src/client/components/components-web-view.vala @@ -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 () {