Print with your own font using C#


To print your own font in C#, firstly construct −

  • FontFamily object
  • Font Object

The FontFamily object sets the typeface like Arial, TimesNewRoman, etc, whereas the Font object sets the size and style of font.

Let us create an Arial font style.

FontFamily myFontFamily = new FontFamily("Arial");
Font myFont = new Font(
myFontFamily,
20,
FontStyle.Bold,
GraphicsUnit.Pixel);

Above, we have set the FontFamily object. The first parameter passed to the Font() is the FontFamily object “myFontFamily”, then comes the size of the font. The third argument sets the style.

Updated on: 21-Jun-2020

257 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements