public class FontInfo extends Object
Modifier and Type | Field and Description |
---|---|
protected static org.apache.commons.logging.Log |
log
logging instance
|
Constructor and Description |
---|
FontInfo()
Main constructor
|
Modifier and Type | Method and Description |
---|---|
void |
addFontProperties(String internalFontKey,
FontTriplet triplet)
Adds a new font triplet.
|
void |
addFontProperties(String name,
String[] families,
String style,
int weight)
Adds a series of new font triplets given an array of font family names.
|
void |
addFontProperties(String name,
String family,
String style,
int weight)
Adds a new font triplet.
|
void |
addMetrics(String internalFontKey,
FontMetrics metrics)
Adds font metrics for a specific font.
|
static FontTriplet |
createFontKey(String family,
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(String family,
String style,
int weight)
Find a font with a given family and style by trying
different font weights according to the spec.
|
FontTriplet[] |
fontLookup(String[] families,
String style,
int weight)
Looks up a set of fonts.
|
FontTriplet |
fontLookup(String family,
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(Font awtFont)
Returns a suitable internal font given an AWT Font instance.
|
Map<String,Typeface> |
getFonts()
Gets a Map of all registered fonts.
|
String |
getFontStyleFor(String fontName)
Returns the font style for a particular font.
|
Map<FontTriplet,String> |
getFontTriplets()
Gets a Map of all registered font triplets.
|
int |
getFontWeightFor(String fontName)
Returns the font weight for a particular font.
|
String |
getInternalFontKey(FontTriplet triplet)
Returns the internal font key (F1, F2, F3 etc.) for a given triplet.
|
FontMetrics |
getMetricsFor(String fontName)
Returns the FontMetrics for a particular font
|
FontTriplet |
getTripletFor(String fontName)
Returns the first triplet matching the given font name.
|
List<FontTriplet> |
getTripletsFor(String fontName)
Returns all font triplet matching the given font name.
|
Map<String,Typeface> |
getUsedFonts()
This is used by the renderers to retrieve all the
fonts used in the document.
|
boolean |
hasFont(String family,
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(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.
|
void |
useFont(String internalName)
Tells this class that the font with the given internal name has been used.
|
public void setEventListener(FontEventListener listener)
listener
- the font event listenerpublic boolean isSetupValid()
public void addFontProperties(String name, String family, String style, int weight)
name
- internal keyfamily
- font family namestyle
- font style (normal, italic, oblique...)weight
- font weightpublic void addFontProperties(String name, String[] families, String style, int weight)
name
- internal keyfamilies
- an array of font family namesstyle
- font style (normal, italic, oblique...)weight
- font weightpublic void addFontProperties(String internalFontKey, FontTriplet triplet)
internalFontKey
- internal font keytriplet
- the font triplet to associate with the internal keypublic void addMetrics(String internalFontKey, FontMetrics metrics)
internalFontKey
- internal keymetrics
- metrics to registerpublic void useFont(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 sizepublic Font getFontInstanceForAWTFont(Font awtFont)
awtFont
- the AWT fontpublic FontTriplet fontLookup(String family, String style, int weight)
family
- font familystyle
- font styleweight
- font weightpublic FontTriplet[] fontLookup(String[] families, String style, int weight)
families
- font families (priority list)style
- font styleweight
- font weightpublic void notifyStrokingSVGTextAsShapes(String fontFamily)
fontFamily
- a SVG font familypublic FontTriplet findAdjustWeight(String family, String style, int weight)
family
- font familystyle
- font styleweight
- font weightpublic boolean hasFont(String family, String style, int weight)
family
- font familystyle
- font styleweight
- font weightpublic String getInternalFontKey(FontTriplet triplet)
triplet
- the font tripletpublic static FontTriplet createFontKey(String family, String style, int weight)
family
- font familystyle
- font styleweight
- font weightpublic Map<String,Typeface> getFonts()
public Map<FontTriplet,String> getFontTriplets()
public Map<String,Typeface> getUsedFonts()
public FontMetrics getMetricsFor(String fontName)
fontName
- internal keypublic List<FontTriplet> getTripletsFor(String fontName)
fontName
- The font name we are looking forpublic FontTriplet getTripletFor(String fontName)
fontName
- The font name we are looking forpublic String getFontStyleFor(String fontName)
fontName
- internal keypublic int getFontWeightFor(String fontName)
fontName
- internal keypublic void dumpAllTripletsToSystemOut()
Copyright © 2025 Apache Software Foundation. All rights reserved.