How to add barcode font (Code128.ttf and Code39.ttf) to application?
-
Hello,
is it possible to add Code128.ttf and Code39.ttf to my Qt application? I am using Qt5.12.7.
For example I want to show a text as code128 or code39 barcode in a label.
But at the moment I am not able to load the fonts.
I tried it withQFontDatabase::addApplicationFont(":/fonts/code128.ttf");
and with
FontLoader { id: code128font source: "qrc:/fonts/code128.ttf" }
But it didn't work. I always get an error, that font could not be loaded.
Any suggestions?
-
Hi,
Does it work if you use the full path to the font file ?
What value does the call to addApplicationFont return ?
On which OS are you running your application ? -
Yes, when I add one font and use the full path it works.
But I want to add the ttf files to my ressources and use it with a relative path.
Is that possbile?
At the moment the ttf files are located in a sub folder in the application folder.
Then I added the files to qrc file and use the path from there.For information:
I am developing on Ubuntu 18.04. Then the application is cross compiled and runs raspbian buster. -
Are you sure your paths are correct with regard to your folder structure ?
Did you set any alias in the qrc file ?