Class AbstractFontFileRegistry
java.lang.Object
org.pentaho.reporting.libraries.fonts.registry.AbstractFontFileRegistry
- All Implemented Interfaces:
FontRegistry
- Direct Known Subclasses:
AfmFontRegistry,PfmFontRegistry,TrueTypeFontRegistry
Creation-Date: 21.07.2007, 17:01:15
- Author:
- Thomas Morgner
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract booleanAdds the fontname by creating the basefont object.protected DefaultFontFamilycreateFamily(String name) protected FileString[]protected Stringprotected Stringprotected abstract FileFiltergetFontFamily(String name) Tries to find a font family with the given name, looking through all alternative font names if neccessary.String[]protected HashMap<String,FontFileRecord> voidprotected booleanprotected booleanisCacheValid(HashMap cachedSeenFiles) protected voidloadFromCache(String encoding) protected voidloadFromCache(String encoding, String filename) protected voidpopulateFromCache(HashMap<String, DefaultFontFamily> cachedFontFamilies, HashMap<String, DefaultFontFamily> cachedFullFontNames, HashMap<String, DefaultFontFamily> cachedAlternateNames) protected voidregisterAlternativeName(String name, DefaultFontFamily family) voidRegister os-specific font paths to the PDF-FontFactory.voidregisterFontFile(File file, String encoding) voidregisterFontFile(String filename, String encoding) Register the font (must end this *.ttf) to the FontFactory.voidregisterFontPath(File file, String encoding) Register all fonts (*.ttf files) in the given path.protected voidregisterFullName(String name, DefaultFontFamily family) protected voidregisterPrimaryName(String name, DefaultFontFamily family) protected StringsafeSystemGetProperty(String name, String defaultValue) protected voidstoreToCache(String encoding) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.pentaho.reporting.libraries.fonts.registry.FontRegistry
createMetricsFactory, getSecondLevelCache
-
Constructor Details
-
AbstractFontFileRegistry
protected AbstractFontFileRegistry()
-
-
Method Details
-
getSeenFiles
-
getFileFilter
-
initialize
public void initialize()- Specified by:
initializein interfaceFontRegistry
-
getDefaultEncoding
-
registerDefaultFontPath
public void registerDefaultFontPath()Register os-specific font paths to the PDF-FontFactory. For unix-like operating systems, X11 is searched in /usr/X11R6 and the default truetype fontpath is added. For windows the system font path is added (%windir%/fonts) -
registerPrimaryName
-
registerAlternativeName
-
registerFullName
-
createFamily
-
getRegisteredFamilies
- Specified by:
getRegisteredFamiliesin interfaceFontRegistry
-
getAllRegisteredFamilies
- Specified by:
getAllRegisteredFamiliesin interfaceFontRegistry
-
getFontFamily
Description copied from interface:FontRegistryTries to find a font family with the given name, looking through all alternative font names if neccessary.- Specified by:
getFontFamilyin interfaceFontRegistry- Returns:
- the font family or null, if there is no such family.
-
loadFromCache
-
populateFromCache
protected void populateFromCache(HashMap<String, DefaultFontFamily> cachedFontFamilies, HashMap<String, DefaultFontFamily> cachedFullFontNames, HashMap<String, DefaultFontFamily> cachedAlternateNames) -
loadFromCache
-
getCacheFileName
-
storeToCache
-
registerFontPath
Register all fonts (*.ttf files) in the given path.- Parameters:
file- the directory that contains the font files.encoding- the encoding for the given font.
-
isCached
-
registerFontFile
Register the font (must end this *.ttf) to the FontFactory.- Parameters:
filename- the filename.encoding- the encoding.
-
registerFontFile
-
addFont
Adds the fontname by creating the basefont object. This method tries to load the fonts as embeddable fonts, if this fails, it repeats the loading with the embedded-flag set to false.- Parameters:
font- the font file name.encoding- the encoding.- Returns:
- true, if registration was successful, false otherwise.
- Throws:
IOException- if the base font file could not be read.
-
safeSystemGetProperty
-
isCacheValid
-
createStorageLocation
-