Qt font not found in certain windows versions
-
wrote on 28 Jul 2020, 07:22 last edited by
Hello!
How exactly qrc qfonts are working?
In a specific pc QFontDatabase::addApplicationFont returns -1, otherwise it's working.
The font i am using is not in my windows and it's still working, so i guess qrc compile it into the executable, am i right here?
If that's the case, what can cause addApplicationFont to randomly not work?In the Qrc it's added as
<qresource prefix="[...]">
<file alias="[...]">[...]</file>
</qresource>Thank you!
-
Hi
Yes a qrc file is often compiled into the exe.
Im not sure why it would fail.Is pc that fails the same Windows version ?
-
wrote on 28 Jul 2020, 07:59 last edited by
Hello!
Thank you for the answer, it is a different a windows version (a Win10 enterprise), tho i don't see why would it matter if it's in the executable.
-
Hello!
Thank you for the answer, it is a different a windows version (a Win10 enterprise), tho i don't see why would it matter if it's in the executable.
@Melkon
Hi
It should not matter but just wondered if it might already have font or something like that to make addApplicationFont fail.Do you have access to the pc that fails for testing ?
-
wrote on 28 Jul 2020, 08:34 last edited by
So far it seems the app is working perfectly even without calling add application font, so maybe the solution will be to just remove it.
I can get access to that pc, tho it's a bit problematic. Thanks for the tip, i'll check if these fonts are already there or not.
-
So far it seems the app is working perfectly even without calling add application font, so maybe the solution will be to just remove it.
I can get access to that pc, tho it's a bit problematic. Thanks for the tip, i'll check if these fonts are already there or not.
@Melkon
Hi
Well, Windows will do font matching so if you ask for a given font, it will find one as close as possible if not a direct hit.
So in many cases, it works just fine.Im not sure how to debug this but i would also check on the pc, that the (embedded) font file can be found
#include <QFileInfo> bool fileExists(QString path) { QFileInfo check_file(path); return check_file.exists() && check_file.isFile(); }
Else im not sure what else could be the issue.
-
wrote on 28 Jul 2020, 09:37 last edited by
Okay, thank you very much!
6/7