TTF_SetFontDirection(3)

πŸ’– TTF_SetFontDirection(3) πŸ’–

okay bestie, welcome to the SDL_ttf3 function club, today's guest of honour is TTF_SetFontDirection β€” she sets the direction that a font uses for text shaping. yes, like, which way the words go. iconic behaviour fr fr. πŸ¦‹


✨ NAME ✨

TTF_SetFontDirection β€” set the direction to be used for text shaping by a font.


🌸 HEADER FILE 🌸

she lives in SDL3_ttf/SDL_ttf.h, defined in SDL3_ttf/SDL_ttf.h. that's her address, don't lose it. πŸŽ€


⭐ SYNOPSIS ⭐

#include "SDL3_ttf/SDL_ttf.h"

bool TTF_SetFontDirection(TTF_Font *font, TTF_Direction direction);

look at her. short. sweet. takes two things and returns a bool. main character energy honestly. πŸ’…


πŸ’œ DESCRIPTION πŸ’œ

so here's the tea: this function only supports left-to-right text shaping if SDL_ttf was not built with HarfBuzz support. like, no HarfBuzz in your build? then LTR is all you're getting, that's the whole menu. no cap. 🫢

also β€” and this is the important bit β€” calling this updates any TTF_Text objects using this font. not just new ones. the existing ones. she goes back and updates her exes. 😭


🧚 FUNCTION PARAMETERS 🧚

  • font β€” the font to modify. yes queen, this is the one you're changing.
  • direction β€” the new direction for text to flow. the vibe check for which way the words travel.

πŸ”₯ RETURN VALUE πŸ”₯

returns true on success or false on failure β€” and if it fails, bestie, go call SDL_GetError() for more info. she will tell you what went wrong, just ask her. πŸ’€


🌈 THREAD SAFETY 🌈

please please please call this on the thread that created the font. that's the rule. respect the origin thread, she's the only one who can touch this font safely. πŸ‘‘


⭐ AVAILABILITY ⭐

this function has been available since SDL_ttf 3.0.0. so she's been around, she's established, she's not new here. πŸ“


and that's the whole page, bestie!! this was TTF_SetFontDirection(3) from the SDL_ttf 3.2.2 manual β€” tysm for reading, mwah πŸ’–βœ¨πŸŽ€ go set some directions, you're gonna slay

πŸ“¦ where this page comes from