public class RMFont extends RMObject
Modifier and Type | Field and Description |
---|---|
static byte |
BOLD |
static RMFont |
Helvetica10 |
static RMFont |
Helvetica12 |
static RMFont |
Helvetica14 |
static byte |
ITALIC |
static byte |
PLAIN |
Constructor and Description |
---|
RMFont()
Creates an empty font (really only used for unarchival).
|
Modifier and Type | Method and Description |
---|---|
java.awt.Font |
awt()
Returns the AWT font for this font.
|
boolean |
canDisplay(char aChar)
Returns if this font can display the given char.
|
float |
charAdvance(char aChar)
Returns the char advance for the given char.
|
RMRect |
charBounds(char aChar)
Returns the bounds for a given character.
|
float |
charKern(char aChar1,
char aChar2)
Returns the kerning for the given pair of characters (no way to do this in Java!).
|
RMPath |
charPath(char c)
Returns the path for a given character.
|
static RMFont |
defaultFont()
Returns the user's default font.
|
RMFont |
deriveFont(float aPointSize)
Returns a font with the same family as the receiver but with the given size.
|
boolean |
equals(java.lang.Object anObj)
Standard equals implementation.
|
java.lang.Object |
fromXML(RXArchiver anArchiver,
RXElement anElement)
XML unarchival.
|
static java.util.List |
getAltFonts()
Returns the list of suggested alternate fonts.
|
RMFont |
getBold()
Returns the bold version of this font.
|
java.lang.String |
getFamily()
Returns the family name of this font.
|
java.lang.String |
getFamilyEnglish()
Returns the family name of this font in English.
|
static RMFont |
getFont(java.lang.String aName,
float aSize)
Returns the font for the given name and size (substitutes Arial if not found).
|
static RMFont |
getFont(java.lang.String aName,
float aSize,
boolean substitute)
Returns the font for the given name and size (with an option to substitue Arial if not found).
|
RMFontFile |
getFontFile()
Returns the font file for this font.
|
java.lang.String |
getFontName()
Returns the name of this font.
|
java.lang.String |
getFontNameEnglish()
Returns the name of this font in English.
|
float |
getHeight()
Returns the height of this font.
|
RMFont |
getItalic()
Returns the italic version of this font.
|
float |
getLeading()
Returns the default distance between lines for this font.
|
float |
getLineHeight()
Returns the height for a line of text in this font.
|
float |
getMaxAscent()
Returns the max distance above the baseline that this font goes.
|
float |
getMaxDescent()
Returns the max distance below the baseline that this font goes.
|
java.lang.String |
getPSName()
Returns the PostScript name of this font.
|
float |
getSize2D()
Returns the font size of this font.
|
float |
getStrikethroughOffset()
Returns the distance above the baseline that a strikethrough should be drawn.
|
float |
getUnderlineOffset()
Returns the distance below the baseline that an underline should be drawn.
|
float |
getUnderlineThickness()
Returns the default thickness that an underline should be drawn.
|
java.lang.Object |
initWithArchiver(RMArchiver anArchiver)
Legacy unarchival.
|
boolean |
isBold()
Returns whether this font is considered bold.
|
boolean |
isItalic()
Returns whether this font is considered italic.
|
float |
stringAdvance(java.lang.String aString)
Returns the horizontal distance spanned by the given string when rendered in this font.
|
int |
style()
Returns the awt style of this font.
|
java.lang.String |
toString()
Returns the font name, size and family for this font.
|
RXElement |
toXML(RXArchiver anArchiver)
XML archival.
|
clone, copy, didChange, didUndo, getAnimAttribute, getClassNameShort, undoClone, undoCopy, undoEquals
public static final byte PLAIN
public static final byte BOLD
public static final byte ITALIC
public static RMFont Helvetica10
public static RMFont Helvetica12
public static RMFont Helvetica14
public static RMFont getFont(java.lang.String aName, float aSize)
public static RMFont getFont(java.lang.String aName, float aSize, boolean substitute)
public static RMFont defaultFont()
public java.awt.Font awt()
public java.lang.String getFontName()
public java.lang.String getFontNameEnglish()
public float getSize2D()
public java.lang.String getFamily()
public java.lang.String getFamilyEnglish()
public java.lang.String getPSName()
public RMFontFile getFontFile()
public float charAdvance(char aChar)
public float charKern(char aChar1, char aChar2)
public RMPath charPath(char c)
public RMRect charBounds(char aChar)
public float stringAdvance(java.lang.String aString)
public float getMaxAscent()
public float getMaxDescent()
public float getLeading()
public float getHeight()
public float getLineHeight()
public float getUnderlineOffset()
public float getUnderlineThickness()
public float getStrikethroughOffset()
public boolean isBold()
public boolean isItalic()
public int style()
public boolean canDisplay(char aChar)
public RMFont getBold()
public RMFont getItalic()
public RMFont deriveFont(float aPointSize)
public static java.util.List getAltFonts()
public boolean equals(java.lang.Object anObj)
equals
in class java.lang.Object
public java.lang.Object initWithArchiver(RMArchiver anArchiver)
initWithArchiver
in interface RMArchiver.Archiving
initWithArchiver
in class RMObject
public RXElement toXML(RXArchiver anArchiver)
public java.lang.Object fromXML(RXArchiver anArchiver, RXElement anElement)
public java.lang.String toString()
toString
in class java.lang.Object