TTF_SetFontScript(3)
π TTF_SetFontScript(3) π
okay bestie, welcome to the SDL_ttf3 FUNCTIONS corner of the manual, and today's main character is TTF_SetFontScript β¨
πΈ NAME πΈ
TTF_SetFontScript β set the script that a font uses for text shaping. that's it, that's the whole job π
π HEADER FILE π
it lives in SDL3_ttf/SDL_ttf.h, no cap π«Ά
β¨ SYNOPSIS β¨
#include "SDL3_ttf/SDL_ttf.h"
bool TTF_SetFontScript(TTF_Font *font, Uint32 script);
look at that signature, so clean, so iconic π
π¦ DESCRIPTION π¦
so here's the tea: this returns false if SDL_ttf isn't built with HarfBuzz support. like, no HarfBuzz, no script-setting, sorry babe π
also lowkey important β this updates any TTF_Text objects using this font. so it's not just a vibe change for the font itself, it ripples out to the text objects too π
π FUNCTION PARAMETERS π
fontβ the font you're modifying. your little typography baby πΌscriptβ an ISO 15924 code. the link in the original is a lil cursed-looking, so here it is exactly as-is:
https://unicode.www:lenstrwww:splitstr:nwww:splitstr:r[char46]org/iso15924/iso15924-codes.www:lenstrwww:splitstr:nwww:splitstr:r[char46]html
iykyk, it's the ISO 15924 codes page π
β RETURN VALUE β
returns true on success or false on failure π« and if it fails, go call SDL_GetError() for more information. she will tell you what went wrong, fr fr
π§΅ THREAD SAFETY π§΅
this function should be called on the thread that created the font. 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 β
π SEE ALSO π
β’(3)TTF_StringToTag(3)
and that's the whole page, bestie π this was brought to you by SDL_ttf 3.2.2, straight from the SDL_ttf era of the docs. go forth and shape some text, you absolute legend π¦π π
π¦ where this page comes from
- debian trixie: libsdl3-ttf-doc 3.2.2+ds-1 Β· Zlib
- fedora 43: SDL3_ttf-devel 3.2.2-2.fc43 Β· Zlib AND MIT
- fedora 43: SDL3_ttf-devel 3.2.2-2.fc43 Β· Zlib AND MIT
- fedora 44: SDL3_ttf-devel 3.2.2-4.fc44 Β· Zlib AND MIT
- fedora 44: SDL3_ttf-devel 3.2.2-4.fc44 Β· Zlib AND MIT
- ubuntu questing: libsdl3-ttf-doc 3.2.2+ds-1
- ubuntu resolute: libsdl3-ttf-doc 3.2.2+ds-1build1 Β· Zlib
- ubuntu stonking: libsdl3-ttf-doc 3.2.2+ds-2 Β· Zlib
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms