Font Configuration for Elementary with Famebuffer Backend

I found out what the problem with the elementary hello world application was. The fonts were missing. So how does font configuration work? To answer this the XFree86 Font De-uglification HOWTO’s TrueType Fonts section is useful. You basically have to copy your fonts into a directory and then run:

ttmkfdir
mkfontdir

This generates a fonts.scale file (which you can ignore because evas doesn’t care about it) and a fonts.dir file which is read by evas.

The default elementary theme uses Sans as default font so we have to set up an alias for this. This can be done by creating a fonts.alias file containing for example:

Sans    -misc-dejavu sans-medium-r-normal--0-0-0-0-c-0-ascii-0

However it is important that there is no trailing white space at the end of the line. Otherwise evas will reject the alias because it doesn’t match with a font from the fonts.dir file which doesn’t have any trailing spaces. Of course I only found this out after reading through evas source code and in the meantime I was told to just use X – Sigh.

Anyway while reading through the source I actually noticed that evas also uses the filename without extension as a font name. So a simple symlink like:

ln -s DejaVuSans.ttf Sans.ttf

also works as alias and in this case we don’t need the fonts.alias and fonts.dir files.

On a completely unrelated thing whoever came up with the idea to use XML for the fontconfig configuration files should be taken away from computers better sooner than later.

While the font problem is now solved the next thing to investigate is probably touchscreen handling which doesn’t quite work the way it should.

Marc