Table of Contents

Class Font

Namespace
Aspose.Imaging
Assembly
Aspose.Imaging.dll

Defines a particular format for text, including font face, size, and style attributes. This class cannot be inherited.

public sealed class Font
Inheritance
Font
Inherited Members

Constructors

Font(Font, FontStyle)

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

public Font(Font prototype, FontStyle newStyle)

Parameters

prototype Font

The existing Font from which to create the new Font.

newStyle FontStyle

The FontStyle to apply to the new Font. Multiple values of the FontStyle enumeration can be combined with the OR operator.

Exceptions

ArgumentNullException

prototype is null.

Font(string, float)

Initializes a new Font using a specified size. The character set is set to Default, the graphics unit to Point, the font style to Regular.

public Font(string fontName, float emSize)

Parameters

fontName string

A string representation of the Font name.

emSize float

The em-size, in points, of the new font.

Exceptions

ArgumentOutOfRangeException

emSize is less than or equal to 0, evaluates to infinity or is not a valid number.

ArgumentNullException

fontName is null.

Font(string, float, FontStyle)

Initializes a new Font using a specified size and style. The character set is set to Default, the graphics unit to Point.

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

Parameters

fontName string

A string representation of the Font name.

emSize float

The em-size, in points, of the new font.

style FontStyle

The FontStyle of the new font.

Exceptions

ArgumentOutOfRangeException

emSize is less than or equal to 0, evaluates to infinity or is not a valid number.

ArgumentNullException

fontName is null.

Font(string, float, FontStyle, GraphicsUnit)

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

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

Parameters

fontName string

A string representation of the Font name.

emSize float

The em-size of the new font in the units specified by the unit parameter.

style FontStyle

The FontStyle of the new font.

unit GraphicsUnit

The GraphicsUnit of the new font.

Exceptions

ArgumentOutOfRangeException

emSize is less than or equal to 0, evaluates to infinity or is not a valid number.

ArgumentNullException

fontName is null.

Font(string, float, FontStyle, GraphicsUnit, CharacterSet)

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

public Font(string fontName, float emSize, FontStyle style, GraphicsUnit unit, CharacterSet characterSet)

Parameters

fontName string

A string representation of the Font name.

emSize float

The em-size of the new font in the units specified by the unit parameter.

style FontStyle

The FontStyle of the new font.

unit GraphicsUnit

The GraphicsUnit of the new font.

characterSet CharacterSet

A character set to use for this font.

Exceptions

ArgumentOutOfRangeException

emSize is less than or equal to 0, evaluates to infinity or is not a valid number.

ArgumentNullException

fontName is null.

Font(string, float, GraphicsUnit)

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

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

Parameters

fontName string

A string representation of the Font name.

emSize float

The em-size of the new font in the units specified by the unit parameter.

unit GraphicsUnit

The GraphicsUnit of the new font.

Exceptions

ArgumentOutOfRangeException

emSize is less than or equal to 0, evaluates to infinity or is not a valid number.

ArgumentNullException

fontName is null.

Properties

Bold

Gets a value indicating whether this Font is bold.

public bool Bold { get; }

Property Value

bool

True if this Font is bold; otherwise, false.

CharacterSet

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

public CharacterSet CharacterSet { get; }

Property Value

CharacterSet

A character set that this Font uses.

Italic

Gets a value indicating whether this Font is italic.

public bool Italic { get; }

Property Value

bool

True if this Font is italic; otherwise, false.

Name

Gets the face name of this Font.

public string Name { get; }

Property Value

string

A string representation of the face name of this Font.

Size

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

public float Size { get; }

Property Value

float

The em-size of this Font.

Strikeout

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

public bool Strikeout { get; }

Property Value

bool

True if this Font has a horizontal line through it; otherwise, false.

Style

Gets style information for this Font.

public FontStyle Style { get; }

Property Value

FontStyle

A FontStyle enumeration that contains style information for this Font.

Underline

Gets a value indicating whether this Font is underlined.

public bool Underline { get; }

Property Value

bool

True if this Font is underlined; otherwise, false.

Unit

Gets the unit of measure for this Font.

public GraphicsUnit Unit { get; }

Property Value

GraphicsUnit

A GraphicsUnit that represents the unit of measure for this Font.

Methods

DeepClone()

Creates an exact deep copy of this Font.

public Font DeepClone()

Returns

Font

The Font this method creates.

Equals(object)

Indicates whether the specified object is a Font and has the same property values as this Font.

public override bool Equals(object obj)

Parameters

obj object

The object to test.

Returns

bool

True if the obj parameter is a Font and has the same property values as this Font; otherwise, false.

GetHashCode()

Gets the hash code for this Font.

public override int GetHashCode()

Returns

int

The hash code for this Font.

ToString()

Returns a human-readable string representation of this Font.

public override string ToString()

Returns

string

A string that represents this Font.