I need to use custom fonts for drawing on my own application.
Is it possible to install by deployment scripts?
How to manage custom fonts in web application (system.drawing)
It should be possible to store your font files on disk or in database, and then use the PrivateFontCollection class to use the fonts at runtime. Here is how you would use it:
It should be possible to store your font files on disk or in database, and then use the PrivateFontCollection class to use the fonts at runtime.
Here is how you would use it:
PrivateFontCollection collection = new PrivateFontCollection(); // Add the custom font families. // (Alternatively use AddMemoryFont if you have the font in memory, retrieved from a database). collection.AddFontFile(@"E:Downloadsactest.ttf"); using (var g = Graphics.FromImage(bm)) { // Create a font instance based on one of the font families in the PrivateFontCollection Font f = new Font(collection.Families.First(), 16); g.DrawString("Hello fonts", f, Brushes.White, 50, 50); }
Cheers.
1.4m articles
1.4m replys
5 comments
57.0k users