在delphi中嵌入字体 [英] Embedding a font in delphi

查看:198
本文介绍了在delphi中嵌入字体的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一种需要特定条形码字体的应用程序,这种字体不大可能在用户的PC上。

I'm working on an app that requires a particular barcode true type font that is unlikely to be on the user's PC.

我可以以某种方式将字体嵌入到应用程序中,还是需要使用安装程序来安装字体?

Can I somehow embed the font in the app, or do I need to use the installer to install the font?

推荐答案

是的,您可以将其作为资源保存在EXE文件中,而在用户的PC上,可以使用TResourceStream实例将其解压缩为文件。然后,您可以致电 AddFontResource API函数。最后,您应该向系统中的所有顶级窗口发送WM_FONTCHANGE消息(MSDN网站中的AddFontResource描述的检查备注部分)。

Yes, you can save it as a resource in the EXE file, and on user's pc, you can extract it as a file using a TResourceStream instance. Then you can call AddFontResource API function. At last, you should send a WM_FONTCHANGE message to all top-level windows in the system (Check Remark section of AddFontResource description in MSDN website).

如果您需要一个示例代码,请通知我。

If you need an example code, let me know.

这篇关于在delphi中嵌入字体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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