Package com.reportmill.text
Class RMFont
- java.lang.Object
- 
- com.reportmill.base.RMObject
- 
- com.reportmill.text.RMFont
 
 
- 
- All Implemented Interfaces:
- RMArchiver.Archiving,- java.lang.Cloneable
 
 public class RMFont extends RMObject This class represents a font for use in rich text. Currently this is necessary because Java fonts are missing so much basic typographic information.
- 
- 
Field SummaryFields Modifier and Type Field Description static byteBOLDstatic RMFontHelvetica10static RMFontHelvetica12static RMFontHelvetica14static byteITALICstatic bytePLAIN
 - 
Constructor SummaryConstructors Constructor Description RMFont()Creates an empty font (really only used for unarchival).
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.awt.Fontawt()Returns the AWT font for this font.booleancanDisplay(char aChar)Returns if this font can display the given char.floatcharAdvance(char aChar)Returns the char advance for the given char.RMRectcharBounds(char aChar)Returns the bounds for a given character.floatcharKern(char aChar1, char aChar2)Returns the kerning for the given pair of characters (no way to do this in Java!).RMPathcharPath(char c)Returns the path for a given character.static RMFontdefaultFont()Returns the user's default font.RMFontderiveFont(float aPointSize)Returns a font with the same family as the receiver but with the given size.booleanequals(java.lang.Object anObj)Standard equals implementation.java.lang.ObjectfromXML(RXArchiver anArchiver, RXElement anElement)XML unarchival.static java.util.ListgetAltFonts()Returns the list of suggested alternate fonts.RMFontgetBold()Returns the bold version of this font.java.lang.StringgetFamily()Returns the family name of this font.java.lang.StringgetFamilyEnglish()Returns the family name of this font in English.static RMFontgetFont(java.lang.String aName, float aSize)Returns the font for the given name and size (substitutes Arial if not found).static RMFontgetFont(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).RMFontFilegetFontFile()Returns the font file for this font.java.lang.StringgetFontName()Returns the name of this font.java.lang.StringgetFontNameEnglish()Returns the name of this font in English.floatgetHeight()Returns the height of this font.RMFontgetItalic()Returns the italic version of this font.floatgetLeading()Returns the default distance between lines for this font.floatgetLineHeight()Returns the height for a line of text in this font.floatgetMaxAscent()Returns the max distance above the baseline that this font goes.floatgetMaxDescent()Returns the max distance below the baseline that this font goes.java.lang.StringgetPSName()Returns the PostScript name of this font.floatgetSize2D()Returns the font size of this font.floatgetStrikethroughOffset()Returns the distance above the baseline that a strikethrough should be drawn.floatgetUnderlineOffset()Returns the distance below the baseline that an underline should be drawn.floatgetUnderlineThickness()Returns the default thickness that an underline should be drawn.java.lang.ObjectinitWithArchiver(RMArchiver anArchiver)Legacy unarchival.booleanisBold()Returns whether this font is considered bold.booleanisItalic()Returns whether this font is considered italic.floatstringAdvance(java.lang.String aString)Returns the horizontal distance spanned by the given string when rendered in this font.intstyle()Returns the awt style of this font.java.lang.StringtoString()Returns the font name, size and family for this font.RXElementtoXML(RXArchiver anArchiver)XML archival.- 
Methods inherited from class com.reportmill.base.RMObjectclone, copy, didChange, didUndo, getAnimAttribute, getClassNameShort, undoClone, undoCopy, undoEquals
 
- 
 
- 
- 
- 
Field Detail- 
PLAINpublic static final byte PLAIN - See Also:
- Constant Field Values
 
 - 
BOLDpublic static final byte BOLD - See Also:
- Constant Field Values
 
 - 
ITALICpublic static final byte ITALIC - See Also:
- Constant Field Values
 
 - 
Helvetica10public static RMFont Helvetica10 
 - 
Helvetica12public static RMFont Helvetica12 
 - 
Helvetica14public static RMFont Helvetica14 
 
- 
 - 
Method Detail- 
getFontpublic static RMFont getFont(java.lang.String aName, float aSize) Returns the font for the given name and size (substitutes Arial if not found).
 - 
getFontpublic 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).
 - 
defaultFontpublic static RMFont defaultFont() Returns the user's default font.
 - 
awtpublic java.awt.Font awt() Returns the AWT font for this font.
 - 
getFontNamepublic java.lang.String getFontName() Returns the name of this font.
 - 
getFontNameEnglishpublic java.lang.String getFontNameEnglish() Returns the name of this font in English.
 - 
getSize2Dpublic float getSize2D() Returns the font size of this font.
 - 
getFamilypublic java.lang.String getFamily() Returns the family name of this font.
 - 
getFamilyEnglishpublic java.lang.String getFamilyEnglish() Returns the family name of this font in English.
 - 
getPSNamepublic java.lang.String getPSName() Returns the PostScript name of this font.
 - 
getFontFilepublic RMFontFile getFontFile() Returns the font file for this font.
 - 
charAdvancepublic float charAdvance(char aChar) Returns the char advance for the given char.
 - 
charKernpublic float charKern(char aChar1, char aChar2)Returns the kerning for the given pair of characters (no way to do this in Java!).
 - 
charPathpublic RMPath charPath(char c) Returns the path for a given character.
 - 
charBoundspublic RMRect charBounds(char aChar) Returns the bounds for a given character.
 - 
stringAdvancepublic float stringAdvance(java.lang.String aString) Returns the horizontal distance spanned by the given string when rendered in this font.
 - 
getMaxAscentpublic float getMaxAscent() Returns the max distance above the baseline that this font goes.
 - 
getMaxDescentpublic float getMaxDescent() Returns the max distance below the baseline that this font goes.
 - 
getLeadingpublic float getLeading() Returns the default distance between lines for this font.
 - 
getHeightpublic float getHeight() Returns the height of this font.
 - 
getLineHeightpublic float getLineHeight() Returns the height for a line of text in this font.
 - 
getUnderlineOffsetpublic float getUnderlineOffset() Returns the distance below the baseline that an underline should be drawn.
 - 
getUnderlineThicknesspublic float getUnderlineThickness() Returns the default thickness that an underline should be drawn.
 - 
getStrikethroughOffsetpublic float getStrikethroughOffset() Returns the distance above the baseline that a strikethrough should be drawn.
 - 
isBoldpublic boolean isBold() Returns whether this font is considered bold.
 - 
isItalicpublic boolean isItalic() Returns whether this font is considered italic.
 - 
stylepublic int style() Returns the awt style of this font.
 - 
canDisplaypublic boolean canDisplay(char aChar) Returns if this font can display the given char.
 - 
getBoldpublic RMFont getBold() Returns the bold version of this font.
 - 
getItalicpublic RMFont getItalic() Returns the italic version of this font.
 - 
deriveFontpublic RMFont deriveFont(float aPointSize) Returns a font with the same family as the receiver but with the given size.
 - 
getAltFontspublic static java.util.List getAltFonts() Returns the list of suggested alternate fonts.
 - 
equalspublic boolean equals(java.lang.Object anObj) Standard equals implementation.- Overrides:
- equalsin class- java.lang.Object
 
 - 
initWithArchiverpublic java.lang.Object initWithArchiver(RMArchiver anArchiver) Legacy unarchival.- Specified by:
- initWithArchiverin interface- RMArchiver.Archiving
- Overrides:
- initWithArchiverin class- RMObject
 
 - 
toXMLpublic RXElement toXML(RXArchiver anArchiver) XML archival.
 - 
fromXMLpublic java.lang.Object fromXML(RXArchiver anArchiver, RXElement anElement) XML unarchival.
 - 
toStringpublic java.lang.String toString() Returns the font name, size and family for this font.- Overrides:
- toStringin class- java.lang.Object
 
 
- 
 
-