Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
Update to use Xft for text drawing #3
I found that there were issues displaying certain characters. The program appeared to be handling UTF8 characters improperly. To resolve this I used Xft functions to draw the text for the buttons. As a bonus this also lets the bar use more fonts than before.
I tried for a while to resolve the problem through updates using Xlib functions, but eventually gave up. I did make some progress, but I could not get all characters working. For example, a browser title including
Maybe there is a way to get it working with Xlib but I could not figure it out.
I went looking at dmenu's source as I saw you used it for a reference for some functionality. I found that they had in 2015 switched to using Xft for drawing text (and probably more). I decided to try doing the same. Initially I had some similar issues happening (some UTF8 encoded runes displaying as
I extracted some functions from dmenu, and used other parts from it as a reference but rewrote them. I put some straight copied code into
Anyway this commit introduces additional dependencies which is not ideal but it is working nicely for me.
I'd be happy to change anything you like here.
By the way, I noticed ratpoison itself is using Xft for fonts (by default), so that's a point in favour of using it here too I think.
I did see ratpoison does not do the per character check and additional font loading I implemented here though. In cases like for terminus where a character is not available it draws it as "n". Not optimal, but this pull request would be a lot smaller if we dropped that logic.