[pango: 2/4] Calculate hinted font height based on the hinted extents
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pango: 2/4] Calculate hinted font height based on the hinted extents
- Date: Fri, 26 Nov 2021 14:34:22 +0000 (UTC)
commit 303f79e14047d60c3ca41c24931c8cb6115433ae
Author: Sebastian Keller <skeller gnome org>
Date: Mon Nov 22 01:54:15 2021 +0100
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
pango/pangocairo-font.c | 4 ++--
1 file 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))
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]