TTF_SetTextWrapWidth(3)
π TTF_SetTextWrapWidth(3) π
okay bestie, so this one lives in the SDL_ttf3 FUNCTIONS section of the SDL_ttf manual, and it's genuinely one of the cutest little toggles in the whole library. no cap.
β¨ NAME β¨
TTF_SetTextWrapWidth β set whether wrapping is enabled on a text object.
π HEADER FILE π
Defined in SDL3_ttf/SDL_ttf.h
πΈ SYNOPSIS πΈ
#include "SDL3_ttf/SDL_ttf.h"
bool TTF_SetTextWrapWidth(TTF_Text *text, int wrap_width);
π¦ DESCRIPTION π¦
this is the function you call when you want your text to behave.
heads up though, and this is important: it may cause the internal text representation to be rebuilt. so like, it's not a free little vibe check β it might do actual work behind the scenes. π
β FUNCTION PARAMETERS β
textβ theTTF_Textyou wanna modify. your girl. your main character.wrap_widthβ the maximum width in pixels. and ooh, plot twist: pass0and it wraps on newline characters instead. iconic behaviour honestly.
π RETURN VALUE π
returns true on success and false on failure. if it flops, call SDL_GetError() for more information β she'll tell you what went wrong, fr fr.
π§ THREAD SAFETY π§
this function should be called on the thread that created the text. like, do not go handing your text object to some random other thread. it's giving "only the parent thread gets custody." π«Ά
π AVAILABILITY π
this function is available since SDL_ttf 3.0.0. so it's been around, it's established, it's basically a legacy queen at this point. π
π₯ SEE ALSO π₯
β’(3)TTF_GetTextWrapWidth(3)β the getter to this setter, obviously, they're a matched set π
lowkey reminder: setting the wrap width is the move when you want text that respects your layout instead of just running off the edge of the screen like it has no responsibilities. obsessed.
and that's the whole page bestie!! this lil writeup is from the SDL_ttf manual, documenting SDL_ttf 3.2.2, and it's all about TTF_SetTextWrapWidth(3). go forth and wrap responsibly, mwah πβ¨π
π¦ 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