使用 Qt5 在 Windows 上使用 FreeType [英] Use FreeType on Windows with Qt5

查看:125
本文介绍了使用 Qt5 在 Windows 上使用 FreeType的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有谁知道是否可以使用 FreeType 构建 Qt5 作为 Windows 上的文本渲染器而不是本机渲染器?我尝试使用 -qt-freetype 编译 Qt5,但我仍然收到错误的文本.我还需要做些什么吗?

Does anyone know if it's possible to build Qt5 with FreeType as the text renderer on Windows instead of the native one? I tried compiling Qt5 with -qt-freetype but I still get bad text. Do I have to do something else?

推荐答案

在看 DeadWarlock 提出的解决方案时,我研究了 Qt 源代码,发现 QWindowsFontDatabaseFT 是在 d->m_options & 时创建和使用的.QWindowsIntegration::FontDatabaseFreeTypetrue.经过一番谷歌搜索后,我发现打开此选项是 Qt 中的官方记录.该选项可以通过创建文件 qt.conf 来打开.该文件必须位于包含应用程序可执行文件的目录中,并且必须包含以下内容:

When looking at the solution proposed by DeadWarlock I studied the Qt source code and realized that QWindowsFontDatabaseFT is created and used when d->m_options & QWindowsIntegration::FontDatabaseFreeType is true. After a bit of googling I found out that turning this option on is officially documented in Qt. The option can be turned on by creating file qt.conf. The file must be located in the directory containing the application executable and must contain following content:

[Platforms]
WindowsArguments = fontengine=freetype

完成此操作后,我无需重新编译 Qt 即可获得自由类型渲染.

After doing this I got freetype rendering without recompiling of Qt.

这篇关于使用 Qt5 在 Windows 上使用 FreeType的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆