public class RMFont extends java.lang.Object implements Archivable
Modifier and Type | Field and Description |
---|---|
static RMFont |
Helvetica10 |
static RMFont |
Helvetica12 |
static RMFont |
Helvetica14 |
Constructor and Description |
---|
RMFont()
Creates an empty font (really only used for unarchival).
|
RMFont(java.awt.Font aFont) |
RMFont(java.lang.String aName,
double aSize)
Deprecated.
|
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.
|
double |
charAdvance(char aChar)
Returns the char advance for the given char.
|
RMRect |
charBounds(char aChar)
Returns the bounds for a given character.
|
double |
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.
|
RMFont |
deriveFont(double 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.
|
RMFont |
getBold()
Returns the bold version of this font.
|
static RMFont |
getDefaultFont()
Returns the user's default 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.awt.Font aFont)
Returns the font for the given name and size (substitutes Arial if not found).
|
static RMFont |
getFont(java.lang.String aName,
double aSize)
Deprecated.
|
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.
|
int |
getFontStyle() |
double |
getHeight()
Returns the height of this font.
|
RMFont |
getItalic()
Returns the italic version of this font.
|
double |
getLeading()
Returns the default distance between lines for this font.
|
double |
getLineAdvance()
Returns the distance from the top of a line of text to the to top of a successive line of text.
|
double |
getLineHeight()
Returns the height for a line of text in this font.
|
java.lang.String |
getLogicalName() |
double |
getMaxAscent()
Returns the max distance above the baseline that this font goes.
|
double |
getMaxDescent()
Returns the max distance below the baseline that this font goes.
|
java.lang.String |
getPSName()
Returns the PostScript name of this font.
|
double |
getSize()
Returns the font size of this font.
|
double |
getStrikethroughOffset()
Returns the distance above the baseline that a strikethrough should be drawn.
|
double |
getUnderlineOffset()
Returns the distance below the baseline that an underline should be drawn.
|
double |
getUnderlineThickness()
Returns the default thickness that an underline should be drawn.
|
boolean |
isBold()
Returns whether this font is considered bold.
|
boolean |
isItalic()
Returns whether this font is considered italic.
|
boolean |
isSubstitute()
Returns whether font had to substitute because name wasn't found.
|
RMFont |
scaleFont(double aScale)
Returns a font with the same family as the receiver but with size adjusted by given scale factor.
|
double |
stringAdvance(java.lang.String aString)
Returns the horizontal distance spanned by the given string when rendered in this font.
|
RMFont |
toggleStyle(int style)
Returns a new RMFont with style toggled.
|
java.lang.String |
toString()
Returns the font name, size and family for this font.
|
RXElement |
toXML(RXArchiver anArchiver)
XML archival.
|
public static RMFont Helvetica10
public static RMFont Helvetica12
public static RMFont Helvetica14
public RMFont()
@Deprecated public RMFont(java.lang.String aName, double aSize)
public RMFont(@Nonnull java.awt.Font aFont)
@Deprecated public static RMFont getFont(java.lang.String aName, double aSize)
public static RMFont getFont(java.awt.Font aFont)
public static RMFont getDefaultFont()
public java.lang.String getFontName()
public java.lang.String getFontNameEnglish()
public java.lang.String getLogicalName()
public int getFontStyle()
public double getSize()
public java.lang.String getFamily()
public java.lang.String getFamilyEnglish()
public java.lang.String getPSName()
public RMFontFile getFontFile()
public double charAdvance(char aChar)
public double charKern(char aChar1, char aChar2)
public RMPath charPath(char c)
public RMRect charBounds(char aChar)
public double stringAdvance(@Nonnull java.lang.String aString)
public double getMaxAscent()
public double getMaxDescent()
public double getLeading()
public double getHeight()
public double getLineHeight()
public double getLineAdvance()
public double getUnderlineOffset()
public double getUnderlineThickness()
public double getStrikethroughOffset()
public boolean isBold()
public boolean isItalic()
public boolean isSubstitute()
public boolean canDisplay(char aChar)
@Nonnull public RMFont getBold()
@Nonnull public RMFont getItalic()
@Nonnull public RMFont toggleStyle(int style)
public RMFont deriveFont(double aPointSize)
public RMFont scaleFont(double aScale)
public boolean equals(java.lang.Object anObj)
equals
in class java.lang.Object
public RXElement toXML(RXArchiver anArchiver)
toXML
in interface Archivable
public java.lang.Object fromXML(RXArchiver anArchiver, RXElement anElement)
fromXML
in interface Archivable
public java.lang.String toString()
toString
in class java.lang.Object
public java.awt.Font awt()