From bbaccf23d9e231370fb3ca3398ebfc132c7555bc Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Mon, 1 Nov 2021 16:45:36 -0600 Subject: [PATCH] Better round positions during scaling Fixes https://github.com/harfbuzz/harfbuzz/issues/3274 --- src/hb-font.hh | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/hb-font.hh b/src/hb-font.hh index dd5cd13db..1b7f445e8 100644 --- a/src/hb-font.hh +++ b/src/hb-font.hh @@ -620,9 +620,7 @@ struct hb_font_t } hb_position_t em_mult (int16_t v, int64_t mult) - { - return (hb_position_t) ((v * mult) >> 16); - } + { return (hb_position_t) ((v * mult + 32768) >> 16); } hb_position_t em_scalef (float v, int scale) { return (hb_position_t) roundf (v * scale / face->get_upem ()); } float em_fscale (int16_t v, int scale)