org.pentaho.reporting.libraries.fonts.registry

Class AbstractFontFileRegistry

public abstract class AbstractFontFileRegistry extends Object implements FontRegistry

Creation-Date: 21.07.2007, 17:01:15

Author: Thomas Morgner

Constructor Summary
protected AbstractFontFileRegistry()
Method Summary
protected abstract booleanaddFont(File font, String encoding)
Adds the fontname by creating the basefont object.
protected FilecreateStorageLocation()
protected StringgetDefaultEncoding()
protected abstract FileFiltergetFileFilter()
protected HashMapgetSeenFiles()
voidinitialize()
protected booleanisCached(File file)
protected booleanisCacheValid(HashMap cachedSeenFiles)
protected voidloadFromCache(String encoding)
voidregisterDefaultFontPath()
Register os-specific font paths to the PDF-FontFactory.
voidregisterFontFile(String filename, String encoding)
Register the font (must end this *.ttf) to the FontFactory.
voidregisterFontFile(File file, String encoding)
voidregisterFontPath(File file, String encoding)
Register all fonts (*.ttf files) in the given path.
protected StringsafeSystemGetProperty(String name, String defaultValue)
protected voidstoreToCache(String encoding)

Constructor Detail

AbstractFontFileRegistry

protected AbstractFontFileRegistry()

Method Detail

addFont

protected abstract boolean addFont(File font, String encoding)
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.

Throws: java.io.IOException if the base font file could not be read.

createStorageLocation

protected File createStorageLocation()

getDefaultEncoding

protected String getDefaultEncoding()

getFileFilter

protected abstract FileFilter getFileFilter()

getSeenFiles

protected HashMap getSeenFiles()

initialize

public void initialize()

isCached

protected boolean isCached(File file)

isCacheValid

protected boolean isCacheValid(HashMap cachedSeenFiles)

loadFromCache

protected void loadFromCache(String encoding)

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)

registerFontFile

public void registerFontFile(String filename, String encoding)
Register the font (must end this *.ttf) to the FontFactory.

Parameters: filename the filename. encoding the encoding.

registerFontFile

public void registerFontFile(File file, String encoding)

registerFontPath

public void registerFontPath(File file, String encoding)
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.

safeSystemGetProperty

protected String safeSystemGetProperty(String name, String defaultValue)

storeToCache

protected void storeToCache(String encoding)