Package chemaxon.struc.graphics
Class MFont
- java.lang.Object
-
- chemaxon.struc.graphics.MFont
-
- All Implemented Interfaces:
Serializable
,Cloneable
@PublicAPI public class MFont extends Object implements Serializable, Cloneable
Font wrapper class that does not require an X server.- Since:
- Marvin 4.1, 11/29/2005
- See Also:
- Serialized Form
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Object
clone()
Creates a clone.MFont
cloneMFont()
Creates a clone.boolean
equals(Object o)
Tests whether two font objects equal.Font
getAWTFont()
Gets an AWT font instance.String
getFamily()
Gets the font family name.Font
getScaledAWTFont(Float scale)
Gets an AWT font instance after scaling.double
getSizeDouble()
Gets the font size.String
getString()
Gets the string representation.int
getStyle()
Gets the font style.int
hashCode()
boolean
isBold()
Tests whether the font is bold.boolean
isItalic()
Tests whether the font is italic.static String
sizeToString(double size)
Converts an integer or fractional size to a string.String
toString()
-
-
-
Field Detail
-
PLAIN
public static final int PLAIN
Plain font style.- See Also:
- Constant Field Values
-
BOLD
public static final int BOLD
Bold font style.- See Also:
- Constant Field Values
-
ITALIC
public static final int ITALIC
Italic font style.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
MFont
public MFont(String family, int style, double size)
Contructs a font.- Parameters:
family
- the familystyle
- the stylesize
- the size
-
MFont
public MFont(String str) throws IllegalArgumentException
Parses a font from a string.- Parameters:
str
- the string to be converted- Throws:
IllegalArgumentException
-
MFont
public MFont(MFont f)
Copy constructor.- Parameters:
f
- the font to copy
-
MFont
public MFont(Font f)
Create a wrapper for the specified AWT font.- Parameters:
f
- the AWT font
-
-
Method Detail
-
getFamily
public String 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
public Font getAWTFont()
Gets an AWT font instance.- Returns:
- the AWT font
-
getScaledAWTFont
public Font getScaledAWTFont(Float scale)
Gets an AWT font instance after scaling.- Parameters:
scale
- the scaling factor- Returns:
- the AWT font
-
getString
public String getString()
Gets the string representation.- Returns:
- the string representation
-
equals
public boolean equals(Object o)
Tests whether two font objects equal.
-
cloneMFont
public MFont cloneMFont()
Creates a clone.- Returns:
- the clone
-
sizeToString
public static String sizeToString(double size)
Converts an integer or fractional size to a string.- Returns:
- the string
-
-