Search code examples
c#font-face

Font Problem in .NET 4


i am developing a simple application on .NET 4 visual studio 2010. i am using default font microsoft san serif. but i am was writing in bangla (unicode) for label button text. but my development pc show everyting correctly. but when i install this program on other computer then font not showing correct format only some rectangle showing.

in client pc i also install bangla writing softare also.

Thanks Tonmoy


Solution

  • If you're writing a WinForms application you can load the font into a private collection. Check out this question. If you do that then the font will always be available to your app.

    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.