rust-x-bindings / rust-xcb

Rust bindings and wrapper for XCB.
MIT License
165 stars 64 forks source link

Display text example #211

Closed rogarb closed 2 years ago

rogarb commented 2 years ago

I wrote this example for displaying text using xcb::x::ImageText8 request (see xcb_image_text_8() documentation).

This should work on any WM as it creates a new window.

rtbo commented 2 years ago

Thank you This works, but is kind of the 1990's way to display text... All modern code display text rendered on client instead of server. The steps generally are:

  1. select font file with fontconfig
  2. open font file and render glyphs in memory with freetype
  3. display glyphs using xcb::render (or most often now with an OpenGL or Vulkan texture)
rogarb commented 2 years ago

Thanks for your comment, I was sure that I read somewhere that the use of ImageText8 was deprecated but I couldn't find it when I submitted this pull request. I'll have a look to fontconfig/free type/rendering. I will close it then.