Class Font
Namespace: Aspose.Imaging
Assembly: Aspose.Imaging.dll (25.2.0)
Defines a particular format for text, including font face, size, and style attributes. This class cannot be inherited.
[JsonObject(MemberSerialization.OptIn)]
public sealed class Font
Inheritance
Inherited Members
object.GetType(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()
Constructors
Font(Font, FontStyle)
Initializes a new Aspose.Imaging.Font that uses the specified existing Aspose.Imaging.Font and Aspose.Imaging.FontStyle enumeration.
public Font(Font prototype, FontStyle newStyle)
Parameters
prototype
Font
The existing Aspose.Imaging.Font from which to create the new Aspose.Imaging.Font.
newStyle
FontStyle
The Aspose.Imaging.FontStyle to apply to the new Aspose.Imaging.Font. Multiple values of the Aspose.Imaging.FontStyle enumeration can be combined with the OR operator.
Exceptions
prototype
is null.
Font(string, float)
Initializes a new Aspose.Imaging.Font using a specified size. The character set is set to Aspose.Imaging.CharacterSet.Default, the graphics unit to Aspose.Imaging.GraphicsUnit.Point, the font style to Aspose.Imaging.FontStyle.Regular.
public Font(string fontName, float emSize)
Parameters
fontName
string
A string representation of the Aspose.Imaging.Font name.
emSize
float
The em-size, in points, of the new font.
Exceptions
emSize
is less than or equal to 0, evaluates to infinity or is not a valid number.
fontName
is null.
Font(string, float, FontStyle)
Initializes a new Aspose.Imaging.Font using a specified size and style. The character set is set to Aspose.Imaging.CharacterSet.Default, the graphics unit to Aspose.Imaging.GraphicsUnit.Point.
public Font(string fontName, float emSize, FontStyle style)
Parameters
fontName
string
A string representation of the Aspose.Imaging.Font name.
emSize
float
The em-size, in points, of the new font.
style
FontStyle
The Aspose.Imaging.FontStyle of the new font.
Exceptions
emSize
is less than or equal to 0, evaluates to infinity or is not a valid number.
fontName
is null.
Font(string, float, GraphicsUnit)
Initializes a new Aspose.Imaging.Font using a specified size and unit. The character set is set to Aspose.Imaging.CharacterSet.Default, the style is set to Aspose.Imaging.FontStyle.Regular.
public Font(string fontName, float emSize, GraphicsUnit unit)
Parameters
fontName
string
A string representation of the Aspose.Imaging.Font name.
emSize
float
The em-size of the new font in the units specified by the unit
parameter.
unit
GraphicsUnit
The Aspose.Imaging.GraphicsUnit of the new font.
Exceptions
emSize
is less than or equal to 0, evaluates to infinity or is not a valid number.
fontName
is null.
Font(string, float, FontStyle, GraphicsUnit, CharacterSet)
Initializes a new Aspose.Imaging.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 Aspose.Imaging.Font name.
emSize
float
The em-size of the new font in the units specified by the unit
parameter.
style
FontStyle
The Aspose.Imaging.FontStyle of the new font.
unit
GraphicsUnit
The Aspose.Imaging.GraphicsUnit of the new font.
characterSet
CharacterSet
A character set to use for this font.
Exceptions
emSize
is less than or equal to 0, evaluates to infinity or is not a valid number.
fontName
is null.
Font(string, float, FontStyle, GraphicsUnit)
Initializes a new Aspose.Imaging.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 Aspose.Imaging.Font name.
emSize
float
The em-size of the new font in the units specified by the unit
parameter.
style
FontStyle
The Aspose.Imaging.FontStyle of the new font.
unit
GraphicsUnit
The Aspose.Imaging.GraphicsUnit of the new font.
Exceptions
emSize
is less than or equal to 0, evaluates to infinity or is not a valid number.
fontName
is null.
Properties
Bold
Gets a value indicating whether this Aspose.Imaging.Font is bold.
public bool Bold { get; }
Property Value
CharacterSet
Gets a byte value that specifies the character set that this Aspose.Imaging.Font uses.
public CharacterSet CharacterSet { get; }
Property Value
Italic
Gets a value indicating whether this Aspose.Imaging.Font is italic.
public bool Italic { get; }
Property Value
Name
Gets the face name of this Aspose.Imaging.Font.
public string Name { get; }
Property Value
Size
Gets the em-size of this Aspose.Imaging.Font measured in the units specified by the Aspose.Imaging.Font.Unit property.
public float Size { get; }
Property Value
Strikeout
Gets a value indicating whether this Aspose.Imaging.Font specifies a horizontal line through the font.
public bool Strikeout { get; }
Property Value
Style
Gets style information for this Aspose.Imaging.Font.
public FontStyle Style { get; }
Property Value
Underline
Gets a value indicating whether this Aspose.Imaging.Font is underlined.
public bool Underline { get; }
Property Value
Unit
Gets the unit of measure for this Aspose.Imaging.Font.
public GraphicsUnit Unit { get; }
Property Value
Methods
DeepClone()
Creates an exact deep copy of this Aspose.Imaging.Font.
public Font DeepClone()
Returns
The Aspose.Imaging.Font this method creates.
Equals(object)
Indicates whether the specified object is a Aspose.Imaging.Font and has the same property values as this Aspose.Imaging.Font.
public override bool Equals(object obj)
Parameters
obj
object
The object to test.
Returns
True if the obj
parameter is a Aspose.Imaging.Font and has the same property values as this Aspose.Imaging.Font; otherwise, false.
GetHashCode()
Gets the hash code for this Aspose.Imaging.Font.
public override int GetHashCode()
Returns
The hash code for this Aspose.Imaging.Font.
ToString()
Returns a human-readable string representation of this Aspose.Imaging.Font.
public override string ToString()
Returns
A string that represents this Aspose.Imaging.Font.