Home

TTFRenderTextBlendedWrapped

TTF_RenderText_Blended_Wrapped is a function in the SDL_ttf library that renders a string of text to an SDL_Surface using a TrueType font with anti-aliased blending and automatic word wrapping. It is the wrapped variant of TTF_RenderText_Blended and is intended for rendering multi-line text that must fit within a fixed width.

Parameters: font is a pointer to a loaded TTF_Font; text is the C string to render; fg

Return: The function returns a new SDL_Surface containing the rendered text. The caller owns the surface and

Notes: The rendering uses blended antialiasing, producing smooth glyph edges with per-pixel alpha. The resulting surface

is
the
SDL_Color
specifying
the
foreground
color
of
the
text;
wrapLength
is
the
maximum
line
width
in
pixels.
If
wrapLength
is
greater
than
zero,
the
text
is
wrapped
to
fit
within
this
width
by
inserting
line
breaks
at
appropriate
word
boundaries.
If
wrapLength
is
zero
or
negative,
wrapping
is
disabled
and
the
text
is
rendered
on
a
single
line.
must
free
it
with
SDL_FreeSurface
when
it
is
no
longer
needed.
On
error,
the
function
returns
NULL
and
details
can
be
retrieved
via
TTF_GetError.
uses
the
specified
foreground
color
for
the
glyphs.
The
function
respects
newline
characters
and
applies
wrapping
only
to
the
portions
of
text
that
extend
beyond
the
specified
wrapLength.
It
requires
the
SDL_ttf
library
to
be
initialized
and
a
valid
font
obtained
through
TTF_OpenFont
or
similar.