com.lowagie.text.pdf
Class DefaultFontMapper
java.lang.Object
com.lowagie.text.pdf.DefaultFontMapper
- FontMapper
public class DefaultFontMapper
extends java.lang.Object
Default class to map awt fonts to BaseFont.
- Paulo Soares (psoares@consiste.pt)
private HashMap | aliases - Maps aliases to names.
|
private HashMap | mapper - Maps names to BaseFont parameters.
|
aliases
private HashMap aliases
Maps aliases to names.
mapper
private HashMap mapper
Maps names to BaseFont parameters.
awtToPdf
public BaseFont awtToPdf(Font font)
Returns a BaseFont which can be used to represent the given AWT Font
- awtToPdf in interface FontMapper
font
- the font to be converted
- a BaseFont which has similar properties to the provided Font
getAliases
public HashMap getAliases()
getBaseFontParameters
public DefaultFontMapper.BaseFontParameters getBaseFontParameters(String name)
Looks for a BaseFont parameter associated with a name.
- the BaseFont parameter or
null
if not found.
getMapper
public HashMap getMapper()
insertDirectory
public int insertDirectory(String dir)
Inserts all the fonts recognized by iText in the
directory
into the map. The encoding
will be BaseFont.CP1252
but can be
changed later.
dir
- the directory to scan
- the number of files processed
insertNames
public void insertNames(allNames[] ,
String path)
Inserts the names in this map.
path
- the full path to the font
pdfToAwt
public Font pdfToAwt(BaseFont font,
int size)
Returns an AWT Font which can be used to represent the given BaseFont
- pdfToAwt in interface FontMapper
font
- the font to be convertedsize
- the desired point size of the resulting font
- a Font which has similar properties to the provided BaseFont
putAlias
public void putAlias(String alias,
String awtName)
Maps an alias to a name.
alias
- the aliasawtName
- the name
putName
public void putName(String awtName,
DefaultFontMapper.BaseFontParameters parameters)
Maps a name to a BaseFont parameter.
awtName
- the nameparameters
- the BaseFont parameter