xcb_image_text_8(3)
π NAME π
xcb_image_text_8 β bestie, it Draws text β¨ (this one's from the XCB Requests crew, section 3 of the manual, and she's iconic for it)
πΈ SYNOPSIS πΈ
#include <xcb/xproto.h>
π Request function
xcb_void_cookie_t xcb_image_text_8(xcb_connection_t *conn,
uint8_t string_len, xcb_drawable_t drawable, xcb_gcontext_t gc,
int16_t x, int16_t y, const char *string);
π¦ REQUEST ARGUMENTS π¦
connβ the XCB connection to X11. your lil hotline to the X server, periodt πstring_lenβ how long the string is. and okay bestie, listen: this parameter is limited by 255 because it's using 8 bits! that's just the math, no cap. 8 bits = 256 values = 0 through 255, so that's the ceiling fr fr πdrawableβ the drawable (Window or Pixmap) you're drawing text onto. pick your canvas, main character energy β¨gcβ the graphics context to use. and the following graphics context components are the ones getting used, so write these down:plane-mask,foreground,background,font,subwindow-mode,clip-x-origin,clip-y-origin, andclip-mask. that's the whole roster, no substitutions πxβ the x coordinate of the first character, relative to the origin ofdrawable.yβ the y coordinate of the first character, relative to the origin ofdrawable.stringβ the string to draw. only the first 255 characters are relevant, because of the data type ofstring_len. the rest? ignored, ghosted, not invited to the party π
β¨ DESCRIPTION β¨
So here's the vibe: it fills the destination rectangle with the background pixel from gc, and then it paints the text with the foreground pixel from gc. two steps, one iconic little operation π¨
The upper-left corner of that filled rectangle sits at [x, y - font-ascent]. The width is overall-width, and the height is font-ascent + font-descent. And where do those numbers come from? overall-width, font-ascent and font-descent are as returned by xcb_query_text_extents (TODO). yeah bestie, the manpage itself says TODO, we don't make the rules π
π¨ Important, ngl: using X core fonts is deprecated (but still supported) in favor of client-side rendering using Xft. so it still works! but it's giving "old money, new tech moved on" π
π«Ά RETURN VALUE π«Ά
It returns an xcb_void_cookie_t. Errors (if any) have to be handled in the event loop β so don't be out here expecting the function itself to spill the tea, you gotta check the event loop for it π
If you want to handle errors directly with xcb_request_check instead, use xcb_image_text_8_checked. See xcb-requests(3) for details. yes, _checked is the overachiever sibling and we love her π
π ERRORS π
xcb_drawable_error_tβ the specified drawable (Window or Pixmap) does not exist. it's not there, bestie, it never was π«xcb_g_context_error_tβ the specified graphics context does not exist. same energy, the gc ghosted you π»xcb_match_error_tβ TODO: reasons? literally the manpage is shrugging at us on this one π we simply do not know
π SEE ALSO π
xcb-requests(3), xcb_image_text_16(3)
(go read the _16 one if 8 bits wasn't enough for your text, iykyk π)
π AUTHOR π
Generated from xproto.xml. Contact xcb@lists.freedesktop.org for corrections and improvements. the robots built this and honestly? they ate π
okay that's the whole page bestie, you're fully caught up π₯° this one came out of the X Version 11 era, tagged libxcb 1.17.0, and yes the manual header says xcb_image_text_8(3) right there at the top and the bottom both, mwah π go draw some text and slay β¨ππ¦
π¦ where this page comes from
- alpine 3.22: libxcb-doc 1.17.0-r0 Β· MIT
- alpine 3.23: libxcb-doc 1.17.0-r1 Β· MIT
- alpine 3.24: libxcb-doc 1.17.0-r2 Β· MIT
- arch rolling: libxcb 1.17.0-1 Β· X11
- centos-stream 10: libxcb-devel 1.17.0-3.el10 Β· X11
- debian trixie: libxcb-doc 1.17.0-2
- fedora 43: libxcb-devel 1.17.0-6.fc43 Β· X11
- fedora 43: libxcb-devel 1.17.0-6.fc43 Β· X11
- fedora 44: libxcb-devel 1.17.0-7.fc44 Β· X11
- fedora 44: libxcb-devel 1.17.0-7.fc44 Β· X11
- nixpkgs unstable: libxcb 1.17.0
- opensuse-leap 16.0: libxcb-devel-doc 1.17.0-160000.2.2 Β· MIT
- ubuntu questing: libxcb-doc 1.17.0-2build1
- ubuntu resolute: libxcb-doc 1.17.0-2ubuntu1
- ubuntu stonking: libxcb-doc 1.17.0-2ubuntu1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms