Xft and word wrapping

Радомир Хаџић radomirhadzic46 at gmail.com
Thu Nov 28 21:32:56 UTC 2019

I'm trying to implement word wrapping using Xlib and Xft. I have a few
questions and I hope some of you will answer at least some of them.

1. What to set the coordinates to in XftDrawString* functions? For
example, if I set them to (0,0), the top of the string is cropped.

2. By what amount to move the pen when we encounter a whitespace
(spaces, tabs, etc.) character? Currently, on every space I move the
cursor to the right by 5 pixels and on every tab four times that.
However the text looks uneven because of this:

    A a   B b   C c    D d
    E e  F f    G g      H h

I hope it's clear what I mean.

(I have to draw whitespace strings and non-whitespace strings
separately because I have to break if the word can't fit on the line.)

3. What do all the fields in XftFont structure represent?

4. For some reason the rendered text is "ugly". It is pixelated
instead of smooth for some reason, even though I know the font is
alright and it renders just fine in xterm. What can I do about this?

More information about the xorg mailing list