Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Windows 10, Qt/QML 5.15.5 Liberation Sans is loaded by app, but Arial is being substituted. By Qt? By Windows?



  • The Liberation Sans font is loaded into the application font database directly. The font is also installed on Windows 10. Yet on my system, not for some reason on my co-workers, Arial is being substituted. Again, Liberation Sans is installed by the app and is a resource compiled into it. But looking at the number one (1), it is clear that Arial, which has no horizontal bar at its base, is being used instead of Liberation Sans, which does have a bar at its base.

    Is there an explanation for this? Is there anything to be done to prevent it?

    The other clue to this was that the zero (0) is far rounder in Liberation Sans than in Arial.

    From main():

    QFontDatabase::addApplicationFont("qrc:/imagine-assets/LiberationSans-Regular.ttf");
    QFontDatabase::addApplicationFont("qrc:/imagine-assets/LiberationSans-Italic.ttf");
    QFontDatabase::addApplicationFont("qrc:/imagine-assets/LiberationSans-Bold.ttf");
    
    QFont appFont = QFont("Liberation");
    appFont.setStyleHint(QFont::SansSerif);
    appFont.setHintingPreference(QFont::PreferNoHinting);
    QApplication::setFont(appFont);
    

    Any help would be greatly appreciated.

    Thanks.



  • Issue was the name used when setting the font. Should not be using, "Liberation", but "LiberationSans". That being the case, it was also not necessary to set the style to SansSerif, as that was the only style available for the "LiberationSans" font.



  • This post is deleted!

Log in to reply