Accumulates font and other text rendering settings. It also provides functionality for retrieving font metrics, and other font-related information.
Namespace:
Aurigma.GraphicsMill.Drawing
Assembly:
Aurigma.GraphicsMill (in Aurigma.GraphicsMill.dll)
public sealed class Font : IDisposable
You can use this class for two intentions.
If you need to know how much room a text string with given settings will occupy use the MeasureString(String, Font) method.
using (var bitmap = new Bitmap(300, 30, PixelFormat.Format24bppRgb, RgbColor.White))
{
using (var graphics = bitmap.GetGraphics())
{
//Draw text
var font = new Font("Futura Md BT", 20);
font.Bold = false;
font.Italic = true;
font.Underline = true;
font.Strikeout = false;
font.HorizontalAlignment = HorizontalAlignment.Center;
var brush = new SolidBrush(RgbColor.Red);
graphics.DrawString("Sample text", font, brush, 150, 0);
bitmap.Save(@"Images\Output\string.png");
}
}