Font resources for Qt Application - qt

I made an application by using Python and pyqt5. I have designed the interface with Qt Designer. I have used the Poppins from Google fonts as main fonts of the program.
The problem is that when I convert the program to .exe with pyinstaller and open in an other computers. If the Poppins font does not exist on that computer the program changes the fonts. How can I import the Poppins font in my programs' directory so that the program works with that font with correct font in other computers?

Related

qtwidgets no big font on beaglebone black

I managed to build and boot the tisdk-default-image-am335x-evm using 07.03.00.005.
I run some of the qt demo apps that are packaged into that image, and it looks good to me.
I created a simple qtwidgets app (cross-compiling on the host with qtcreator).
Just a mainwindow and a button that has a large font.
The app runs on the target, except the large font on the button shows up as a very small font.
I checked /usr/share/fonts/ttf on target, the font I used in the gui is there.
I managed to get font and font size right for the target.
It's not a yocto or install problem, it's how to use qtcreator.
I'm not sure if it is the preferred method but it works for my case.
I include the font as a resource in the qtcreator project and load it at application init, as show in the link below.
https://amin-ahmadi.com/2016/01/07/embedding-fonts-in-your-qt-app/
So, no dealing with installing fonts on target system.

Change fonts in Qt application on Windows10

I installed qt5 application (Mendeley Desktop) from here by using the instraller on windows10, and I don't like the default font; MS Gothic.
Is there some ways to change fonts in a qt5 application which I didn't build from source code?
Thanks in advance!
If they bundled the font into the application binary (via QRC), I'm afraid you can't.
Otherwise, you can check in the application installation folders if by any chance the font is loaded at runtime. In that case you just need to replace it (by keeping the original name) with your preferred one.
Same thing if they use the system font, but that would compromise all the other apps using MS Gothic.

Increase font size on target board using Qt for Embedded Linux

I'm developing with Qt for Embedded Linux and Qt 4.7.1 on Linux and I'm cross compiling for an ARM board with Digi som. On the Qt application that runs on the ARM board using Digi ESP for embedded Linux, I need some QLabels with large fonts (I set to 48pt on the QtDesigner).
However when I load the executable on the ARM board those fonts are not as large as I see them on the QtDesigner interface (and on my Linux PC), and even if I set a bigger font size, when I run the application on the board, the fonts have always the same size (as if it were reached a maximum font size or as if the font does not support that size).
I have tried everything from makeqpf (which does not compile) to build qt with freetype but nothing seems to work.
I set an environment variable called QWS_DISPLAY with it's dimensions on the target and that solved the problem. Thank you for the hint user12345

Custom font in Qt Creator IDE

I successfully installed Consolas font on my Ubuntu 12.04 LTE as described here. It looks great in my terminal app, but Qt Creator IDE does not suggest me to use Consolas in its text editor. More over Qt Creator doesn't see some other system fonts either, but in the same time it has some its own fonts, for example Utopia.
Does somebody know how to make available system fonts in Qt Creator or hardcode additional fonts in custom build of Qt Creator?
I have found a workaround. Qt Creator from Ubuntu Software Center looks very well and it found all my system fonts. The only drawback is that the latest available version there now is 2.5.

Qt: Safe Fonts for Cross Platform Desktop App

Just a thought: is there any resource somewhere with a list "safe-fonts" for a cross platform desktop Qt app that needs to run on windows, Mac and Linux (Ubuntu 10.* for instance).
and while we're on the subject, is there any way to "package" a font with the executable as part of the resources and have it run seamlessly in all three platforms?
I've never tried it but I think you can use addApplicationFont to load a font from a file. The file can be part of your app's resource.

Resources