|
fop 2.0 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.fop.fonts.FontInfo
public class FontInfo
The FontInfo holds font information for the layout and rendering of a fo document.
This stores the list of available fonts that are setup by
the renderer. The font name can be retrieved for the
family style and weight.
Currently font supported font-variant small-caps is not
implemented.
Field Summary | |
---|---|
protected static org.apache.commons.logging.Log |
log
logging instance |
Constructor Summary | |
---|---|
FontInfo()
Main constructor |
Method Summary | |
---|---|
void |
addFontProperties(java.lang.String internalFontKey,
FontTriplet triplet)
Adds a new font triplet. |
void |
addFontProperties(java.lang.String name,
java.lang.String[] families,
java.lang.String style,
int weight)
Adds a series of new font triplets given an array of font family names. |
void |
addFontProperties(java.lang.String name,
java.lang.String family,
java.lang.String style,
int weight)
Adds a new font triplet. |
void |
addMetrics(java.lang.String internalFontKey,
FontMetrics metrics)
Adds font metrics for a specific font. |
static FontTriplet |
createFontKey(java.lang.String family,
java.lang.String style,
int weight)
Creates a key from the given strings. |
void |
dumpAllTripletsToSystemOut()
Diagnostic method for logging all registered fonts to System.out. |
FontTriplet |
findAdjustWeight(java.lang.String family,
java.lang.String style,
int weight)
Find a font with a given family and style by trying different font weights according to the spec. |
FontTriplet[] |
fontLookup(java.lang.String[] families,
java.lang.String style,
int weight)
Looks up a set of fonts. |
FontTriplet |
fontLookup(java.lang.String family,
java.lang.String style,
int weight)
Lookup a font. |
Font |
getFontInstance(FontTriplet triplet,
int fontSize)
Retrieves a (possibly cached) Font instance based on a FontTriplet and a font size. |
Font |
getFontInstanceForAWTFont(java.awt.Font awtFont)
Returns a suitable internal font given an AWT Font instance. |
java.util.Map<java.lang.String,Typeface> |
getFonts()
Gets a Map of all registered fonts. |
java.lang.String |
getFontStyleFor(java.lang.String fontName)
Returns the font style for a particular font. |
java.util.Map<FontTriplet,java.lang.String> |
getFontTriplets()
Gets a Map of all registered font triplets. |
int |
getFontWeightFor(java.lang.String fontName)
Returns the font weight for a particular font. |
java.lang.String |
getInternalFontKey(FontTriplet triplet)
Returns the internal font key (F1, F2, F3 etc.) for a given triplet. |
FontMetrics |
getMetricsFor(java.lang.String fontName)
Returns the FontMetrics for a particular font |
FontTriplet |
getTripletFor(java.lang.String fontName)
Returns the first triplet matching the given font name. |
java.util.List<FontTriplet> |
getTripletsFor(java.lang.String fontName)
Returns all font triplet matching the given font name. |
java.util.Map<java.lang.String,Typeface> |
getUsedFonts()
This is used by the renderers to retrieve all the fonts used in the document. |
boolean |
hasFont(java.lang.String family,
java.lang.String style,
int weight)
Determines if a particular font is available. |
boolean |
isSetupValid()
Checks if the font setup is valid (At least the ultimate fallback font must be registered.) |
void |
notifyStrokingSVGTextAsShapes(java.lang.String fontFamily)
Notify listeners that the SVG text for the given font will be stroked as shapes. |
void |
setEventListener(FontEventListener listener)
Sets the font event listener that can be used to receive events about particular events in this class. |
java.lang.String |
toString()
|
void |
useFont(java.lang.String internalName)
Tells this class that the font with the given internal name has been used. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected static final org.apache.commons.logging.Log log
Constructor Detail |
---|
public FontInfo()
Method Detail |
---|
public void setEventListener(FontEventListener listener)
listener
- the font event listenerpublic boolean isSetupValid()
public void addFontProperties(java.lang.String name, java.lang.String family, java.lang.String style, int weight)
name
- internal keyfamily
- font family namestyle
- font style (normal, italic, oblique...)weight
- font weightpublic void addFontProperties(java.lang.String name, java.lang.String[] families, java.lang.String style, int weight)
name
- internal keyfamilies
- an array of font family namesstyle
- font style (normal, italic, oblique...)weight
- font weightpublic void addFontProperties(java.lang.String internalFontKey, FontTriplet triplet)
internalFontKey
- internal font keytriplet
- the font triplet to associate with the internal keypublic void addMetrics(java.lang.String internalFontKey, FontMetrics metrics)
internalFontKey
- internal keymetrics
- metrics to registerpublic void useFont(java.lang.String internalName)
internalName
- the internal font name (F1, F2 etc.)public Font getFontInstance(FontTriplet triplet, int fontSize)
triplet
- the font triplet designating the requested fontfontSize
- the font size
public Font getFontInstanceForAWTFont(java.awt.Font awtFont)
awtFont
- the AWT font
public FontTriplet fontLookup(java.lang.String family, java.lang.String style, int weight)
family
- font familystyle
- font styleweight
- font weight
public FontTriplet[] fontLookup(java.lang.String[] families, java.lang.String style, int weight)
families
- font families (priority list)style
- font styleweight
- font weight
public void notifyStrokingSVGTextAsShapes(java.lang.String fontFamily)
fontFamily
- a SVG font familypublic FontTriplet findAdjustWeight(java.lang.String family, java.lang.String style, int weight)
family
- font familystyle
- font styleweight
- font weight
public boolean hasFont(java.lang.String family, java.lang.String style, int weight)
family
- font familystyle
- font styleweight
- font weight
public java.lang.String getInternalFontKey(FontTriplet triplet)
triplet
- the font triplet
public static FontTriplet createFontKey(java.lang.String family, java.lang.String style, int weight)
family
- font familystyle
- font styleweight
- font weight
public java.util.Map<java.lang.String,Typeface> getFonts()
public java.util.Map<FontTriplet,java.lang.String> getFontTriplets()
public java.util.Map<java.lang.String,Typeface> getUsedFonts()
public FontMetrics getMetricsFor(java.lang.String fontName)
fontName
- internal key
public java.util.List<FontTriplet> getTripletsFor(java.lang.String fontName)
fontName
- The font name we are looking for
public FontTriplet getTripletFor(java.lang.String fontName)
fontName
- The font name we are looking for
public java.lang.String getFontStyleFor(java.lang.String fontName)
fontName
- internal key
public int getFontWeightFor(java.lang.String fontName)
fontName
- internal key
public void dumpAllTripletsToSystemOut()
public java.lang.String toString()
toString
in class java.lang.Object
|
fop 2.0 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |