Rendering fonts in X11

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Rendering fonts in X11

David Bjergaard-2
Hi Guys,

About a year ago there was an effort to put truetype font support in
stumpwm.  While it worked, there were significant performance issues
that caused many users to complain (myself included).  We pulled the
font rendering parts out and put the truetype support into its own
module.

The lisp package used for this is clx-truetype.  I've been hacking on
another font rendering package that is based on cl-freetype2.  There are
some advantages and disadvantages of this approach namely:
- cl-freetype2 relies on CFFI wrapping FreeType2 C++ code
- clx-truetype is end-to-end a lisp solution

The issue with both of these packages comes down to performance. I can't
seem to find good examples of how text rendering is actually done in
other applications.  The freetype2 tutorial suggest rendering character
by character and then drawing the resulting bitmap.  

The toy examples that I've come across do something similar, but the
level that I interact with them at is usually at the string level (ie a
do-string-render macro in cl-freetype2, and similar code in
clx-truetype).

I don't have clue how to optimize my code or the clx-truetype code.  I
have some ideas for "faster" approaches (ie storing a hashtable of
pixmaps keyed by the utf8-char and rendering char-by-char, caching
pixmaps as their requested), but I don't know if this is correct, or if
it will be wasted effort.

I don't even know how to find the hotspots of the lisp code to see where
all the time is spent rendering...

If anyone has any insights, I'm all ears.  Adding FreeType support will
give us support for cyrillic fonts  and with the other patches we should
be able to fully support unicode arguments in stumpwm command prompts.

    Dave

_______________________________________________
Stumpwm-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/stumpwm-devel