Skip to content

Commit 057a79f

Browse files
committed
Always describe font using absolute sizes
It avoids problems with custom dpi scales set by users. Fix #2687.
1 parent 4c414fe commit 057a79f

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

weasyprint/text/ffi.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@
329329
330330
char * pango_font_description_to_string (const PangoFontDescription *desc);
331331
332-
PangoFontDescription * pango_font_describe (PangoFont *font);
332+
PangoFontDescription * pango_font_describe_with_absolute_size (PangoFont *font);
333333
const char * pango_font_description_get_family (const PangoFontDescription *desc);
334334
guint pango_font_description_hash (const PangoFontDescription *desc);
335335

weasyprint/text/fonts.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,8 @@ def get_pango_font_key(pango_font):
383383
# the same address for two different Pango maps. We should cache it in the
384384
# FontConfiguration object. See issue #2144.
385385
description = ffi.gc(
386-
pango.pango_font_describe(pango_font), pango.pango_font_description_free)
386+
pango.pango_font_describe_with_absolute_size(pango_font),
387+
pango.pango_font_description_free)
387388
font_size = pango.pango_font_description_get_size(description) * FROM_UNITS
388389
mask = pango.PANGO_FONT_MASK_SIZE + pango.PANGO_FONT_MASK_GRAVITY
389390
pango.pango_font_description_unset_fields(description, mask)

0 commit comments

Comments
 (0)