Draw Text using Type1 font in C#
I create an application for Fon开发者_运维百科t Management and I have a problem with preview of Type1 fonts (.pfb and .pfm ext.). I need any solution how display a text using this font type.
To draw any font, you can use Graphics.DrawString
method:
System.Drawing.Font font;//initialize your font here.
using (Bitmap previewImage = new Bitmap(16, 16))
{
using (Graphics graphics = Graphics.FromImage(previewImage))
{
graphics.DrawString("text", font, Brushes.YellowGreen, location);
}
previewImage.Save(@"Your output file path");
}
精彩评论