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

# XTextWidth(3)

compute text width

## NAME

XTextWidth, XTextWidth16 - compute text width

## SYNTAX

int XTextWidth(XFontStruct \**font\_struct*, \_Xconst char \**string*, int *count*);

int XTextWidth16(XFontStruct \**font\_struct*, \_Xconst XChar2b \**string*, int *count*);

## ARGUMENTS

- *count*

  Specifies the character count in the specified string.

- *font\_struct*

  Specifies the font used for the width computation.

- *string*

  Specifies the character string.

## DESCRIPTION

The **XTextWidth** and **XTextWidth16** functions return the width of the specified 8-bit or 2-byte character strings.

## SEE ALSO

[**XLoadFont**(3)](/XLoadFont/3.md), [**XTextExtents**(3)](/XTextExtents/3.md)\
 *Xlib - C Language X Interface*
