Results 1 to 6 of 6

Thread: Help!! cannot load Fonts!

  1. #1
    Join Date
    Feb 2007
    Posts
    7
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Question Help!! cannot load Fonts!

    Hi,
    I'm using Qt 4.2 on Linux (Gentoo)...
    When i try to do

    Qt Code:
    1. int id = QFontDatabase::addApplicationFontFromData( myFont );
    To copy to clipboard, switch view to plain text mode 

    or

    Qt Code:
    1. int id = QFontDatabase::addApplicationFont( "/../fonts/myFont.ttf" );
    To copy to clipboard, switch view to plain text mode 

    it always returns -1....

    Any suggestion to resolve the problem???

  2. #2
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Thanks
    8
    Thanked 334 Times in 317 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Help!! cannot load Fonts!

    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 ...

  3. #3
    Join Date
    Feb 2007
    Posts
    7
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Help!! cannot load Fonts!

    Yes,
    i have fontconfig installed and the font path is surely correct!

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Help!! cannot load Fonts!

    Quote Originally Posted by gattogio View Post
    Qt Code:
    1. int id = QFontDatabase::addApplicationFont( "/../fonts/myFont.ttf" );
    To copy to clipboard, switch view to plain text mode 
    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"?

  5. #5
    Join Date
    Feb 2007
    Posts
    7
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Question Re: Help!! cannot load Fonts!

    "/../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...

  6. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Help!! cannot load Fonts!

    If your text is antialiased then fontconfig probably works correctly. You can additionally verify if Qt is linked against fontconfig (use ldd).

Similar Threads

  1. How to improve fonts in designer ?
    By probine in forum Qt Tools
    Replies: 3
    Last Post: 25th October 2006, 20:38
  2. Fonts, Colors, and QStyle
    By Jimmy2775 in forum Qt Programming
    Replies: 1
    Last Post: 28th September 2006, 07:26
  3. Replies: 2
    Last Post: 13th September 2006, 09:11
  4. Replies: 4
    Last Post: 7th March 2006, 08:52
  5. Why I can't load .framework libraries on Mac X?
    By gtthang in forum Qt Programming
    Replies: 0
    Last Post: 17th February 2006, 11:32

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.