从文件加载字体在C#应用程序 [英] Load fonts from file on a C# application

查看:321
本文介绍了从文件加载字体在C#应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想加载和使用的字体在C#中的桌面应用程序。这是可能的,而不在系统上安装的字体?

I wish to load and use a font to a desktop application in C#. It's that possible without installing the font on the system?

这是一个各种问题如但不能从DLL。我想从字体文件加载。

It's a kind of question like this but not from a DLL. I want to load from font file.

推荐答案

有一类System.Drawing.Text.PrivateFontCollection在System.Drawing.dll程序,可以针对每个应用程序的基础管理字体。

There's a class System.Drawing.Text.PrivateFontCollection in System.Drawing.dll which can manage fonts on a per application basis.

你要做的就是您在应用程序内维持此集合,你通过AddFontFile或AddMemoryFont添加字体,然后你就可以使用该字体,如果它被安装在系统上。

All you do is that you maintain this collection within your app and you add fonts through AddFontFile or AddMemoryFont and you'll then be able to use that font as if it was installed on your system.

这就像安装的字体仅用于申请。一旦这个过程结束的字体将被卸载。

It's like installing the font for the application only. The font will be uninstalled once the process terminates.

这篇关于从文件加载字体在C#应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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