---
name: "TTF_SetFontSizeDPI"
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_SetFontSizeDPI"
---

# TTF\_SetFontSizeDPI(3)

Set font size dynamically with target resolutions, in dots per inch.

## NAME

TTF\_SetFontSizeDPI - Set font size dynamically with target resolutions, in dots per inch.

## HEADER FILE

Defined in SDL3\_ttf/SDL\_ttf.h

## SYNOPSIS

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

**bool TTF\_SetFontSizeDPI(TTF\_Font \*font, float ptsize, int hdpi, int vdpi);**

## DESCRIPTION

This updates any  **TTF\_Text**\
  objects using this font, and clears already-generated glyphs, if any, from the cache.

## FUNCTION PARAMETERS

- *font*

  the font to resize.

- *ptsize*

  the new point size.

- *hdpi*

  the target horizontal DPI.

- *vdpi*

  the target vertical DPI.

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

## AVAILABILITY

This function is available since SDL\_ttf 3.0.0.

## SEE ALSO

**•**(3), [**TTF\_GetFontSize**(3)](/TTF_GetFontSize/3.md), **•**(3), **TTF\_GetFontSizeDPI**(3)
