XmbTextExtents(3)
πΈ XmbTextExtents(3) β XLIB FUNCTIONS πΈ
okay so welcome to the XLIB FUNCTIONS corner of the manual, bestie. this page is literally about three functions that compute text extents, and weβre gonna get into all the details without losing a single crumb. π«Ά
π NAME π
XmbTextExtents, XwcTextExtents, Xutf8TextExtents β compute text extents. thatβs the whole name section, short and iconic. β¨
π§ SYNTAX π§
int XmbTextExtents(XFontSet font_set, _Xconst char *string, int
num_bytes, XRectangle *overall_ink_return, XRectangle
*overall_logical_return);
int XwcTextExtents(XFontSet font_set, _Xconst wchar_t *string, int
num_wchars, XRectangle *overall_ink_return, XRectangle
*overall_logical_return);
int Xutf8TextExtents(XFontSet font_set, _Xconst char *string, int
num_bytes, XRectangle *overall_ink_return, XRectangle
*overall_logical_return);
π ARGUMENTS π
font_setβ Specifies the font set. yes bestie, thatβs the font set in question. πnum_bytesβ Specifies the number of bytes in thestringargument. count βem in bytes, not vibes.num_wcharsβ Specifies the number of characters in thestringargument. this one counts characters, okay?overall_ink_returnβ Returns the overall ink dimensions. ποΈoverall_logical_returnβ Returns the overall logical dimensions. logic slay.stringβ Specifies the character string. the actual text, periodt.
π DESCRIPTION π
Okay so XmbTextExtents, XwcTextExtents, and Xutf8TextExtents set the components of the overall_ink_return and overall_logical_return arguments you passed in. Specifically:
- the components of
overall_ink_returnget set to the overall bounding box of the stringβs image πΌοΈ - the components of
overall_logical_returnget set to a logical bounding box for spacing purposes π
(respectively, bestie β donβt mix βem up.)
They return the value returned by XmbTextEscapement, XwcTextEscapement, or Xutf8TextEscapement. These metrics are relative to the drawing origin of the string, using the fonts loaded for the specified font set. no cap.
If overall_ink_return is non-NULL, it is set to the bounding box of the stringβs character ink. For a nondescending, horizontally drawn Latin character, the convention is that it sits entirely above the baseline β that is, overall_ink_return.height <= -overall_ink_return.y. For a nonkerned character, itβs entirely at, and to the right of, the origin β that is, overall_ink_return.x >= 0. A character consisting of a single pixel at the origin would set overall_ink_return fields y = 0, x = 0, width = 1, and height = 1. tiny pixel icon behavior, literally. π
If overall_logical_return is non-NULL, it is set to the bounding box that provides minimum spacing to other graphical features for the string. Other graphical features, for example, a border surrounding the text, should not intersect this rectangle. so like, give the text its personal space. π«Ά
When the XFontSet has missing charsets, metrics for each unavailable character are taken from the default string returned by XCreateFontSet so that the metrics represent the text as it will actually be drawn.
β οΈ bestie, warning: the behavior for an invalid codepoint is undefined. undefined means donβt come crying to me when the vibes break β itβs not specified. π
The function Xutf8TextExtents 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. slay, now you can check for it.
π SEE ALSO π
Go peep XmbTextEscapement(3) and XmbTextPerCharExtents(3), plus Xlib - C Language X Interface. iykyk. β¨
mwah π thatβs the page, bestie. footer flex: X Version 11, libX11 1.8.14, and XmbTextExtents(3) β iconic source/version energy, and no separate date printed in this one. π
π¦ where this page comes from
- alpine 3.24: libx11-doc 1.8.14-r0 Β· X11
- arch rolling: libx11 1.8.14-1 Β· MIT AND X11
- nixos 26.05: libx11 1.8.14
- nixpkgs unstable: libx11 1.8.14
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms