---
name: "TTF_DrawSurfaceText"
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_DrawSurfaceText"
---

# TTF\_DrawSurfaceText(3)

Draw text to an SDL surface.

## NAME

TTF\_DrawSurfaceText - Draw text to an SDL surface.

## HEADER FILE

Defined in SDL3\_ttf/SDL\_ttf.h

## SYNOPSIS

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

**bool TTF\_DrawSurfaceText(TTF\_Text \*text, int x, int y, SDL\_Surface \*surface);**

## DESCRIPTION

**text** must have been created using a  **TTF\_TextEngine**\
  from

**TTF\_CreateSurfaceTextEngine** ().

## FUNCTION PARAMETERS

- *text*

  the text to draw.

- *x*

  the x coordinate in pixels, positive from the left edge towards the right.

- *y*

  the y coordinate in pixels, positive from the top edge towards the bottom.

- *surface*

  the surface to draw on.

## RETURN VALUE

Returns true on success or false on failure; call SDL\_GetError() for more information.

## THREAD SAFETY

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

## AVAILABILITY

This function is available since SDL\_ttf 3.0.0.

## SEE ALSO

**•**(3), [**TTF\_CreateSurfaceTextEngine**(3)](/TTF_CreateSurfaceTextEngine/3.md), **•**(3), [**TTF\_CreateText**(3)](/TTF_CreateText/3.md)
