public final class Font extends Object implements com.aspose.ms.System.IDisposable
Defines a particular format for text, including font face, size, and style attributes. This class cannot be inherited.
| Constructor and Description |
|---|
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(Font prototype,
int newStyle)
|
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. |
| Modifier and Type | Method and Description |
|---|---|
Font |
deepClone()
Creates an exact copy of this
Font. |
void |
dispose()
Releases all resources used by this
Font. |
boolean |
equals(Object obj)
Indicates whether the specified object is a
Font and has the same FontFamily(Font.getFontFamily()),
M:GdiVerticalFont, M:GdiCharSet, M:Style, M:Size,
and M:Unit property values as this Font. |
boolean |
getBold()
Gets a value indicating whether this
Font is bold. |
int |
getCharacterSet()
Gets a byte value that specifies the character set that this
Font uses. |
FontFamily |
getFontFamily()
|
byte |
getGdiCharSet()
Gets a byte value that specifies the GDI character set that this
Font uses. |
boolean |
getGdiVerticalFont()
Gets a value indicating whether this
Font is derived from a GDI vertical font.. |
int |
getHeight_Rename_Namesake()
Gets the line spacing of this font.
|
int |
getHeight()
Returns the line spacing, in pixels, of this font.
|
int |
getHeight(float dpi)
Returns the height, in pixels, of this
Font when drawn to a device with the specified vertical resolution. |
float |
getHeight(Graphics graphics)
Returns the line spacing, in the current unit of a specified
Graphics, of this font. |
boolean |
getItalic()
Gets a value indicating whether this
Font is italic. |
String |
getName()
Gets the face name of this
Font. |
String |
getOriginalFontName()
Gets the name of the font originally specified.
|
float |
getSize()
Gets the em-size of this
Font measured in the units specified by the
Font.Unit property. |
float |
getSizeInPoints()
Gets the em-size, in points, of this
Font. |
boolean |
getStrikeout()
Gets a value indicating whether this
Font specifies a horizontal line through the font. |
int |
getStyle()
Gets style information for this
Font. |
String |
getSystemFontName()
Gets the name of the system font if the IsSystemFont property returns true.
|
boolean |
getUnderline()
Gets a value indicating whether this
Font is underlined. |
int |
getUnit()
Gets the unit of measure for this
Font. |
int |
hashCode()
Gets the hash code for this
Font. |
boolean |
isSystemFont()
Gets a value indicating whether the font is a member of
SystemFonts. |
String |
toString()
Returns a human-readable string representation of this
Font. |
public Font(Font prototype, int newStyle)
public Font(FontFamily family, float emSize)
Initializes a new instance of the Font class.
family - The FontFamily(Font.getFontFamily()) of the new Font.emSize - The em-size, in points, of the new font.public Font(FontFamily family, float emSize, int style)
Initializes a new instance of the Font class using a specified size and style..
family - The FontFamily(Font.getFontFamily()) of the new Font.emSize - The em-size, in points, of the new font.style - The FontStyle of the new font.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.
family - The FontFamily(Font.getFontFamily()) of the new Font.emSize - The em-size of the new font in the units specified by the unit parameter.style - The FontStyle of the new font.unit - The GraphicsUnit of the new font.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..
family - The FontFamily(Font.getFontFamily()) of the new Font.emSize - The em-size of the new font in the units specified by the unit parameter.style - The FontStyle of the new font.unit - The GraphicsUnit of the new font.gdiCharSet - GDI character set to use for the new font.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..
family - The FontFamily(Font.getFontFamily()) of the new Font.emSize - The em-size of the new font in the units specified by the unit parameter.style - The FontStyle of the new font.unit - The GraphicsUnit of the new font.gdiCharSet - GDI character set to use for the new font.gdiVerticalFont - A Boolean value indicating whether the new font is derived from a GDI vertical font.public Font(String familyName, float emSize)
Initializes a new instance of the Font class using a specified size.
familyName - A string representation of the FontFamily for the new Font.emSize - The em-size, in points, of the new font.public Font(String familyName, float emSize, int style)
Initializes a new instance of the Font class using a specified size and style.
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.
familyName - A string representation of the FontFamily(Font.getFontFamily()) for the new Font.emSize - The em-size of the new font in the units specified by the unit parameter.style - The FontStyle of the new font.unit - The GraphicsUnit of the new font.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.
familyName - A string representation of the FontFamily for the new Font.emSize - The em-size of the new font in the units specified by the unit parameter.style - The FontStyle of the new font.unit - The GraphicsUnit of the new font.gdiCharSet - A byte that specifies a GDI character set to use for this font.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.
familyName - A string representation of the FontFamily for the new Font.emSize - The em-size of the new font in the units specified by the unit parameter.style - The FontStyle of the new font.unit - The GraphicsUnit of the new font.gdiCharSet - A byte that specifies a GDI character set to use for this font.gdiVerticalFont - A Boolean value indicating whether the new Font is derived from a GDI vertical font.public FontFamily getFontFamily()
Gets the FontFamily(Font.getFontFamily()) associated with this Font.
FontFamily(Font.getFontFamily()) associated with this Font.public boolean getBold()
Gets a value indicating whether this Font is bold.
Font is bold.public byte getGdiCharSet()
Gets a byte value that specifies the GDI character set that this Font uses.
Font uses.public boolean getGdiVerticalFont()
Gets a value indicating whether this Font is derived from a GDI vertical font..
true if this Font is derived from a GDI vertical font; otherwise, false.Font is derived from a GDI vertical font.public boolean getItalic()
Gets a value indicating whether this Font is italic.
Font is italic.public String getName()
Gets the face name of this Font.
Font.public boolean getStrikeout()
Gets a value indicating whether this Font specifies a horizontal line through the font.
Font specifies a horizontal line through the font.public boolean getUnderline()
Gets a value indicating whether this Font is underlined.
Font is underlined.public int getStyle()
Gets style information for this Font.
Font.public float getSize()
Gets the em-size of this Font measured in the units specified by the
Font.Unit property.
Font measured in the units specified by the
{@code Font.public float getSizeInPoints()
Gets the em-size, in points, of this Font.
Font.public int getUnit()
Gets the unit of measure for this Font.
Font.public int getHeight_Rename_Namesake()
Gets the line spacing of this font.
Value: The line spacing, in pixels, of this font.public boolean isSystemFont()
Gets a value indicating whether the font is a member of SystemFonts.
true if the font is a member of SystemFonts; otherwise, false.SystemFonts.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 ("").public String getOriginalFontName()
Gets the name of the font originally specified.
Value: The string representing the name of the font originally specified.public boolean equals(Object obj)
Indicates whether the specified object is a Font and has the same FontFamily(Font.getFontFamily()),
M:GdiVerticalFont, M:GdiCharSet, M:Style, M:Size,
and M:Unit property values as this Font.
equals in class Objectobj - The object to test.true if the obj parameter is a Font and has the same FontFamily(Font.getFontFamily()),
M:GdiVerticalFont, M:GdiCharSet, M:Style, M:Size,
and M:Unit property values as this Font; otherwise, false.public int hashCode()
Gets the hash code for this Font.
public int 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.
graphics - A Graphics that holds the vertical resolution, in dots per inch, of the display device as well as settings for page unit and page scale.public int getHeight(float dpi)
Returns the height, in pixels, of this Font when drawn to a device with the specified vertical resolution.
dpi - The vertical resolution, in dots per inch, used to calculate the height of the font.Font.public void dispose()
Releases all resources used by this Font.
dispose in interface com.aspose.ms.System.IDisposablepublic int getCharacterSet()
Gets a byte value that specifies the character set that this Font uses.
Font uses.Copyright (c) 2008-2025 Aspose Pty Ltd. All Rights Reserved.