Package org.apache.fop.fonts.autodetect
Class FontInfoFinder
java.lang.Object
org.apache.fop.fonts.autodetect.FontInfoFinder
Attempts to determine correct FontInfo
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate FontEventListener
private final org.apache.commons.logging.Log
logging instanceprivate final Pattern
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfind
(URI fontURI, InternalResourceResolver resourceResolver, FontCache fontCache) Attempts to determine EmbedFontInfo from a given font file.private void
generateTripletsFromFont
(CustomFont customFont, Collection<FontTriplet> triplets) Attempts to determine FontTriplets from a given CustomFont.private EmbedFontInfo
getFontInfoFromCustomFont
(URI fontUri, CustomFont customFont, FontCache fontCache, InternalResourceResolver resourceResolver) Attempts to determine FontInfo from a given custom fontprivate String
guessStyle
(CustomFont customFont, String fontName) void
setEventListener
(FontEventListener listener) Sets the font event listener that can be used to receive events about particular events in this class.private String
stripQuotes
(String name)
-
Field Details
-
log
private final org.apache.commons.logging.Log loglogging instance -
eventListener
-
quotePattern
-
-
Constructor Details
-
FontInfoFinder
public FontInfoFinder()
-
-
Method Details
-
setEventListener
Sets the font event listener that can be used to receive events about particular events in this class.- Parameters:
listener
- the font event listener
-
generateTripletsFromFont
Attempts to determine FontTriplets from a given CustomFont. It seems to be fairly accurate but will probably require some tweaking over time- Parameters:
customFont
- CustomFonttriplets
- Collection that will take the generated triplets
-
stripQuotes
-
guessStyle
-
getFontInfoFromCustomFont
private EmbedFontInfo getFontInfoFromCustomFont(URI fontUri, CustomFont customFont, FontCache fontCache, InternalResourceResolver resourceResolver) Attempts to determine FontInfo from a given custom font- Parameters:
fontUri
- the font URIcustomFont
- the custom fontfontCache
- font cache (may be null)- Returns:
- FontInfo from the given custom font
-
find
public EmbedFontInfo[] find(URI fontURI, InternalResourceResolver resourceResolver, FontCache fontCache) Attempts to determine EmbedFontInfo from a given font file.- Parameters:
fontURI
- the URI of the font resourceresourceResolver
- font resolver used to resolve fontfontCache
- font cache (may be null)- Returns:
- an array of newly created embed font info. Generally, this array will have only one entry, unless the fontUrl is a TrueType Collection
-