From b8ba042e49dc81768ee34ba92225b742fd19372a Mon Sep 17 00:00:00 2001 From: Starbuck5 <46412508+Starbuck5@users.noreply.github.com> Date: Wed, 28 Feb 2024 23:59:53 -0800 Subject: [PATCH] Pass kerning setting through into harfbuzz shaping --- src/SDL_ttf.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/SDL_ttf.c b/src/SDL_ttf.c index 483f9ff6..f504a7e2 100644 --- a/src/SDL_ttf.c +++ b/src/SDL_ttf.c @@ -3226,7 +3226,14 @@ static int TTF_Size_Internal(TTF_Font *font, /* Layout the text */ hb_buffer_add_utf8(hb_buffer, text, -1, 0, -1); - hb_shape(font->hb_font, hb_buffer, NULL, 0); + + hb_feature_t userfeatures[1]; + userfeatures[0].tag = HB_TAG('k','e','r','n'); + userfeatures[0].value = font->use_kerning; + userfeatures[0].start = HB_FEATURE_GLOBAL_START; + userfeatures[0].end = HB_FEATURE_GLOBAL_END; + + hb_shape(font->hb_font, hb_buffer, userfeatures, 1); /* Get the result */ hb_glyph_info = hb_buffer_get_glyph_infos(hb_buffer, &glyph_count);