Font

Inheritance: java.lang.Object

All Implemented Interfaces: com.aspose.ms.System.IDisposable

public final class Font implements System.IDisposable

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

Constructors

ConstructorDescription
Font(Font prototype, int newStyle)Initializes a new instance of the Font class uses the specified existing Font and FontStyle enumeration..
Font(FontFamily family, float emSize)Initializes a new instance of the Font class.
Font(FontFamily family, float emSize, int style)Initializes a new instance of the Font class using a specified size and style..
Font(FontFamily family, float emSize, int style, int unit)Initializes a new instance of the Font class using a specified size, style, and unit.
Font(FontFamily family, float emSize, int style, int unit, byte gdiCharSet)Initializes a new instance of the Font class using a specified size, style, unit, and character set..
Font(FontFamily family, float emSize, int style, int unit, byte gdiCharSet, boolean gdiVerticalFont)Initializes a new instance of the Font class using a specified size, style, unit, and character set..
Font(String familyName, float emSize)Initializes a new instance of the Font class using a specified size.
Font(String familyName, float emSize, int style)Initializes a new instance of the Font class using a specified size and style.
Font(String familyName, float emSize, int style, int unit)Initializes a new instance of the Font class using a specified size, style, and unit.
Font(String familyName, float emSize, int style, int unit, byte gdiCharSet)Initializes a new instance of the Font class using a specified size, style, unit, and character set.
Font(String familyName, float emSize, int style, int unit, byte gdiCharSet, boolean gdiVerticalFont)Initializes a new instance of the Font class using the specified size, style, unit, and character set.

Methods

MethodDescription
getFontFamily()Gets the FontFamily(.getFontFamily) associated with this Font.
getBold()Gets a value indicating whether this Font is bold.
getGdiCharSet()Gets a byte value that specifies the GDI character set that this Font uses.
getGdiVerticalFont()Gets a value indicating whether this Font is derived from a GDI vertical font..
getItalic()Gets a value indicating whether this Font is italic.
getName()Gets the face name of this Font.
getStrikeout()Gets a value indicating whether this Font specifies a horizontal line through the font.
getUnderline()Gets a value indicating whether this Font is underlined.
getStyle()Gets style information for this Font.
getSize()Gets the em-size of this Font measured in the units specified by the Font.Unit property.
getSizeInPoints()Gets the em-size, in points, of this Font.
getUnit()Gets the unit of measure for this Font.
getHeight_Rename_Namesake()Gets the line spacing of this font.
isSystemFont()Gets a value indicating whether the font is a member of SystemFonts.
getSystemFontName()Gets the name of the system font if the IsSystemFont property returns true.
getOriginalFontName()Gets the name of the font originally specified.
deepClone()Creates an exact copy of this Font.
equals(Object obj)Indicates whether the specified object is a Font and has the same FontFamily(.getFontFamily), M:GdiVerticalFont, M:GdiCharSet, M:Style, M:Size, and M:Unit property values as this Font.
hashCode()Gets the hash code for this Font.
getHeight()Returns the line spacing, in pixels, of this font.
getHeight(Graphics graphics)Returns the line spacing, in the current unit of a specified Graphics, of this font.
getHeight(float dpi)Returns the height, in pixels, of this Font when drawn to a device with the specified vertical resolution.
dispose()Releases all resources used by this Font.
toString()Returns a human-readable string representation of this Font.
getCharacterSet()Gets a byte value that specifies the character set that this Font uses.

Font(Font prototype, int newStyle)

public Font(Font prototype, int newStyle)

Initializes a new instance of the Font class uses the specified existing Font and FontStyle enumeration..

Parameters:

ParameterTypeDescription
prototypeFontThe existing Font from which to create the new Font.
newStyleintThe FontStyle to apply to the new Font. Multiple values of the FontStyle enumeration can be combined with the OR operator.

Font(FontFamily family, float emSize)

public Font(FontFamily family, float emSize)

Initializes a new instance of the Font class.

Parameters:

ParameterTypeDescription
familyFontFamilyThe FontFamily(.getFontFamily) of the new Font.
emSizefloatThe em-size, in points, of the new font.

Font(FontFamily family, float emSize, int style)

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

Initializes a new instance of the Font class using a specified size and style..

Parameters:

ParameterTypeDescription
familyFontFamilyThe FontFamily(.getFontFamily) of the new Font.
emSizefloatThe em-size, in points, of the new font.
styleintThe FontStyle of the new font.

Font(FontFamily family, float emSize, int style, int unit)

public Font(FontFamily family, float emSize, int style, int unit)

Initializes a new instance of the Font class using a specified size, style, and unit.

Parameters:

ParameterTypeDescription
familyFontFamilyThe FontFamily(.getFontFamily) of the new Font.
emSizefloatThe em-size of the new font in the units specified by the unit parameter.
styleintThe FontStyle of the new font.
unitintThe GraphicsUnit of the new font.

Font(FontFamily family, float emSize, int style, int unit, byte gdiCharSet)

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

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

Parameters:

ParameterTypeDescription
familyFontFamilyThe FontFamily(.getFontFamily) of the new Font.
emSizefloatThe em-size of the new font in the units specified by the unit parameter.
styleintThe FontStyle of the new font.
unitintThe GraphicsUnit of the new font.
gdiCharSetbyteGDI character set to use for the new font.

Font(FontFamily family, float emSize, int style, int unit, byte gdiCharSet, boolean gdiVerticalFont)

public Font(FontFamily family, float emSize, int style, int unit, byte gdiCharSet, boolean gdiVerticalFont)

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

Parameters:

ParameterTypeDescription
familyFontFamilyThe FontFamily(.getFontFamily) of the new Font.
emSizefloatThe em-size of the new font in the units specified by the unit parameter.
styleintThe FontStyle of the new font.
unitintThe GraphicsUnit of the new font.
gdiCharSetbyteGDI character set to use for the new font.
gdiVerticalFontbooleanA Boolean value indicating whether the new font is derived from a GDI vertical font.

Font(String familyName, float emSize)

public Font(String familyName, float emSize)

Initializes a new instance of the Font class using a specified size.

Parameters:

ParameterTypeDescription
familyNamejava.lang.StringA string representation of the FontFamily for the new Font.
emSizefloatThe em-size, in points, of the new font.

Font(String familyName, float emSize, int style)

public Font(String familyName, float emSize, int style)

Initializes a new instance of the Font class using a specified size and style.

Parameters:

ParameterTypeDescription
familyNamejava.lang.StringA string representation of the FontFamily for the new Font.
emSizefloatThe em-size, in points, of the new font.
styleintThe FontStyle of the new font.

Font(String familyName, float emSize, int style, int unit)

public Font(String familyName, float emSize, int style, int unit)

Initializes a new instance of the Font class using a specified size, style, and unit.

Parameters:

ParameterTypeDescription
familyNamejava.lang.StringA string representation of the FontFamily(.getFontFamily) for the new Font.
emSizefloatThe em-size of the new font in the units specified by the unit parameter.
styleintThe FontStyle of the new font.
unitintThe GraphicsUnit of the new font.

Font(String familyName, float emSize, int style, int unit, byte gdiCharSet)

public Font(String familyName, float emSize, int style, int unit, byte gdiCharSet)

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

Parameters:

ParameterTypeDescription
familyNamejava.lang.StringA string representation of the FontFamily for the new Font.
emSizefloatThe em-size of the new font in the units specified by the unit parameter.
styleintThe FontStyle of the new font.
unitintThe GraphicsUnit of the new font.
gdiCharSetbyteA byte that specifies a GDI character set to use for this font.

Font(String familyName, float emSize, int style, int unit, byte gdiCharSet, boolean gdiVerticalFont)

public Font(String familyName, float emSize, int style, int unit, byte gdiCharSet, boolean gdiVerticalFont)

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

Parameters:

ParameterTypeDescription
familyNamejava.lang.StringA string representation of the FontFamily for the new Font.
emSizefloatThe em-size of the new font in the units specified by the unit parameter.
styleintThe FontStyle of the new font.
unitintThe GraphicsUnit of the new font.
gdiCharSetbyteA byte that specifies a GDI character set to use for this font.
gdiVerticalFontbooleanA Boolean value indicating whether the new Font is derived from a GDI vertical font.

getFontFamily()

public FontFamily getFontFamily()

Gets the FontFamily(.getFontFamily) associated with this Font.

Returns: FontFamily - The FontFamily(.getFontFamily) associated with this Font.

getBold()

public boolean getBold()

Gets a value indicating whether this Font is bold.

Returns: boolean - a value indicating whether this Font is bold.

getGdiCharSet()

public byte getGdiCharSet()

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

Returns: byte - A byte value that specifies the GDI character set that this Font uses.

getGdiVerticalFont()

public boolean getGdiVerticalFont()

Gets a value indicating whether this Font is derived from a GDI vertical font..

Value: true if this Font is derived from a GDI vertical font; otherwise, false.

Returns: boolean - a value indicating whether this Font is derived from a GDI vertical font.

getItalic()

public boolean getItalic()

Gets a value indicating whether this Font is italic.

Returns: boolean - a value indicating whether this Font is italic.

getName()

public String getName()

Gets the face name of this Font.

Returns: java.lang.String - the face name of this Font.

getStrikeout()

public boolean getStrikeout()

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

Returns: boolean - a value indicating whether this Font specifies a horizontal line through the font.

getUnderline()

public boolean getUnderline()

Gets a value indicating whether this Font is underlined.

Returns: boolean - a value indicating whether this Font is underlined.

getStyle()

public int getStyle()

Gets style information for this Font.

Returns: int - style information for this Font.

getSize()

public float getSize()

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

Returns: float - the em-size of this Font measured in the units specified by the {@code Font.

getSizeInPoints()

public float getSizeInPoints()

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

Returns: float - The em-size, in points, of this Font.

getUnit()

public int getUnit()

Gets the unit of measure for this Font.

Returns: int - the unit of measure for this Font.

getHeight_Rename_Namesake()

public int getHeight_Rename_Namesake()

Gets the line spacing of this font.

Value: The line spacing, in pixels, of this font.

Returns: int - the line spacing of this font.

isSystemFont()

public boolean isSystemFont()

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

Value: true if the font is a member of SystemFonts; otherwise, false.

Returns: boolean - a value indicating whether the font is a member of SystemFonts.

getSystemFontName()

public String getSystemFontName()

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

Value: The name of the system font, if IsSystemFont returns true; otherwise, an empty string ("").

Returns: java.lang.String - the name of the system font if the IsSystemFont property returns true.

getOriginalFontName()

public String getOriginalFontName()

Gets the name of the font originally specified.

Value: The string representing the name of the font originally specified.

Returns: java.lang.String - the name of the font originally specified.

deepClone()

public Font deepClone()

Creates an exact copy of this Font.

Returns: Font - The Font this method creates, cast as an Object.

equals(Object obj)

public boolean equals(Object obj)

Indicates whether the specified object is a Font and has the same FontFamily(.getFontFamily), M:GdiVerticalFont, M:GdiCharSet, M:Style, M:Size, and M:Unit property values as this Font.

Parameters:

ParameterTypeDescription
objjava.lang.ObjectThe object to test.

Returns: boolean - true if the obj parameter is a Font and has the same FontFamily(.getFontFamily), M:GdiVerticalFont, M:GdiCharSet, M:Style, M:Size, and M:Unit property values as this Font; otherwise, false.

hashCode()

public int hashCode()

Gets the hash code for this Font.

Returns: int - The hash code for this Font.

getHeight()

public int getHeight()

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

Returns: int - The line spacing, in pixels, of this font.

getHeight(Graphics graphics)

public float getHeight(Graphics graphics)

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

Parameters:

ParameterTypeDescription
graphicsGraphicsA Graphics that holds the vertical resolution, in dots per inch, of the display device as well as settings for page unit and page scale.

Returns: float - The line spacing, in pixels, of this font.

getHeight(float dpi)

public int getHeight(float dpi)

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

Parameters:

ParameterTypeDescription
dpifloatThe vertical resolution, in dots per inch, used to calculate the height of the font.

Returns: int - The height, in pixels, of this Font.

dispose()

public void dispose()

Releases all resources used by this Font.

toString()

public String toString()

Returns a human-readable string representation of this Font.

Returns: java.lang.String - A string that represents this Font.

getCharacterSet()

public int getCharacterSet()

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

Returns: int - A character set that this Font uses.