Package chemaxon.struc.graphics
Class MFont
java.lang.Object
chemaxon.struc.graphics.MFont
- All Implemented Interfaces:
Serializable,Cloneable
Font wrapper class that does not require an X server.
- Since:
- Marvin 4.1, 11/29/2005
- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionclone()Creates a clone.Creates a clone.booleanTests whether two font objects equal.Gets an AWT font instance.Gets the font family name.getScaledAWTFont(Float scale) Gets an AWT font instance after scaling.doubleGets the font size.Gets the string representation.intgetStyle()Gets the font style.inthashCode()booleanisBold()Tests whether the font is bold.booleanisItalic()Tests whether the font is italic.static StringsizeToString(double size) Converts an integer or fractional size to a string.toString()
-
Field Details
-
PLAIN
public static final int PLAINPlain font style.- See Also:
-
BOLD
public static final int BOLDBold font style.- See Also:
-
ITALIC
public static final int ITALICItalic font style.- See Also:
-
-
Constructor Details
-
MFont
Contructs a font.- Parameters:
family- the familystyle- the stylesize- the size
-
MFont
Parses a font from a string.- Parameters:
str- the string to be converted- Throws:
IllegalArgumentException
-
MFont
Copy constructor.- Parameters:
f- the font to copy
-
MFont
Create a wrapper for the specified AWT font.- Parameters:
f- the AWT font
-
-
Method Details
-
getFamily
Gets the font family name.- Returns:
- the font family
-
getStyle
public int getStyle()Gets the font style.- Returns:
- the font style
-
getSizeDouble
public double getSizeDouble()Gets the font size.- Returns:
- the font size
-
isBold
public boolean isBold()Tests whether the font is bold.- Returns:
- true if the font is bold, false otherwise
-
isItalic
public boolean isItalic()Tests whether the font is italic.- Returns:
- true if the font is italic, false otherwise
-
getAWTFont
Gets an AWT font instance.- Returns:
- the AWT font
-
getScaledAWTFont
Gets an AWT font instance after scaling.- Parameters:
scale- the scaling factor- Returns:
- the AWT font
-
getString
Gets the string representation.- Returns:
- the string representation
-
equals
Tests whether two font objects equal. -
hashCode
public int hashCode() -
cloneMFont
Creates a clone.- Returns:
- the clone
-
clone
Creates a clone. -
sizeToString
Converts an integer or fractional size to a string.- Returns:
- the string
-
toString
-