如何在我的 C# 应用程序中嵌入字体?(使用 Visual Studio 2005) [英] How do I Embed a font with my C# application? (using Visual Studio 2005)
问题描述
在我正在开发的应用程序中嵌入 truetype 字体的最佳方法是什么?基本上,我想确保在另一台机器上安装时,我的应用程序可以使用特定的字体.我有 *.ttf 字体文件,只需要一种嵌入它或在应用程序运行时自动安装它的方法.
What is the best way to embed a truetype font within the application i'm developing? Basically i want to make sure a particular font is available to my application when installed on another machine. I have the *.ttf font file and just need a way of embedding it or automatically installing it when the application is run.
我是否需要在安装过程中设置安装程序来安装字体,或者我可以在应用程序运行时动态加载字体吗?事实上,两者都很好知道.
Do i need to set the installation program to install the font during installation or can i dynamically load the font during runtime of the application? In fact both would be nice to know.
正在使用 .NET 2.0 用 C# 开发应用程序.
The application is being developed in C# using .NET 2.0.
推荐答案
这个博客帖子应该对你有帮助.
基本上,您将字体添加为嵌入资源,然后将其加载到 PrivateFontCollection 对象.
Basically you add the font as an embedded resource then load it into a PrivateFontCollection object.
这篇关于如何在我的 C# 应用程序中嵌入字体?(使用 Visual Studio 2005)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!