TTF_RENDERTEXT_SOLID_WRAPPED(3)

πŸ’– TTF_RenderText_Solid_Wrapped πŸ’–

okay bestie, welcome to the SDL_ttf corner of the manual, this one's from the SDL_ttf 3 era and it's literally the speedrun version of putting words on a screen πŸƒβ€β™€οΈπŸ’¨

🌸 NAME 🌸

TTF_RenderText_Solid_Wrapped β€” Render word-wrapped UTF-8 text at fast quality to a new 8-bit surface.


πŸŽ€ HEADER FILE πŸŽ€

Defined in SDL3_ttf/SDL_ttf.h β€” that's where she lives, no cap 🫢

✨ SYNOPSIS ✨

#include "SDL3_ttf/SDL_ttf.h"

SDL_Surface * TTF_RenderText_Solid_Wrapped(TTF_Font *font, const char *text, size_t length, SDL_Color fg, int wrapLength);

πŸ’… DESCRIPTION πŸ’…

So here's the tea, bestie: this function will allocate a new 8-bit, palettized surface. The surface's 0 pixel will be the colorkey, giving a transparent background. The 1 pixel will be set to the text color. it's giving "instant sticker with a see-through backdrop" energy ✨

Text is wrapped to multiple lines on line endings and on word boundaries if it extends beyond wrapLength in pixels.

If wrapLength is 0, this function will only wrap on newline characters. periodt πŸ“

You can render at other quality levels with

  • TTF_RenderText_Shaded_Wrapped
  • TTF_RenderText_Blended_Wrapped
  • TTF_RenderText_LCD_Wrapped

pick your fighter, they all ate πŸ’–


🌈 FUNCTION PARAMETERS 🌈

  • font β€” the font to render with. your main character πŸŽ€
  • text β€” text to render, in UTF-8 encoding.
  • length β€” the length of the text, in bytes, or 0 for null terminated text. zero means "bestie, I got you, just read till the end" πŸ™ˆ
  • fg β€” the foreground color for the text.
  • wrapLength β€” the maximum width of the text surface or 0 to wrap on newline characters.

πŸ‘‘ RETURN VALUE πŸ‘‘

Returns a new 8-bit, palettized surface, or NULL if there was an error.

if you get NULL back, something went wrong, and you should go check that error like it's your ex's story πŸ’€

🧚 THREAD SAFETY 🧚

This function should be called on the thread that created the font. do NOT go handing your font to another thread, she's not about that life, fr fr βœ‹

⭐ AVAILABILITY ⭐

This function is available since SDL_ttf 3.0.0. old enough to be iconic, new enough to still be relevant πŸ’œ

πŸ¦‹ SEE ALSO πŸ¦‹


and that's the whole page, bestie!! 🌸 this was SDL_ttf β€” the SDL_ttf 3.2.2 era, mwah πŸ’‹ go render something gorgeous, you got this πŸ«Άβœ¨πŸŽ€

πŸ“¦ where this page comes from