summaryrefslogtreecommitdiff
path: root/pango/pangocairo-font.c
diff options
context:
space:
mode:
authorSebastian Keller <skeller@gnome.org>2021-11-22 01:41:33 +0100
committerSebastian Keller <skeller@gnome.org>2021-11-22 02:19:59 +0100
commit1c7c84a263af1e0688e2fedb3a98e2f10b55f0eb (patch)
treec10e7127330e991f80b7f22f3e10d4f743ac18d3 /pango/pangocairo-font.c
parenta31741faf6e59737c561574c3a7679ea185f4154 (diff)
downloadpango-1c7c84a263af1e0688e2fedb3a98e2f10b55f0eb.tar.gz
Introduce and use FLOOR and CEIL macros in Pango units
This replaces the code that was trying to implement those via the ROUND macro. This avoids a potential issue with values that already were on whole units being rounded up to the next whole unit in the code that was implementing CEIL this way.
Diffstat (limited to 'pango/pangocairo-font.c')
-rw-r--r--pango/pangocairo-font.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/pango/pangocairo-font.c b/pango/pangocairo-font.c
index 597a320d..fb36d294 100644
--- a/pango/pangocairo-font.c
+++ b/pango/pangocairo-font.c
@@ -817,13 +817,13 @@ _pango_cairo_font_private_glyph_extents_cache_init (PangoCairoFontPrivate *cf_pr
if (cf_priv->is_hinted)
{
if (cf_priv->font_extents.y < 0)
- cf_priv->font_extents.y = PANGO_UNITS_ROUND (cf_priv->font_extents.y - PANGO_SCALE/2);
+ cf_priv->font_extents.y = PANGO_UNITS_FLOOR (cf_priv->font_extents.y);
else
- cf_priv->font_extents.y = PANGO_UNITS_ROUND (cf_priv->font_extents.y + PANGO_SCALE/2);
+ 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_ROUND (cf_priv->font_extents.height - PANGO_SCALE/2);
+ cf_priv->font_extents.height = PANGO_UNITS_FLOOR (cf_priv->font_extents.height);
else
- cf_priv->font_extents.height = PANGO_UNITS_ROUND (cf_priv->font_extents.height + PANGO_SCALE/2);
+ cf_priv->font_extents.height = PANGO_UNITS_CEIL (cf_priv->font_extents.height);
}
if (PANGO_GRAVITY_IS_IMPROPER (cf_priv->gravity))