Load fonts from file on a C# application

后端 未结 2 977
旧巷少年郎
旧巷少年郎 2020-12-03 05:02

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?

It\'s a kind of question like this but n

相关标签:
2条回答
  • 2020-12-03 05:33

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

    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.

    0 讨论(0)
  • 2020-12-03 05:47

    Load a font from disk, stream or byte array

    Try this...

    The blog describes how to use the FontCollection classes.

    0 讨论(0)
提交回复
热议问题