Is there a way of using QPF2 font format on Desktop application?
-
I want to use a font, but i don't know what font it is.The only thing I have is a qpf2 file.
I have try QFontDatabase::addApplicationFont() which return -1.
I also set QT_QPA_FONTDIR, but QFontDatabase.families() still did not include it.
Any suggestions are appreciated
qpf2 file -
Hi and welcome to devnet,
Which version of Qt are you using ?
On which platform ?More information on the format can be found here.
@SGaist Thank you for your reply.
I have tried 2 versions, same result.
win11 + QT4.8.7
ubuntu20.04 LTS + QT5.12.12int fontId=QFontDatabase::addApplicationFont("/home/nut/Desktop/Vera.ttf"); qDebug() << fontId; //output 0int fontId=QFontDatabase::addApplicationFont("/home/nut/Desktop/ds.qpf2"); qDebug() << fontId; //output -1It can load ttf font, but can't load qpf2 font.
On win11, I place qpf2 font into D:\Qt_\4.8.7\lib\fonts, don't work.
On Ubuntu, $QTDIR/lib/fonts don't exist, so I create it, dont' work too.I know QPF2 is designed for Qt for Embedded Linux.
Since Embedded Linux can load qpf2, I think a more complete linux , ubuntu should also work. -
@SGaist Thank you for your reply.
I have tried 2 versions, same result.
win11 + QT4.8.7
ubuntu20.04 LTS + QT5.12.12int fontId=QFontDatabase::addApplicationFont("/home/nut/Desktop/Vera.ttf"); qDebug() << fontId; //output 0int fontId=QFontDatabase::addApplicationFont("/home/nut/Desktop/ds.qpf2"); qDebug() << fontId; //output -1It can load ttf font, but can't load qpf2 font.
On win11, I place qpf2 font into D:\Qt_\4.8.7\lib\fonts, don't work.
On Ubuntu, $QTDIR/lib/fonts don't exist, so I create it, dont' work too.I know QPF2 is designed for Qt for Embedded Linux.
Since Embedded Linux can load qpf2, I think a more complete linux , ubuntu should also work.Since it's explicitly stated as a Qt for Embedded Linux feature, my educated guess is that the support for it will only be built if you do such a Qt build.