View Full Version : Help!! cannot load Fonts!
gattogio
23rd February 2007, 10:56
Hi,
I'm using Qt 4.2 on Linux (Gentoo)...
When i try to do
int id = QFontDatabase::addApplicationFontFromData( myFont );
or
int id = QFontDatabase::addApplicationFont( "/../fonts/myFont.ttf" );
it always returns -1....
Any suggestion to resolve the problem???
aamer4yu
23rd February 2007, 11:47
are u using the correct path ?? may be it is not able to find the font....
also in the docs its written
int QFontDatabase::addApplicationFont ( const QString & fileName ) [static]
.....
Note: Adding application fonts on Unix/X11 platforms without fontconfig is currently not supported.
This function was introduced in Qt 4.2.
hope this might help u little
i am not sure what fontconfig is :(...
gattogio
23rd February 2007, 13:55
Yes,
i have fontconfig installed and the font path is surely correct!
wysota
23rd February 2007, 18:14
int id = QFontDatabase::addApplicationFont( "/../fonts/myFont.ttf" );
Are you sure "/../fonts/myFont.ttf" is a correct path? It starts with a slash which means the root of the filesystem tree... maybe it should be "../fonts/myFont.ttf"?
gattogio
24th February 2007, 12:22
"/../fonts/myFont.ttf" is an example Path! the real path is surely correct.
All the code is 100% correct.
I think my problem depends on linux font configuration.. but I don't know how to fix it. I have fontconfig installed, but don't know how it works and if it works, and don't know what i can check...
wysota
24th February 2007, 14:37
If your text is antialiased then fontconfig probably works correctly. You can additionally verify if Qt is linked against fontconfig (use ldd).
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.