xcb_image_text_8(3)

πŸ“¦
version 1.17.0 Β· 4 versions
, in alpine 3.22, alpine 3.23, alpine 3.24, arch rolling, centos-stream 10, debian trixie, fedora 43, fedora 44, nixpkgs unstable, opensuse-leap 16.0, ubuntu questing, ubuntu resolute, ubuntu stonking

πŸ’– 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, and clip-mask. that's the whole roster, no substitutions πŸ’–
  • x β€” the x coordinate of the first character, relative to the origin of drawable.
  • y β€” the y coordinate of the first character, relative to the origin of drawable.
  • string β€” the string to draw. only the first 255 characters are relevant, because of the data type of string_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 βœ¨πŸŽ€πŸ¦‹