]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix wrong metrics for bitmap-only fonts with HarfBuzz 5
authorYAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
Thu, 11 Aug 2022 09:16:24 +0000 (18:16 +0900)
committerYAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
Thu, 11 Aug 2022 09:16:24 +0000 (18:16 +0900)
* 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

index 39ea068556beee3f0929d8818ff2514cf563958c..d5d3e440af6dc195c5bcd1273c5d8b1e4ce63a15 100644 (file)
@@ -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;