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

# XmbDrawText(3)

draw text using multiple font sets

## NAME

XmbDrawText, XwcDrawText, Xutf8DrawText - draw text using multiple font sets

## SYNTAX

void XmbDrawText(Display \**display*, Drawable *d*, GC *gc*, int *x*, int *y*, XmbTextItem \**items*, int *nitems*);

void XwcDrawText(Display \**display*, Drawable *d*, GC *gc*, int *x*, int *y*, XwcTextItem \**items*, int *nitems*);

void Xutf8DrawText(Display \**display*, Drawable *d*, GC *gc*, int *x*, int *y*, XmbTextItem \**items*, int *nitems*);

## ARGUMENTS

- *d*

  Specifies the drawable.

- *display*

  Specifies the connection to the X server.

- *gc*

  Specifies the GC.

- *items*

  Specifies an array of text items.

- *nitems*

  Specifies the number of text items in the array.

- *x*

  - *y*

  Specify the x and y coordinates.

## DESCRIPTION

The **XmbDrawText**, **XwcDrawText** and **Xutf8DrawText** functions allow complex spacing and font set shifts between text strings. Each text item is processed in turn, with the origin of a text element advanced in the primary draw direction by the escapement of the previous text item. A text item delta specifies an additional escapement of the text item drawing origin in the primary draw direction. A font\_set member other than **None** in an item causes the font set to be used for this and subsequent text items in the text\_items list. Leading text items with a font\_set member set to **None** will not be drawn.

**XmbDrawText**, **XwcDrawText** and **Xutf8DrawText** do not perform any context-dependent rendering between text segments. Clients may compute the drawing metrics by passing each text segment to **XmbTextExtents**, **XwcTextExtents**, **Xutf8TextExtents** or **XmbTextPerCharExtents**, **XwcTextPerCharExtents**. **Xutf8TextPerCharExtents**. When the **XFontSet** has missing charsets, each unavailable character is drawn with the default string returned by **XCreateFontSet**. The behavior for an invalid codepoint is undefined.

The function **Xutf8DrawText** is an extension introduced by The XFree86 Project, Inc., in their 4.0.2 release. Its presence is indicated by the macro **X\_HAVE\_UTF8\_STRING**.

## STRUCTURES

The **XmbTextItem** structure contains:

```
typedef struct {
        char *chars;    /* pointer to string */
        int nchars;     /* number of bytes */
        int delta;      /* pixel delta between strings */
        XFontSet font_set;      /* fonts, None means don't change */
} XmbTextItem;
```

The **XwcTextItem** structure contains:

```
typedef struct {
        wchar_t *chars; /* pointer to wide char string */
        int nchars;     /* number of wide characters */
        int delta;      /* pixel delta between strings */
        XFontSet font_set;      /* fonts, None means don't change */
} XwcTextItem;
```

## SEE ALSO

[**XDrawImageString**(3)](/XDrawImageString/3.md), [**XDrawString**(3)](/XDrawString/3.md), [**XDrawText**(3)](/XDrawText/3.md), [**XmbDrawImageString**(3)](/XmbDrawImageString/3.md), [**XmbDrawString**(3)](/XmbDrawString/3.md)\
 *Xlib - C Language X Interface*
