Hi Albrecht,

On Nov 22, 2016, at  1:20 PM, Albrecht Dreß wrote:
Hi Peter:

Thanks a lot for your fast reply!

Am 22.11.16 16:41 schrieb(en) Peter Bloomfield:
Please try the attached patch. The issue is that the font button returns the font size in points, and we have to convert that to pixels to generate CSS, and the current code may be getting the display dpi wrong. I'm struggling with this!

Unfortunately, the patch does not fix the wrong sizes. The only difference is that Balsa now spits out messages (setting the font size to "8" in the font picker dialogue)

OK, back to the drawing-board! Here's another shot, using Jack's suggestion of keeping the specification in points when that's how it's given. Apply to clean master.

Thanks for testing!

Peter
diff --git a/libbalsa/misc.c b/libbalsa/misc.c
index d892a28..0116cf4 100644
--- a/libbalsa/misc.c
+++ b/libbalsa/misc.c
@@ -1451,13 +1451,12 @@ libbalsa_font_string_to_css(const gchar * font_string,
             g_string_append_printf(string, "font-stretch: %s;\n", stretch);
     }
     if (mask & PANGO_FONT_MASK_SIZE) {
-        gint size;
+        gdouble size;
+        const gchar *units;
 
-        size = pango_font_description_get_size(desc);
-        if (!pango_font_description_get_size_is_absolute(desc))
-            size *= gdk_screen_get_resolution(gdk_screen_get_default()) / 72;
-        size = PANGO_PIXELS(size);
-        g_string_append_printf(string, "font-size: %dpx;\n", size);
+        size = (gdouble) pango_font_description_get_size(desc) / PANGO_SCALE;
+        units = pango_font_description_get_size_is_absolute(desc) ? "px" : "pt";
+        g_string_append_printf(string, "font-size: %.1f%s;\n", size, units);
     }
     g_string_append_c(string, '}');
 

Attachment: pgpPIVdEfXGTG.pgp
Description: PGP signature

_______________________________________________
balsa-list mailing list
[email protected]
https://mail.gnome.org/mailman/listinfo/balsa-list

Reply via email to