TTF_SetFontOutline(3)

πŸ’– TTF_SetFontOutline(3) πŸ’–

okay bestie, welcome to the SDL_ttf3 FUNCTIONS corner of the group chat 🫢 today's main character is TTF_SetFontOutline, and she's here to give your font a lil glow-up around the edges. yes, literally an outline. iconic behavior.


✨ NAME ✨

TTF_SetFontOutline β€” sets a font's current outline. that's it, that's the whole vibe πŸ’…


πŸ“ HEADER FILE πŸ“

she lives in SDL3_ttf/SDL_ttf.h. that's where you'll find her defined, no cap.


🌸 SYNOPSIS 🌸

#include "SDL3_ttf/SDL_ttf.h"

bool TTF_SetFontOutline(TTF_Font *font, int outline);

look at that signature. clean. stunning. slay.


πŸ’« DESCRIPTION πŸ’«

so here's the tea πŸ“ β€” when you set the font outline, this function pulls in a whole little committee of font properties to make it happen:

  • TTF_PROP_FONT_OUTLINE_LINE_CAP_NUMBER
  • TTF_PROP_FONT_OUTLINE_LINE_JOIN_NUMBER
  • TTF_PROP_FONT_OUTLINE_MITER_LIMIT_NUMBER

those three get used when setting the font outline. periodt.

and it doesn't stop there, bestie β€” this also updates any TTF_Text objects using this font, and it clears already-generated glyphs, if any, from the cache. so like, she refreshes the whole friend group, not just herself. the way that she keeps everyone in sync πŸ˜­πŸ’–


πŸŽ€ FUNCTION PARAMETERS πŸŽ€

  • font β€” the font you're giving a brand new outline to. your canvas, your queen πŸ‘‘
  • outline β€” a positive outline value, or 0 to go back to the default. (yes, 0 is the "never mind, back to factory settings" option πŸ’…)

πŸ”₯ RETURN VALUE πŸ”₯

Returns true on success or false on failure. if it flops, call SDL_GetError() for more info β€” she will tell you exactly what went wrong, fr fr.


🧚 THREAD SAFETY 🧚

this function should be called on the thread that created the font. don't be messy and call her from some random thread, bestie β€” she's loyal like that πŸ™ˆ


⭐ AVAILABILITY ⭐

this function has been available since SDL_ttf 3.0.0. so she's been serving looks for a while now.


🌈 SEE ALSO 🌈


lowkey important reminder: outline wants a positive value, and 0 means default. don't come at her with some negative nonsense, okay? 🫢

kay that's the whole page, you're basically a font outline expert now πŸ’…βœ¨ go forth and outline responsibly, bestie πŸ¦‹

this lil gem comes from the SDL_ttf manual, version SDL_ttf 3.2.2 β€” mwah, sending love from the SDL_ttf squad πŸŽ€πŸ’œ

πŸ“¦ where this page comes from