From 7e4a456bf463b887b94c191030dd742d7654d6ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1s=20Silva?= 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. (cherry picked from commit 7b3d8391095dbe672ab9314235fcb61b0022aaec) --- SDL_ttf.c | 1 + 1 file changed, 1 insertion(+) diff --git a/SDL_ttf.c b/SDL_ttf.c index 941bcc93..30eaa320 100644 --- a/SDL_ttf.c +++ b/SDL_ttf.c @@ -3234,6 +3234,7 @@ static int TTF_Size_Internal(TTF_Font *font, /* Set global configuration */ 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);