【问题标题】:FreeType font path WindowsFreeType 字体路径 Windows
【发布时间】:2014-10-06 11:37:42
【问题描述】:

我正在努力使用 Windows 和 FreeType2。我正在关注教程,以下显示为示例代码:

  FT_Library  library;   /* handle to library     */
  FT_Face     face;      /* handle to face object */


  error = FT_Init_FreeType( &library );
  if ( error ) { ... }

  error = FT_New_Face(library, "/usr/share/fonts/truetype/arial.ttf", 0, &face ); // <-- this does not exist...
  if ( error == FT_Err_Unknown_File_Format )
  {
    ... the font file could be opened and read, but it appears
    ... that its font format is unsupported
  }
  else if ( error )
  {
    ... another error code means that the font file could not
    ... be opened or read, or simply that it is broken...
  }

这个 /usr/share/fonts/truetype/arial.ttf 根本不存在,我怎样才能让 Arial 字体与它一起使用。

【问题讨论】:

  • 当然不行——/usr/ 是 POSIX 风格的路径,而不是 Windows。
  • 您可以在c:\windows\fonts\ 下找到它(顺便说一句,硬编码同样是错误的:您应该从系统 API 获取路径),除非您有例如Cygwin 设置在那里反映它们?我认为答案只是您的平台的路径是错误的。为什么需要 FreeType?不能只在 Windows 上使用 Windows 字体 API 吗?
  • 由于在项目中使用 FreeType,我需要该路径(文档稀缺)。所以我现在在黑暗中拍摄!谢谢!

标签: c++ c++11 freetype freetype2


【解决方案1】:

它因系统而异。检查FOLDERID_Fonts。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2011-10-05
    • 1970-01-01
    • 2014-09-03
    • 2021-09-23
    • 1970-01-01
    • 2011-11-16
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多