3

I'm trying to use qrc file (Qt Creator 2.7 & Mac OS X) to manage my resources but it won't work... Here's the path of my font copy/pasted from Copy Resource Path to Clipboard :

:/fonts/data/Arial.ttf

Here's the part where I use it :

TTF_Font *font = TTF_OpenFont(":/fonts/data/Arial.ttf", 100);

And here's the result :

Error (Font) : Couldn't open :/fonts/test

But if I use the absolute path to the font, it works so the problem is not from TTF_OpenFont()

4

1 回答 1

2

TTF_OpenFont对 Qt 的资源系统一无所知,因此无法打开文件。

您可以使用 读取资源文件中的字体文件内容QFile,然后将其保存到磁盘的某个临时文件中,然后使用 . 打开该文件TTF_OpenFont

于 2013-05-22T17:31:21.480 回答