SDL_ttf: Let HarfBuzz decide which script, direction and language to use in case not set

From 7b3d8391095dbe672ab9314235fcb61b0022aaec Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tom=C3=A1s=20Silva?= <[EMAIL REDACTED]>
Date: Fri, 5 Jul 2024 16:30:35 +0100
Subject: [PATCH] Let HarfBuzz decide which script, direction and language to
 use in case not set

Text has rules and settings needed for its rendering depending on its characters. Scripts, text direction and language are settings that should be changed depending on the characters and their context. These change the visual effect on the rendered text.

At the moment SDL_TTF provides us the possibility to set any of these three settings but always defaults to an invalid setting on each. With hb_buffer_guess_segment_properties() these could be deducted if not set and it should be the default for rendering text correctly.
---
 src/SDL_ttf.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/SDL_ttf.c b/src/SDL_ttf.c
index d8119a31..d2c6026d 100644
--- a/src/SDL_ttf.c
+++ b/src/SDL_ttf.c
@@ -3221,6 +3221,7 @@ static int TTF_Size_Internal(TTF_Font *font,
     hb_buffer_set_language(hb_buffer, font->hb_language);
     hb_buffer_set_direction(hb_buffer, hb_direction);
     hb_buffer_set_script(hb_buffer, hb_script);
+    hb_buffer_guess_segment_properties(hb_buffer);
 
     /* Layout the text */
     hb_buffer_add_utf8(hb_buffer, text, -1, 0, -1);