From 9f8157a68a7e15d9401327d2efdd41e132ac8c5e Mon Sep 17 00:00:00 2001
From: Starbuck5 <[EMAIL REDACTED]>
Date: Wed, 28 Feb 2024 23:48:04 -0800
Subject: [PATCH] Pass kerning setting through into harfbuzz shaping
(cherry picked from commit 00024d28adaeaf22ae8bd7ae402b0e86c03f6abb)
---
SDL_ttf.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/SDL_ttf.c b/SDL_ttf.c
index 07544e8d..557c1726 100644
--- a/SDL_ttf.c
+++ b/SDL_ttf.c
@@ -3231,7 +3231,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);