From 896416bd4c6ac486eb4e1926eaa09d5a9b693763 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Mon, 17 Jun 2019 13:39:49 -0700 Subject: [PATCH] Partially revert "[ft/ot] Remove implementation of deprecated kerning funcs" This reverts commit 47030b1855f04c0d75899ffb6f5021fea3c19b90. Reverts only the hb-ft part, to reinstate non-OpenType kerning with FreeType. Fixes https://github.com/harfbuzz/harfbuzz/issues/1682 --- src/hb-ft.cc | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/hb-ft.cc b/src/hb-ft.cc index d70c38a7a..c24a0e268 100644 --- a/src/hb-ft.cc +++ b/src/hb-ft.cc @@ -346,6 +346,23 @@ hb_ft_get_glyph_v_origin (hb_font_t *font, return true; } +static hb_position_t +hb_ft_get_glyph_h_kerning (hb_font_t *font, + void *font_data, + hb_codepoint_t left_glyph, + hb_codepoint_t right_glyph, + void *user_data HB_UNUSED) +{ + const hb_ft_font_t *ft_font = (const hb_ft_font_t *) font_data; + FT_Vector kerningv; + + FT_Kerning_Mode mode = font->x_ppem ? FT_KERNING_DEFAULT : FT_KERNING_UNFITTED; + if (FT_Get_Kerning (ft_font->ft_face, left_glyph, right_glyph, mode, &kerningv)) + return 0; + + return kerningv.x; +} + static hb_bool_t hb_ft_get_glyph_extents (hb_font_t *font, void *font_data, @@ -497,6 +514,8 @@ static struct hb_ft_font_funcs_lazy_loader_t : hb_font_funcs_lazy_loader_t