Created attachment 2186 [details] Screenshots at manual 86/104 dpi before and after setting Pango Cairo dpi The text rendering portion of the litehtml plugin seems to not fully honor manual dpi settings (Gtk3). It appears that the word spacing estimates do scale, but not the physical glyph rendering. Setting the GDK-derived dpi for Cairo on the PangoContext seems to be a way to fix that; at least it makes HTML mail readable by not overlapping words when I'm using a manual 86 dpi setting. See attached image and sample patch below (seems to be the central Pango place - don't know if calling GDK there is conceptually acceptable. Also something else might break (?), although it seems fine). ------ From 07f6db8f3d82ead782dfc1d1d78179dd9544e88e Mon Sep 17 00:00:00 2001 From: Ramin Yaghoubzadeh Torky <r.y.t-REMOVETHIS-@web.de> Date: Tue, 16 Mar 2021 22:19:16 +0100 Subject: [PATCH] Apply GDK dpi to PangoContext to ensure appropriate font size selection --- src/plugins/litehtml_viewer/lh_widget_text.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/plugins/litehtml_viewer/lh_widget_text.cpp b/src/plugins/litehtml_viewer/lh_widget_text.cpp index ed290559f..68121c552 100644 --- a/src/plugins/litehtml_viewer/lh_widget_text.cpp +++ b/src/plugins/litehtml_viewer/lh_widget_text.cpp @@ -101,6 +101,10 @@ void lh_widget::draw_text( litehtml::uint_ptr hdc, const litehtml::tchar_t* text PangoLayout *layout = pango_cairo_create_layout(cr); PangoContext *context = pango_layout_get_context(layout); + GdkScreen* screen = gdk_screen_get_default(); + double dpi = gdk_screen_get_resolution(screen); + pango_cairo_context_set_resolution(context, dpi); + if (fnt != NULL) { /* Set font */ pango_layout_set_font_description(layout, fnt->font); -- 2.25.1
this is a duplicate of bug #4326 isn't it?
Sorry, yes, it is very likely the same root cause. I reported this for 'Claws Mail (Gtk3)' specifically, thought the other one might have been for a different GUI toolkit. The observed effects here are identical; above patch fixes things for me, but I cannot assess or test whether it'll work universally / in other configurations.
thanks for the patch. it's now in git.
*** This bug has been marked as a duplicate of bug 4326 ***