⚠️ Forum Maintenance: Feb 6th, 8am - 14pm (UTC+2)

Font directory from Qt4 to Qt5

  • Hi all,
    I am trying to migrate from Qt4 to Qt5 but I have trouble regarding font configuration.
    I am using a custom configuration of Qt which is :
    -prefix install_dir -L install_dir/lib -I install_dir/include -I /install_dir/include/freetype2 -opensource -confirm-license -release -shared -nomake examples -make tools -no-openssl -skip qtgamepad -skip qt3d -skip qtactiveqt -skip qtandroidextras -skip qtcanvas3d -skip qtcharts -skip qtconnectivity -skip qtdatavis3d -skip qtdeclarative -skip qtdoc -skip qtgamepad -skip qtgraphicaleffects -skip qtimageformats -skip qtlocation -skip qtmacextras -skip qtmultimedia -skip qtnetworkauth -skip qtpurchasing -skip qtquickcontrols -skip qtquickcontrols2 -skip qtremoteobjects -skip qtscript -skip qtsensors -skip qtserialbus -skip qtserialport -skip qtspeech -skip qtsvg -skip qttranslations -skip qtvirtualkeyboard -skip qtwayland -skip qtwebchannel -skip qtwebengine -skip qtwebglplugin -skip qtwebsockets -skip qtwebview -skip qtwinextras -skip qtx11extras -skip qtxmlpatterns -system-libpng -system-libjpeg -system-zlib -system-freetype -no-glib -no-fontconfig -no-dbus -no-icu -v

    The error I have then (when launching the application) is :
    QFontDatabase: Cannot find font directory /home/antoine/dev/off_otbL/superbuild_install/lib/fonts. Note that Qt no longer ships fonts. Deploy some (from http://dejavu-fonts.org for example) or switch to fontconfig.

    I tried to use makeqpf by adding it to the build, but the error is the same, and I do not know how solve this issue.

    I am working on Ubuntu 16.04 with qt5.10.1 sources (http://download.qt.io/official_releases/qt/5.10/5.10.1/single/qt-everywhere-src-5.10.1.tar.xz).
    The result of ldd on libQt5Gui.so is :

    linux-vdso.so.1 =>  (0x00007fffe2276000)
    libQt5Core.so.5 => install__dir/lib/./libQt5Core.so.5 (0x00007f35c1d7e000)
    libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f35c1b61000)
    libGL.so.1 => /usr/lib/x86_64-linux-gnu/mesa/libGL.so.1 (0x00007f35c18ee000)
    libpng.so.1 => install__dir/lib/./libpng.so.1 (0x00007f35c16a9000)
    libharfbuzz.so.0 => /usr/lib/x86_64-linux-gnu/libharfbuzz.so.0 (0x00007f35c144b000)
    libz.so.1 => install__dir/lib/./libz.so.1 (0x00007f35c1231000)
    libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f35c0eaf000)
    libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f35c0ba6000)
    libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f35c0990000)
    libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f35c05c6000)
    libdouble-conversion.so.1 => /usr/lib/x86_64-linux-gnu/libdouble-conversion.so.1 (0x00007f35c03b5000)
    libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f35c01b1000)
    /lib64/ld-linux-x86-64.so.2 (0x00007f35c28d5000)
    libexpat.so.1 => /lib/x86_64-linux-gnu/libexpat.so.1 (0x00007f35bff88000)
    libxcb-dri3.so.0 => /usr/lib/x86_64-linux-gnu/libxcb-dri3.so.0 (0x00007f35bfd85000)
    libxcb-present.so.0 => /usr/lib/x86_64-linux-gnu/libxcb-present.so.0 (0x00007f35bfb82000)
    libxcb-sync.so.1 => /usr/lib/x86_64-linux-gnu/libxcb-sync.so.1 (0x00007f35bf97b000)
    libxshmfence.so.1 => /usr/lib/x86_64-linux-gnu/libxshmfence.so.1 (0x00007f35bf778000)
    libglapi.so.0 => /usr/lib/x86_64-linux-gnu/libglapi.so.0 (0x00007f35bf548000)
    libXext.so.6 => /usr/lib/x86_64-linux-gnu/libXext.so.6 (0x00007f35bf336000)
    libXdamage.so.1 => /usr/lib/x86_64-linux-gnu/libXdamage.so.1 (0x00007f35bf133000)
    libXfixes.so.3 => /usr/lib/x86_64-linux-gnu/libXfixes.so.3 (0x00007f35bef2d000)
    libX11-xcb.so.1 => /usr/lib/x86_64-linux-gnu/libX11-xcb.so.1 (0x00007f35bed2b000)
    libX11.so.6 => /usr/lib/x86_64-linux-gnu/libX11.so.6 (0x00007f35be9f1000)
    libxcb-glx.so.0 => /usr/lib/x86_64-linux-gnu/libxcb-glx.so.0 (0x00007f35be7d8000)
    libxcb-dri2.so.0 => /usr/lib/x86_64-linux-gnu/libxcb-dri2.so.0 (0x00007f35be5d3000)
    libxcb.so.1 => /usr/lib/x86_64-linux-gnu/libxcb.so.1 (0x00007f35be3b1000)
    libXxf86vm.so.1 => /usr/lib/x86_64-linux-gnu/libXxf86vm.so.1 (0x00007f35be1ab000)
    libdrm.so.2 => /usr/lib/x86_64-linux-gnu/libdrm.so.2 (0x00007f35bdf9a000)
    libglib-2.0.so.0 => /lib/x86_64-linux-gnu/libglib-2.0.so.0 (0x00007f35bdc89000)
    libfreetype.so.6 => /usr/lib/x86_64-linux-gnu/libfreetype.so.6 (0x00007f35bd9df000)
    libgraphite2.so.3 => /usr/lib/x86_64-linux-gnu/libgraphite2.so.3 (0x00007f35bd7b9000)
    libXau.so.6 => /usr/lib/x86_64-linux-gnu/libXau.so.6 (0x00007f35bd5b5000)
    libXdmcp.so.6 => /usr/lib/x86_64-linux-gnu/libXdmcp.so.6 (0x00007f35bd3af000)
    libpcre.so.3 => /lib/x86_64-linux-gnu/libpcre.so.3 (0x00007f35bd13f000)
    libpng12.so.0 => /lib/x86_64-linux-gnu/libpng12.so.0 (0x00007f35bcf1a000)

  • Lifetime Qt Champion

    Hi and welcome to devnet,

    Since you disabled fontconfig, did you create that directory and put some fonts in it as suggested by the message ?

  • Yes I did, but the result is not satisfactory : box and message are sometimes not at there right place (slight shift).
    And I still have an error message :
    QApplication: invalid style override passed, ignoring it.
    Whereas I looked at which font was asked and I provided it.
    And this forces me to download fonts without knowing how it will be rendered on other platform.. Is there any way to use makeqpf to generate fonts that will be multi-platform compliant?

  • Lifetime Qt Champion

    Use QFontDatabase to use your own set of fonts for your application.

    As for the style warning, I can't comment as I don't know what distribution you are running nor the window manager or desktop environment.

Log in to reply