[pango/fix-font-roundtrip: 2/3] Fix pango_font_describe for Emoji fonts
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pango/fix-font-roundtrip: 2/3] Fix pango_font_describe for Emoji fonts
- Date: Sun, 24 Jan 2021 16:24:38 +0000 (UTC)
commit bc5ad5e8d536ed4e8c9f98a1e60f3ba3fe2458aa
Author: Matthias Clasen <mclasen redhat com>
Date: Sun Jan 24 11:15:01 2021 -0500
Fix pango_font_describe for Emoji fonts
We are using the size from the FcPattern. For scalable
bitmap fonts, this has been scaled to match the requested
pixel size. To make a font description that can be turned
back into a FcPattern and roundtrip successfully, we need
to undo that scaling. Thankfully, fontconfig leaves the
pixelsizefixupfactor in the pattern, so it is easy to do.
Fixes: #530
pango/pangofc-fontmap.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
---
diff --git a/pango/pangofc-fontmap.c b/pango/pangofc-fontmap.c
index 764336ae..170b3e5c 100644
--- a/pango/pangofc-fontmap.c
+++ b/pango/pangofc-fontmap.c
@@ -2519,7 +2519,14 @@ pango_fc_font_description_from_pattern (FcPattern *pattern, gboolean include_siz
pango_font_description_set_variant (desc, PANGO_VARIANT_NORMAL);
if (include_size && FcPatternGetDouble (pattern, FC_SIZE, 0, &size) == FcResultMatch)
- pango_font_description_set_size (desc, size * PANGO_SCALE);
+ {
+ double pixelsizefixupfactor;
+
+ if (FcPatternGetDouble (pattern, "pixelsizefixupfactor", 0, &pixelsizefixupfactor) != FcResultMatch)
+ pixelsizefixupfactor = 1;
+
+ pango_font_description_set_size (desc, pixelsizefixupfactor * size * PANGO_SCALE);
+ }
/* gravity is a bit different. we don't want to set it if it was not set on
* the pattern */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]