|
|

楼主 |
发表于 2006-4-3 15:10:00
|
显示全部楼层
Re:请问如何使用游戏自带的字体来输出文字?
多谢“逆火十三”兄,你的方法是正解。
另外,再贴一点小弟在网上查到的东东,希望对与小弟有同样困扰的朋友有所帮助:
(http://www.faq-it.org/archives/mfc_basic/0280ae657d4370fad78af25244eced7a.php)
使用应该是这样的:
1.使用 AddFontResource 把您的字体送入 Windows 字体列表。
2.使用 SendMessage(HWND_BROADCAST,WM_FONTCHANGE,0,0) 广播通知。
3.这时候开始,您的字体才可以随意使用。
4.使用 RemoveFontResource 从 Windows 字体列表删除您的字体。
5.SendMessage(HWND_BROADCAST,WM_FONTCHANGE,0,0) 再通知一遍。
===============================
如果是使用资源中的字体,应该:
To install unique hidden font resources follow these steps:
1、Copy the TrueType font file to a temporary file with a unique filename such as "ttfont01.ttf" that can be owned by the instance of the application.
2、Call the CreateScalableFontResource() function to create a uniquely named temporary hidden font resource file that can also be owned by the instance of the application.
3、Call the AddFontResource() function to install this uniquely named font resource file for this instance of the application.
4、Use the font in the application as desired.
5、When the instance of the application terminates or is otherwise finished with the font file, it should uninstall the font resource by calling the RemoveFontResource() function until it fails.
6、Lastly, the instance of the application should delete the temporary font resource file and the temporary TrueType font file that it created.
CreateScalableFontResource 为一种TureType字体创建一个资源文件,以便能用API函数AddFontResource将其加入Windows系统 ! |
|