public class DefaultFontMapper extends Object implements FontMapper
Modifier and Type | Class and Description |
---|---|
static class |
DefaultFontMapper.BaseFontParameters
A representation of BaseFont parameters.
|
Constructor and Description |
---|
DefaultFontMapper() |
Modifier and Type | Method and Description |
---|---|
BaseFont |
awtToPdf(Font font)
Returns a BaseFont which can be used to represent the given AWT Font
|
HashMap<String,String> |
getAliases() |
DefaultFontMapper.BaseFontParameters |
getBaseFontParameters(String name)
Looks for a BaseFont parameter associated with a name.
|
HashMap<String,DefaultFontMapper.BaseFontParameters> |
getMapper() |
int |
insertDirectory(String dir)
Inserts all the fonts recognized by iText in the directory into the map.
|
int |
insertFile(File file)
Inserts one font file into the map.
|
void |
insertNames(Object[] allNames, String path)
Inserts the names in this map.
|
Font |
pdfToAwt(BaseFont font, int size)
Returns an AWT Font which can be used to represent the given BaseFont
|
void |
putAlias(String alias, String awtName)
Maps an alias to a name.
|
void |
putName(String awtName, DefaultFontMapper.BaseFontParameters parameters)
Maps a name to a BaseFont parameter.
|
public BaseFont awtToPdf(Font font)
awtToPdf
in interface FontMapper
font
- the font to be converted
public Font pdfToAwt(BaseFont font, int size)
pdfToAwt
in interface FontMapper
font
- the font to be converted
size
- the desired point size of the resulting font
public void putName(String awtName, DefaultFontMapper.BaseFontParameters parameters)
awtName
- the name
parameters
- the BaseFont parameter
public void putAlias(String alias, String awtName)
alias
- the alias
awtName
- the name
public DefaultFontMapper.BaseFontParameters getBaseFontParameters(String name)
name
- the name
null
if not found.
public void insertNames(Object[] allNames, String path)
allNames
- the returned value of calling BaseFont.getAllFontNames(String, String, byte[])
path
- the full path to the font
public int insertFile(File file)
BaseFont.CP1252
but can be changed later.
file
- the file to insert
public int insertDirectory(String dir)
directory
into the map. The encoding will be BaseFont.CP1252
but can be changed later.
dir
- the directory to scan
public HashMap<String,DefaultFontMapper.BaseFontParameters> getMapper()
Copyright © 1998–2018. All rights reserved.