Package com.lowagie.text.pdf
Class DefaultFontMapper
java.lang.Object
com.lowagie.text.pdf.DefaultFontMapper
- All Implemented Interfaces:
FontMapper
- Direct Known Subclasses:
AsianFontMapper
Default class to map awt fonts to BaseFont.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
A representation of BaseFont parameters. -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns a BaseFont which can be used to represent the given AWT FontgetBaseFontParameters
(String name) Looks for a BaseFont parameter associated with a name.int
insertDirectory
(String dir) Inserts all the fonts recognized by iText in thedirectory
into the map.void
insertNames
(Object[] allNames, String path) Inserts the names in this map.Returns an AWT Font which can be used to represent the given BaseFontvoid
Maps an alias to a name.void
putName
(String awtName, DefaultFontMapper.BaseFontParameters parameters) Maps a name to a BaseFont parameter.
-
Field Details
-
aliases
Maps aliases to names. -
mapper
Maps names to BaseFont parameters.
-
-
Constructor Details
-
DefaultFontMapper
public DefaultFontMapper()
-
-
Method Details
-
awtToPdf
Returns a BaseFont which can be used to represent the given AWT Font- Specified by:
awtToPdf
in interfaceFontMapper
- Parameters:
font
- the font to be converted- Returns:
- a BaseFont which has similar properties to the provided Font
-
pdfToAwt
Returns an AWT Font which can be used to represent the given BaseFont- Specified by:
pdfToAwt
in interfaceFontMapper
- Parameters:
font
- the font to be convertedsize
- the desired point size of the resulting font- Returns:
- a Font which has similar properties to the provided BaseFont
-
putName
Maps a name to a BaseFont parameter.- Parameters:
awtName
- the nameparameters
- the BaseFont parameter
-
putAlias
Maps an alias to a name.- Parameters:
alias
- the aliasawtName
- the name
-
getBaseFontParameters
Looks for a BaseFont parameter associated with a name.- Parameters:
name
- the name- Returns:
- the BaseFont parameter or
null
if not found.
-
insertNames
Inserts the names in this map.- Parameters:
allNames
- the returned value of callingBaseFont.getAllFontNames(String, String, byte[])
path
- the full path to the font
-
insertDirectory
Inserts all the fonts recognized by iText in thedirectory
into the map. The encoding will beBaseFont.CP1252
but can be changed later.- Parameters:
dir
- the directory to scan- Returns:
- the number of files processed
-
getMapper
-
getAliases
-