TTF_SetTextScript(3)

πŸ’– TTF_SetTextScript(3) β€” the SDL_ttf3 glow-up page

okay bestie, welcome to the group chat, we're learning TTF_SetTextScript from the SDL_ttf3 functions and it's honestly iconic. this is the one that tells your text object which script to use when it gets shaped. yes, shaped. your letters are getting a makeover and this function is the stylist. πŸ’…


✨ NAME ✨

TTF_SetTextScript β€” set the script that's gonna be used for text shaping a text object. periodt.


πŸ“ HEADER FILE πŸ“

it lives in SDL3_ttf/SDL_ttf.h, defined and cozy. no cap.


πŸŽ€ SYNOPSIS πŸŽ€

#include "SDL3_ttf/SDL_ttf.h"

bool TTF_SetTextScript(TTF_Text *text, Uint32 script);

πŸ¦‹ DESCRIPTION πŸ¦‹

here's the tea: this returns false if SDL_ttf isn't built with HarfBuzz support. that's it, that's the whole vibe check. if HarfBuzz ain't there, she can't do the thing. 😭


🌸 FUNCTION PARAMETERS 🌸

  • text β€” the text you're modifying, bestie. the glow-up recipient. πŸ’–
  • script β€” an ISO 15924 code. like, an actual code from the official list: ⟨https://unicode.org/iso15924/iso15924-codes.html⟩. go look up your script's four letters, iykyk. ✨

⭐ RETURN VALUE ⭐

returns true on success or false on failure β€” and if it's giving failure, call SDL_GetError() for more info, she'll spill the details. 🫢


🧚 THREAD SAFETY 🧚

this function should be called on the thread that created the text. do not be out here calling it from a random thread, that's not the move. main character energy only, on the right thread. πŸ‘‘


🌈 AVAILABILITY 🌈

this function has been available since SDL_ttf 3.0.0. she's been serving for a minute. πŸ’œ


πŸ”₯ SEE ALSO πŸ”₯


⚠️ quick reminder bestie: if it returns false, it might just be that HarfBuzz wasn't compiled in, so check SDL_GetError() before you spiral. πŸ’€

mwah πŸ’‹ that's the whole page. sourced from SDL_ttf 3.2.2, written by the SDL_ttf girlies, and yes the footer said TTF_SetTextScript(3) too. slay, go shape some gorgeous text. πŸŽ€πŸ¦‹βœ¨

πŸ“¦ where this page comes from