[Users] [Bug 4461] New: Gtk3 litehtml dpi glyph scaling
noreply at thewildbeast.co.uk
noreply at thewildbeast.co.uk
Tue Mar 16 23:16:03 CET 2021
https://www.thewildbeast.co.uk/claws-mail/bugzilla/show_bug.cgi?id=4461
Bug ID: 4461
Summary: Gtk3 litehtml dpi glyph scaling
Product: Claws Mail (GTK3)
Version: GIT
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P3
Component: Plugins/LiteHTML Viewer
Assignee: users at lists.claws-mail.org
Reporter: r.y.t at web.de
Created attachment 2186
-->
https://www.thewildbeast.co.uk/claws-mail/bugzilla/attachment.cgi?id=2186&action=edit
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- at 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
--
You are receiving this mail because:
You are the assignee for the bug.
More information about the Users
mailing list