Using Freetype2 with Qt on Windows and Mac.



  • Hi all,

    I'm creating a cross-platform desktop application works with font. I need to use Freetype2 library on Windows and Mac to use its FT_Face_GetVariantsOfChar function.
    The problem is FT_Face only accept a font_file_path to create a new FT_Face.
    Currently I hard-coded the font_file_path but I want to create a new FT_Face:

    • from a QFont object: QFont::freetypeFace() only supported on X11 and some Embedded Linux platforms, not Windows and Mac.
    • by a font_file_path returned by QFont or anything from Qt.

    I tried to get font_file_name from HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts and append to C:\Windows\Fonts directory on Windows, but when my locale is Japanese, Meiryo's font name is メイリオ so this solution is not fine.
    On Mac, problem is font files are stored in different location: System/Library/Fonts, Library/Fonts, ~/Library/Fonts. I have no idea with this.

    I read Qt source code on QFontDatabase to learn how to get all system fonts but no luck.

    Any help is appreciated, thank you!


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.