summaryrefslogtreecommitdiff
path: root/pango/pangocairo-font.c
diff options
context:
space:
mode:
authorSebastian Keller <skeller@gnome.org>2021-11-22 01:54:15 +0100
committerSebastian Keller <skeller@gnome.org>2021-11-22 02:22:04 +0100
commit303f79e14047d60c3ca41c24931c8cb6115433ae (patch)
treecc75371be732ba253836f659e5c542cff1d58d48 /pango/pangocairo-font.c
parent1c7c84a263af1e0688e2fedb3a98e2f10b55f0eb (diff)
downloadpango-303f79e14047d60c3ca41c24931c8cb6115433ae.tar.gz
Calculate hinted font height based on the hinted extents
The previous code was calculating the rounded up version of the difference between the unhinted ascender and uninted descender. This however would only result in the correct height if both unhinted extentss together only differ by less then an a Pango unit from their hinted counterparts. Otherwise the resulting height would be 1 unit too short. Fix this by using the difference between the hinted extents as height. Fixes: https://gitlab.gnome.org/GNOME/pango/-/issues/626
Diffstat (limited to 'pango/pangocairo-font.c')
-rw-r--r--pango/pangocairo-font.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/pango/pangocairo-font.c b/pango/pangocairo-font.c
index fb36d294..c2bcc51b 100644
--- a/pango/pangocairo-font.c
+++ b/pango/pangocairo-font.c
@@ -821,9 +821,9 @@ _pango_cairo_font_private_glyph_extents_cache_init (PangoCairoFontPrivate *cf_pr
else
cf_priv->font_extents.y = PANGO_UNITS_CEIL (cf_priv->font_extents.y);
if (cf_priv->font_extents.height < 0)
- cf_priv->font_extents.height = PANGO_UNITS_FLOOR (cf_priv->font_extents.height);
+ cf_priv->font_extents.height = PANGO_UNITS_FLOOR (extents.ascender) - PANGO_UNITS_CEIL (extents.descender);
else
- cf_priv->font_extents.height = PANGO_UNITS_CEIL (cf_priv->font_extents.height);
+ cf_priv->font_extents.height = PANGO_UNITS_CEIL (extents.ascender) - PANGO_UNITS_FLOOR (extents.descender);
}
if (PANGO_GRAVITY_IS_IMPROPER (cf_priv->gravity))