TTF_RENDERTEXT_BLENDED_WRAPPED(3)

✨ TTF_RenderText_Blended_Wrapped ✨

okay bestie, welcome to the SDL_ttf corner of the universe πŸ’– this one lives in the <SDL3_ttf/SDL_ttf.h> header file, and it's the girl who takes your text and makes it look gorgeous while also breaking it into lines so it doesn't run off the edge of the world. main character energy fr fr πŸ‘‘


🌸 NAME 🌸

TTF_RenderText_Blended_Wrapped β€” render word-wrapped UTF-8 text at high quality to a new ARGB surface πŸ’…


πŸŽ€ HEADER FILE πŸŽ€

Defined in SDL3_ttf/SDL_ttf.h


πŸ¦‹ SYNOPSIS πŸ¦‹

#include "SDL3_ttf/SDL_ttf.h"

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

✨ DESCRIPTION ✨

so basically, this function allocates a brand new 32-bit, ARGB surface, and it uses alpha blending to dither the font with whatever color you handed it. it gives you back that new surface, or NULL if something went wrong 😭

The text gets wrapped onto multiple lines β€” on line endings and on word boundaries β€” if it stretches past wrap_width in pixels. she's not letting your words hang off the edge, no ma'am 🫢

and if wrap_width is 0, this function will only wrap on newline characters. that's it. that's the whole vibe check.

if you wanna render at other quality levels, you can, and the girlies for that are:

  • TTF_RenderText_Solid_Wrapped
  • TTF_RenderText_Shaded_Wrapped
  • TTF_RenderText_LCD_Wrapped

🌈 FUNCTION PARAMETERS 🌈

  • font β€” the font you're rendering with, duh πŸ’–
  • text β€” the text to render, in UTF-8 encoding ✨
  • length β€” the length of the text, in bytes, or 0 for null terminated text πŸ‘‘
  • fg β€” the foreground 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. that's it, that's the tea πŸ“


🧚 THREAD SAFETY 🧚

This function should be called on the thread that created the font. don't be messy about it bestie, she's not built for cross-thread chaos πŸ’€

⭐ AVAILABILITY ⭐

This function is available since SDL_ttf 3.0.0. she's been iconic for a minute now πŸ’…


πŸ”₯ SEE ALSO πŸ”₯


and that's the whole page, periodt πŸ’–βœ¨ this lil beauty comes to you from SDL_ttf 3.2.2 β€” go forth and render, bestie, you got this πŸ«ΆπŸŽ€πŸ¦‹

πŸ“¦ where this page comes from