Search code examples
fontsx11yoctoopenembedded

Yocto image missing fonts (X11)


I'm in the process of building a Linux system image using Yocto (using a generic-x86_64 machine defintion).

When I build core-image-x11, the Matchbox will abort on start (claiming incorrect params where the fonts are defined in the default theme).

I can successfully load a desktop if I use xfce (using "packagegroup-xfce-base") instead of matchbox. However, all text is just rendered as empty boxes.

I have attempted to include as many font packages as I can find, for example:

  • xorg-minimal-fonts
  • packagegroup-fonts-truetype-core
  • ttf-liberation-mono/sans/serif
  • ttf-dejavu-common etc

Unfortunately, none of these have resolved the missing fonts issue. Is there a key font package/configuration option I have missed?


Solution

  • I found that the XFCE missing fonts issue can be solved by rebuilding the font cache.

    fc-cache -f -v 
    

    As this (should) only be need to be done once per install, I've added a postinstall task to a recipe of mine which rebuilds the font cache on the first boot of the Yocto image.

    pkg_postinst_${PN}() {
        if [ x"$D" = "x" ]; then
            #Only run the script on first startup of the machine
            fc-cache -f -v
        else
            #If we're in the staging directory (on the build machine), exit.
            exit 1
        fi
    }