XmbDrawText(3)

πŸ’– XmbDrawText(3) β€” XLIB FUNCTIONS ✨

okay bestie, this is the XLIB FUNCTIONS page for XmbDrawText, XwcDrawText, and Xutf8DrawText, and it's literally about drawing text with multiple font sets. The squad is here, the font sets are shifting, and we are seated. πŸ’…πŸ«Ά


✨ NAME ✨

XmbDrawText, XwcDrawText, Xutf8DrawText β€” draw text using multiple font sets. That's the whole gig, and honestly? Iconic. πŸŽ€


πŸŽ€ SYNTAX πŸŽ€

Here are the exact signatures, bestie β€” do not freestyle these, not even a little:

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. yes, that GC, bestie. πŸ’…
  • 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 πŸ¦‹

okay so XmbDrawText, XwcDrawText, and Xutf8DrawText allow complex spacing and font set shifts between text strings. It's giving coordinated text choreography, fr fr. πŸ’ƒβœ¨ 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. πŸš«πŸ’…

Important vibe check: 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. 🫑 (And yes, every one of those names is staying exactly as written.)

When the XFontSet has missing charsets, each unavailable character is drawn with the default string returned by XCreateFontSet. 😭

⚠️ behavior alert: the behavior for an invalid codepoint is undefined. no cap, do not build your whole personality on that. πŸ’€

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 🌈


okay that's the whole page, bestie 🫢 this iconic little number is from X Version 11, libX11 1.8.14, with footer title XmbDrawText(3) β€” mwah, go draw some multi-font-set text πŸ’‹πŸŒˆ

πŸ“¦ where this page comes from