TTF_RenderText_LCD_Wrapped(3)

✨ TTF_RenderText_LCD_Wrapped ✨

okay bestie, so we're in the SDL_ttf3 functions manual and today's main character is TTF_RenderText_LCD_Wrapped πŸ’…

πŸŽ€ NAME πŸŽ€

TTF_RenderText_LCD_Wrapped β€” render word-wrapped UTF-8 text at LCD subpixel quality to a brand new ARGB surface. no cap, that's the whole gig πŸ¦‹

πŸ“ HEADER FILE πŸ“

Defined in SDL3_ttf/SDL_ttf.h β€” that's where you go to find it, periodt.

🌈 SYNOPSIS 🌈

#include "SDL3_ttf/SDL_ttf.h"

SDL_Surface * TTF_RenderText_LCD_Wrapped(TTF_Font *font, const char *text, size_t length, SDL_Color fg, SDL_Color bg, int wrap_width);

πŸ’– DESCRIPTION πŸ’–

So here's the vibe: this function allocates a whole new 32-bit, ARGB surface, and then renders alpha-blended text using FreeType's LCD subpixel rendering ✨ It hands you back that new surface, or NULL if something went wrong 😭

Text gets wrapped onto multiple lines on line endings and on word boundaries if it extends beyond wrap_width in pixels 🫢

If wrap_width is 0, this function will only wrap on newline characters. like, that's the whole rule, iykyk.

And if you wanna render at other quality levels, you absolutely can, bestie, just hit up:

  • TTF_RenderText_Solid_Wrapped
  • TTF_RenderText_Shaded_Wrapped
  • TTF_RenderText_Blended_Wrapped

🧚 FUNCTION PARAMETERS 🧚

  • font β€” the font you're rendering with, your main character πŸŽ€
  • text β€” the text to render, in UTF-8 encoding (as it should be πŸ’œ)
  • length β€” the length of the text, in bytes, or 0 for null terminated text
  • fg β€” the foreground color for the text
  • bg β€” the background color for the text
  • wrap_width β€” the maximum width of the text surface, or 0 to wrap on newline characters

⭐ RETURN VALUE ⭐

Returns a new 32-bit, ARGB surface πŸŽ‰ or NULL if there was an error πŸ’€

πŸ”₯ THREAD SAFETY πŸ”₯

This function should be called on the thread that created the font. don't be chaotic about it, bestie, keep it on that same thread πŸ™ˆ

πŸ‘‘ AVAILABILITY πŸ‘‘

This function is available since SDL_ttf 3.0.0. iconic behavior honestly.

🌸 SEE ALSO 🌸


and that's the whole page, bestie!! this one's straight out of the SDL_ttf 3.2.2 manual, section TTF_RenderText_LCD_Wrapped(3) πŸ’– go forth and wrap some text, you ate 🫢✨

πŸ“¦ where this page comes from