Mike
Mike

Reputation: 1

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:

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

Upvotes: 0

Views: 3081

Answers (2)

Mike
Mike

Reputation: 1

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
}

Upvotes: 0

john madieu
john madieu

Reputation: 1419

May be you should install fontconfig: IMAGE_INSTALL_append = " fontconfig". If it still doesn't works, you can strace -e open on your program that need font to see where it does look for fonts.

Below is an excerpt of using it:

# strace -e open ./my_program
[...]
open("/etc/fonts/fonts.conf", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = 13
open("/etc/fonts/conf.d", O_RDONLY|O_NONBLOCK|O_LARGEFILE|O_DIRECTORY|O_CLOEXEC) = 14
open("/etc/fonts/conf.d/10-scale-bitmap-fonts.conf", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = 15
open("/etc/fonts/conf.d/20-unhint-small-vera.conf", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = 15
open("/etc/fonts/conf.d/30-dejavu-aliases.conf", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = 15
open("/etc/fonts/conf.d/30-metric-aliases.conf", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = 15
open("/etc/fonts/conf.d/30-urw-aliases.conf", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = 15
open("/etc/fonts/conf.d/40-nonlatin.conf", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = 15
open("/etc/fonts/conf.d/45-latin.conf", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = 15
open("/etc/fonts/conf.d/49-sansserif.conf", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = 15
open("/etc/fonts/conf.d/50-user.conf", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = 15
open("/etc/fonts/conf.d/51-local.conf", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = 15
open("/etc/fonts/conf.d/60-latin.conf", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = 15
open("/etc/fonts/conf.d/65-fonts-persian.conf", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = 15
open("/etc/fonts/conf.d/65-nonlatin.conf", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = 15
open("/etc/fonts/conf.d/69-unifont.conf", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = 15
open("/etc/fonts/conf.d/80-delicious.conf", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = 15
open("/etc/fonts/conf.d/90-synthetic.conf", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = 15
open("/usr/share/fonts", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = 13
[...]

I hope this will help. Regards.

Upvotes: 0

Related Questions