Results 1 to 5 of 5

Thread: How to find the filepath to a font

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: How to find the filepath to a font

    Qt uses FontConfig to abstract away the management of actual font files, multiple font directories, substitutions, user preferences etc. AFAICT there is no way to obtain the underlying font file (*.ttf for example) through Qt.

    1. The directory returned by default is somewhere you can place fonts and FontConfig will generally find them. It is "~/.fonts" on my machines. If it does not exist that FontConfig path is simply ignored. See /etc/fonts/fonts.conf or the equivalent on your machine to see where FontConfig looks for fonts.
    2. As the docs say, rawName() returns an empty string if FontConfig is in use, and XLFD string otherwise. It does not return a file path.

    Why do you need to do this?

  2. The following user says thank you to ChrisW67 for this useful post:

    Markus (13th November 2013)

Similar Threads

  1. QFontDatabase:Cannot find font directory
    By soumya in forum Qt for Embedded and Mobile
    Replies: 9
    Last Post: 10th November 2014, 06:08
  2. Replies: 2
    Last Post: 16th October 2013, 11:56
  3. unable to find font when placed under lib/font dir
    By menkey18 in forum Qt Programming
    Replies: 6
    Last Post: 14th December 2012, 07:45
  4. QFileInfo::filePath and std::ofstream
    By TorAn in forum Qt Programming
    Replies: 1
    Last Post: 2nd December 2010, 00:55
  5. Find font files
    By kovid in forum Qt Programming
    Replies: 0
    Last Post: 8th June 2008, 22:59

Tags for this Thread

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
  •  
Qt is a trademark of The Qt Company.