---
name: "TTF_GetTextSize"
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_GetTextSize"
---

# TTF\_GetTextSize(3)

Get the size of a text object.

## NAME

TTF\_GetTextSize - Get the size of a text object.

## HEADER FILE

Defined in SDL3\_ttf/SDL\_ttf.h

## SYNOPSIS

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

**bool TTF\_GetTextSize(TTF\_Text \*text, int \*w, int \*h);**

## DESCRIPTION

The size of the text may change when the font or font style and size change.

## FUNCTION PARAMETERS

- *text*

  the  **TTF\_Text**\
    to query.

- *w*

  a pointer filled in with the width of the text, in pixels, may be NULL.

- *h*

  a pointer filled in with the height of the text, in pixels, may be NULL.

## 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.
