TTF_GetTextScript(3)

✨ TTF_GetTextScript ✨

okay bestie, so this is TTF_GetTextScript(3) from the SDL_ttf3 function family, and it's literally the little detective that tells you which script your text object is getting shaped with πŸ’…


🌸 NAME 🌸

TTF_GetTextScript β€” get the script used for text shaping a text object πŸ¦‹


πŸŽ€ HEADER FILE πŸŽ€

it lives in SDL3_ttf/SDL_ttf.h, no cap πŸ’–


✨ SYNOPSIS ✨

#include "SDL3_ttf/SDL_ttf.h"

Uint32 TTF_GetTextScript(TTF_Text *text);

πŸ’œ DESCRIPTION πŸ’œ

so like… this one just asks your text object "hey girl, what script are you?" 🫢

If nobody set one explicitly, it defaults to the script of the font used by the text object. so it's giving "inherited from the font" energy ✨


πŸ“ FUNCTION PARAMETERS πŸ“

  • text β€” the text to query πŸ‘‘ (that's the one you're asking about, bestie)

🌈 RETURN VALUE 🌈

Returns an ISO 15924 code ⭐

like, from this list:

https://
unicode.www:lenstrwww:splitstr:nwww:splitstr:r[char46]org/iso15924/
iso15924-codes.www:lenstrwww:splitstr:nwww:splitstr:r[char46]html
not me side-eyeing the man page renderer for chewing up that URL πŸ’€ that's literally what it says in the source page though, so I'm keeping it exactly as-is. iykyk.

OR it returns 0 if a script hasn't been set on either the text object or the font 😭 (no script anywhere = sad little zero)


🧚 THREAD SAFETY 🧚

this function should be called on the thread that created the text. periodt. πŸ”₯ don't be out here calling it from some random thread, that's not the vibe πŸ™ˆ


πŸ‘‘ AVAILABILITY πŸ‘‘

this function is available since SDL_ttf 3.0.0 β€” so it's been iconic for a while now ✨


πŸ’– SEE ALSO πŸ’–


and that's the whole thing, bestie! πŸŽ€ this page is from SDL_ttf version 3.2.2 (the SDL_ttf 3.2.2 footer energy), and yeah the title line is just TTF_GetTextScript(3) again because man pages love repeating themselves πŸ’… go forth and query your scripts, you main character πŸ¦‹πŸ’–

πŸ“¦ where this page comes from