Not able do use a different font for the Application



  • I want to change the default (fixed_120_50.qpf) font with a special font, I created myself. It's a .bdf file.

    I build makeqpf and used it to convert my .bdf file into a .qpf2 file, added the .qpf2 file in the $QT_DIR/lib/font folder.

    But now the application only displays a invalid square. Is there something that I'm missing?

    Note: I had to remove all the default files in $QT_DIR/lib/font, to make anything show up.
    Also: Is .qpf compatible with .qpf2? How can I convert a .qpf2 file to .qpf?

    Thanks in advance



  • Are you trying to set a default font to your Qt application ? Then try this,

        int loadedFontID = QFontDatabase::addApplicationFont("<Your custom font pathname (TTF/PFA/PFB/BDF/QPF)>");
        QStringList loadedFontFamilies = QFontDatabase::applicationFontFamilies(loadedFontID);
        fontName = loadedFontFamilies.value(0);
        QFont font;
        font.setFamily(fontName);
        app.setFont(font);

Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.