Yocto Qt and Fonts

Discussion in 'Yocto' started by Retasor, Jun 15, 2017.

Tags:
  1. Retasor

    Retasor New Member

    Joined:
    Dec 26, 2016
    Messages:
    11
    Likes Received:
    4
    I have build an Yocto image according to @graugans instructions and Qt support.
    All ok and working. Only the Fonts in the Qt application are doing strange things.
    When starting the Qt application it tells me a Helvetica font is loaded and used. But for as far as I know Helvetica is a Sans-Serif type while all letters are in the Serif type. When I overload the default font setting by
    Code:
    QApplication::setFont(QFont("DejaVu Sans")); 
    It looks better although a lot of things where set to the font Arial in the application which also result in showing them as Serif while it should have shown a Sans-Serif type of font.

    Can some one helping me understanding why this is happening?
     
  2. modjo

    modjo Active Member

    Joined:
    Sep 29, 2014
    Messages:
    417
    Likes Received:
    127
    i suppose you use a 5.7 version (or greater) of Qt. If it's the case, since qt 5.7 font are not provided more. You need to add it to your image. For that, add this to your local.conf :

    Code:
        IMAGE_INSTALL_append = "\
        ttf-dejavu-sans \
        ttf-dejavu-sans-mono \
        ttf-dejavu-sans-condensed \
        ttf-dejavu-serif \
        ttf-dejavu-serif-condensed \
        ttf-dejavu-common \
    "
    and in /meta-udoo/recipes-qt/qt5-env/files/qt5-env-sh

    Code:
    
#define a new path for the font in qt5.8
    export QT_QPA_FONTDIR=/usr/share/fonts/truetype
    
    This will be correct your issue
     

Share This Page