JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
Improved font caching
authorEon S. Jeon <esjeon@lavabit.com>
Fri, 19 Jul 2013 05:07:02 +0000 (01:07 -0400)
committerRoberto E. Vargas Caballero <k0ga@shike2.com>
Fri, 19 Jul 2013 06:38:10 +0000 (08:38 +0200)
commit33ad83d49213749f4fcec850327f57a33ca8b921
tree264341fa0a2e832b95af7d92753e30c1faf894da
parent40e4d76d227d9c517054036f546acd49431bca42
Improved font caching

I made a patch that improves the performance of font caching mechanism.
This is based on a funny behaviour of FontConfig: it was handling
FcCharSet in a somewhat unexpected way.

So, we are currently adding "a character" to a new FcCharSet, and then
add it to a FcPattern. However, if we toss the FcPattern to FontConfig,
it loads the entire language(charset) that contains the character we
gave. That is, we don't always have to load a new font for each unknown
character. Instead, we can reused cached fonts, and this significantly
reduces the number of calls to extremely slow FontConfig matching
functions.

One more thing. I found that, in libXft, there's a function called
XftCharExists. XftCharIndex internally calls this function, and
does more stuffs if the character does exist. Since the returned index
is never used in st, we should call XftCharExists instead of
XftCharIndex. Please note that I already made this change in the patch.
st.c