From ae348b719e8f1c29c3ee6ed5d723326b3bc54883 Mon Sep 17 00:00:00 2001 From: YAMAMOTO Mitsuharu Date: Thu, 11 Aug 2022 18:16:24 +0900 Subject: [PATCH] Fix wrong metrics for bitmap-only fonts with HarfBuzz 5 * src/ftcrfont.c (ftcrhbfont_begin_hb_font): Always use the standard position unit value on HarfBuzz 5 and later regardless of whether the font is bitmap-only or not. (Bug#57066) --- src/ftcrfont.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/ftcrfont.c b/src/ftcrfont.c index 39ea068556b..d5d3e440af6 100644 --- a/src/ftcrfont.c +++ b/src/ftcrfont.c @@ -568,7 +568,11 @@ ftcrhbfont_begin_hb_font (struct font *font, double *position_unit) ftcrfont_info->ft_size = ft_face->size; hb_font_t *hb_font = fthbfont_begin_hb_font (font, position_unit); - if (ftcrfont_info->bitmap_position_unit) + /* HarfBuzz 5 correctly scales bitmap-only fonts without position + unit adjustment. + (https://github.com/harfbuzz/harfbuzz/issues/489) */ + if (!hb_version_atleast (5, 0, 0) + && ftcrfont_info->bitmap_position_unit) *position_unit = ftcrfont_info->bitmap_position_unit; return hb_font; -- 2.39.2