---
name: "XSetFont"
section: "3"
platform: "linux"
package: "libx11"
version: "1.8.14-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/XSetFont"
---

# XSetFont(3)

GC convenience routines

## NAME

XSetFont - GC convenience routines

## SYNTAX

int XSetFont(Display \**display*, GC *gc*, Font *font*);

## ARGUMENTS

- *display*

  Specifies the connection to the X server.

- *font*

  Specifies the font.

- *gc*

  Specifies the GC.

## DESCRIPTION

The **XSetFont** function sets the current font in the specified GC.

**XSetFont** can generate **BadAlloc**, **BadFont**, and **BadGC** errors.

## DIAGNOSTICS

- **BadAlloc**

  The server failed to allocate the requested resource or server memory.

- **BadFont**

  A value for a Font or GContext argument does not name a defined Font.

- **BadGC**

  A value for a GContext argument does not name a defined GContext.

## SEE ALSO

[**XCreateGC**(3)](/XCreateGC/3.md), [**XQueryBestSize**(3)](/XQueryBestSize/3.md), [**XSetArcMode**(3)](/XSetArcMode/3.md), [**XSetClipOrigin**(3)](/XSetClipOrigin/3.md), [**XSetFillStyle**(3)](/XSetFillStyle/3.md), [**XSetLineAttributes**(3)](/XSetLineAttributes/3.md), [**XSetState**(3)](/XSetState/3.md), [**XSetTile**(3)](/XSetTile/3.md)\
 *Xlib - C Language X Interface*
