TTF_RenderT...aded_Wrapped(3)
π TTF_RenderText_Shaded_Wrapped β from the SDL_ttf3 FUNCTIONS era π
okay bestie, sit down, hydrate, because we're about to render some word-wrapped UTF-8 text at high quality to a brand new 8-bit surface and honestly? iconic behavior. this one lives in the SDL_ttf 3 function family, iykyk. π
β¨ NAME β¨
TTF_RenderText_Shaded_Wrapped β Render word-wrapped UTF-8 text at high quality to a new 8-bit surface. periodt. π
π¦ HEADER FILE π¦
she's defined in SDL3_ttf/SDL_ttf.h β that's the one, that's the file, no cap.
πΈ SYNOPSIS πΈ
#include "SDL3_ttf/SDL_ttf.h"
SDL_Surface * TTF_RenderText_Shaded_Wrapped(TTF_Font *font, const char *text, size_t length, SDL_Color fg, SDL_Color bg, int wrap_width);
look at her. six whole parameters. main character energy fr fr. π
π DESCRIPTION π
so the way this works: this function will allocate a new 8-bit, palettized surface. the surface's 0 pixel is gonna be the background color you specified, and every other pixel gets varying degrees of the foreground color. it hands you back that new surface, or NULL if something went wrong. π
text gets wrapped to multiple lines on line endings and on word boundaries if it extends beyond wrap_width in pixels. so it's giving responsible, tidy, well-behaved text. β¨
and listen β if wrap_width is 0, this function will only wrap on newline characters. that's it. that's the whole rule. no pixel-width drama, just newlines. π
you can also render at other quality levels, if you're feeling a different vibe:
TTF_RenderText_Solid_WrappedTTF_RenderText_Blended_WrappedTTF_RenderText_LCD_Wrapped
pick your fighter bestie π«Ά
π FUNCTION PARAMETERS π
fontβ the font to render with. your chosen one. your muse. πtextβ the text to render, in UTF-8 encoding. yes UTF-8, we're not doing 2003 encodings here. πlengthβ the length of the text, in bytes, or0for null terminated text. (bytes, not vibes β actually count them.)fgβ the foreground color for the text.bgβ the background color for the text.wrap_widthβ the maximum width of the text surface, or0to wrap on newline characters. that zero again. she's special. β¨
β RETURN VALUE β
returns a new 8-bit, palettized surface, or NULL if there was an error. if you get NULL, that's not a slay, that's an error, check it. π
π§΅ THREAD SAFETY π§΅
this function should be called on the thread that created the font. the font's thread. her thread. don't be out here threading her from somewhere else, that's rude. π ββοΈ
π AVAILABILITY π
this function is available since SDL_ttf 3.0.0. so if you're on something older, sorry babe, upgrade. π¦
π SEE ALSO π
β’(3)TTF_RenderText_Blended_Wrapped(3)β’(3)TTF_RenderText_LCD_Wrapped(3)β’(3)TTF_RenderText_Shaded(3)β’(3)TTF_RenderText_Solid_Wrapped(3)
go read those too, bestie, they're all in the same little friend group. π
okay that's the whole page!! tysm for reading, mwah π«Ά this little legend comes to you from SDL_ttf 3.2.2, and yeah, that's the version and the source of the page β consider this your cute lil sign-off, go render something gorgeous, you got this πβ¨π
π¦ 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