7

TTF フォント ファイルをロードする必要がある OpenSuse 11.4 で開発した Qt 組み込みアプリケーションがあります。ただし、int QFontDatabase::addApplicationFont()関数を呼び出すと、 が返され-1ます。

ドキュメントを読んだところ、fontconfig を使用しない Unix/X11 プラットフォームでのアプリケーション フォントの追加は現在サポートされていないことがわかりました。

fontconfigがインストールされているかどうかをYaSTで確認しましたが、インストールされていますが、qt組み込みライブラリを使用しているため、関連しているとは思いません。fontconfig で qt-embedded ライブラリをサポートする必要があると考えていますが、どうすればよいですか?

fontconfig は qt-embedded もサポートしていますか? 誰が何が起こっているのか教えてもらえますか?

4

1 に答える 1

5

You can use QPA or Qt Platform Abstraction (formerly known as Lighthouse). You need to create an implementation (could be made as a plugin or just being used directly) of QPlatformIntegration which exposes a custom QPlatformFontDatabase. The trick here is to reuse much of Qt's existing implementation of QFontconfigDatabase (which is just as subclass of QBasicUnixFontDatabase).

This is exactly the technique we use for PhantomJS so that it works headlessly (without X11) on Linux while still leveraging Fontconfig (and thus also FreeType) for text rendering.

Unfortunately I think Qt 4.5 is too old to run Lighthouse. Either move to 4.8 which officialy supports QPA or try to backport Lighthouse.

于 2012-12-25T03:21:31.463 に答える