QFontDatabase Qt 5.8 vs Qt 5.3.2

  • Hello,

    My apologies if this question has been asked before. We are upgrading our Qt application running on Lubuntu 32-bit from Qt 5.3.2 to Qt 5.8. One of the issues we have ran into is font handling. The Qt 5.3.2 version of our application detects the system fonts fine (the directories under /usr/share/fonts). However when starting the Qt 5.8 version we get this error:

    “QFontDatabase: Cannot find font directory”

    The directory that QFontDatabase looks for is “/usr/local/lib/lib/fonts”, which of course does not exists.

    The Qt 5.3.2 we use this the one that was provided by qt.io. The Qt 5.8 version we compiled from source on a virtual machine.

    We can get one of the directories to work by setting QT_QPA_FONTDIR, but our fonts are scattered over many directories.

    What is the proper way of solving this problem?

    Did we forget to configure some setting when compiling Qt 5.8 or has there been a change in behaviour and do we need to move all our fonts to one location?



  • Lifetime Qt Champion


    Since your compiling Qt yourself and that 5.9 is almost out, can you check with that version ?

    By the way, can you also show the options you pass to the configure script ?

  • @SGaist
    Thanks for the reply.
    We will try Qt5.9 once it's released. For the configure script we did not pass any extra options except nomake tests and nomake examples.
    We have also tried to build the using the qxcb option to no avail.

  • I tried to recompile Qt 5.8.0 again, this time following instructions written:


    to the letter and the problem is now fixed :).

Log in to reply