Skip to content

Commit

Permalink
Let HarfBuzz decide which script, direction and language to use in ca…
Browse files Browse the repository at this point in the history
…se 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 7b3d839)
  • Loading branch information
Tomás Silva authored and slouken committed Jul 5, 2024
1 parent f5ef75b commit 7e4a456
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions SDL_ttf.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 7e4a456

Please sign in to comment.