---
name: "TTF_CreateText"
section: "3"
platform: "linux"
package: "libsdl3-ttf-doc"
version: "3.2.2+ds-1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/TTF_CreateText"
---

# TTF\_CreateText(3)

Create a text object from UTF-8 text and a text engine.

## NAME

TTF\_CreateText - Create a text object from UTF-8 text and a text engine.

## HEADER FILE

Defined in SDL3\_ttf/SDL\_ttf.h

## SYNOPSIS

```
#include "SDL3_ttf/SDL_ttf.h"
```

**TTF\_Text \* TTF\_CreateText(TTF\_TextEngine \*engine, TTF\_Font \*font, const char \*text, size\_t length);**

## FUNCTION PARAMETERS

- *engine*

  the text engine to use when creating the text object, may be NULL.

- *font*

  the font to render with.

- *text*

  the text to use, in UTF-8 encoding.

- *length*

  the length of the text, in bytes, or 0 for null terminated text.

## RETURN VALUE

( **TTF\_Text**\
  \*) Returns a  **TTF\_Text**\
  object or NULL on failure; call SDL\_GetError() for more information.

## THREAD SAFETY

This function should be called on the thread that created the font and text engine.

## AVAILABILITY

This function is available since SDL\_ttf 3.0.0.

## SEE ALSO

**•**(3), [**TTF\_DestroyText**(3)](/TTF_DestroyText/3.md)
