<PackageReference Include="System.Drawing.Common" Version="9.0.6" />

Font

Defines a particular format for text, including font face, size, and style attributes. This class cannot be inherited.
public bool Bold { get; }

Gets a value that indicates whether this Font is bold.

public FontFamily FontFamily { get; }

Gets the FontFamily associated with this Font.

public byte GdiCharSet { get; }

Gets a byte value that specifies the GDI character set that this Font uses.

public bool GdiVerticalFont { get; }

Gets a Boolean value that indicates whether this Font is derived from a GDI vertical font.

public int Height { get; }

Gets the line spacing of this font.

public bool IsSystemFont { get; }

Gets a value indicating whether the font is a member of SystemFonts.

public bool Italic { get; }

Gets a value that indicates whether this font has the italic style applied.

public string Name { get; }

Gets the face name of this Font.

public string OriginalFontName { get; }

Gets the name of the font originally specified.

public float Size { get; }

Gets the em-size of this Font measured in the units specified by the Unit property.

public float SizeInPoints { get; }

Gets the em-size, in points, of this Font.

public bool Strikeout { get; }

Gets a value that indicates whether this Font specifies a horizontal line through the font.

public FontStyle Style { get; }

Gets style information for this Font.

public string SystemFontName { get; }

Gets the name of the system font if the IsSystemFont property returns true.

public bool Underline { get; }

Gets a value that indicates whether this Font is underlined.

public GraphicsUnit Unit { get; }

Gets the unit of measure for this Font.

public Font(Font prototype, FontStyle newStyle)

Initializes a new Font that uses the specified existing Font and FontStyle enumeration.

public Font(FontFamily family, float emSize)

Initializes a new Font using a specified size.

public Font(FontFamily family, float emSize, FontStyle style)

Initializes a new Font using a specified size and style.

public Font(FontFamily family, float emSize, FontStyle style, GraphicsUnit unit)

Initializes a new Font using a specified size, style, and unit.

public Font(FontFamily family, float emSize, FontStyle style, GraphicsUnit unit, byte gdiCharSet)

Initializes a new Font using a specified size, style, unit, and character set.

public Font(FontFamily family, float emSize, FontStyle style, GraphicsUnit unit, byte gdiCharSet, bool gdiVerticalFont)

Initializes a new Font using a specified size, style, unit, and character set.

public Font(FontFamily family, float emSize, GraphicsUnit unit)

Initializes a new Font using a specified size and unit. Sets the style to Regular.

public Font(string familyName, float emSize)

Initializes a new Font using a specified size.

public Font(string familyName, float emSize, FontStyle style)

Initializes a new Font using a specified size and style.

public Font(string familyName, float emSize, FontStyle style, GraphicsUnit unit)

Initializes a new Font using a specified size, style, and unit.

public Font(string familyName, float emSize, FontStyle style, GraphicsUnit unit, byte gdiCharSet)

Initializes a new Font using a specified size, style, unit, and character set.

public Font(string familyName, float emSize, FontStyle style, GraphicsUnit unit, byte gdiCharSet, bool gdiVerticalFont)

Initializes a new Font using the specified size, style, unit, and character set.

public Font(string familyName, float emSize, GraphicsUnit unit)

Initializes a new Font using a specified size and unit. The style is set to Regular.

public static Font FromHdc(IntPtr hdc)

Creates a Font from the specified Windows handle to a device context.

public static Font FromHfont(IntPtr hfont)

Creates a Font from the specified Windows handle.

public static Font FromLogFont(object lf)

Creates a Font from the specified GDI logical font (LOGFONT) structure.

public static Font FromLogFont(object lf, IntPtr hdc)

Creates a Font from the specified GDI logical font (LOGFONT) structure.

public object Clone()

Creates an exact copy of this Font.

public void Dispose()

Releases all resources used by this Font.

public float GetHeight()

Returns the line spacing, in pixels, of this font.

public float GetHeight(Graphics graphics)

Returns the line spacing, in the current unit of a specified Graphics, of this font.

public float GetHeight(float dpi)

Returns the height, in pixels, of this Font when drawn to a device with the specified vertical resolution.

public IntPtr ToHfont()

Returns a handle to this Font.

public void ToLogFont(object logFont)

Creates a GDI logical font (LOGFONT) structure from this Font.

public void ToLogFont(object logFont, Graphics graphics)

Creates a GDI logical font (LOGFONT) structure from this Font.