如何加载自定义字体以在Windows Azure上绘制图像?

我需要使用自定义字体在我自己的应用程序上绘图。

是否可以通过部署脚本进行安装?

如何在Web应用程序中管理自定义字体(system.drawing)

应该可以将字体文件存储在磁盘或数据库中,然后使用PrivateFontCollection类在运行时使用字体。

以下是如何使用它:

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:\Downloads\actest.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); } 

干杯。