Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.lowagie.text.pdf
Class DefaultFontMapper

    java.lang.Object
      com.lowagie.text.pdf.DefaultFontMapper

All Implemented Interfaces:
  FontMapper

Direct Known Subclasses:
  AsianFontMapper

    public class DefaultFontMapper

extends Object
implements FontMapper

Default class to map awt fonts to BaseFont.

Author:
  Paulo Soares (psoares@consiste.pt)

Nested Class Summary
`static class` | `DefaultFontMapper.BaseFontParameters` A representation of BaseFont parameters.

Field Summary
`private HashMap` | `aliases` Maps aliases to names.
`private HashMap` | `mapper` Maps names to BaseFont parameters.

Constructor Summary
`DefaultFontMapper()`

Method Summary
`BaseFont` | `awtToPdf(Font font)` Returns a BaseFont which can be used to represent the given AWT Font
`HashMap` | `getAliases()`
`DefaultFontMapper.BaseFontParameters` | `getBaseFontParameters(String name)` Looks for a BaseFont parameter associated with a name.
`HashMap` | `getMapper()`
`int` | `insertDirectory(String dir)` Inserts all the fonts recognized by iText in the `directory` 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.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### aliases

    private HashMap aliases

  Maps aliases to names.

### mapper

    private HashMap mapper

  Maps names to BaseFont parameters.

Constructor Detail

### DefaultFontMapper

    public DefaultFontMapper()

Method Detail

### awtToPdf

    public BaseFont awtToPdf(Font font)

  Returns a BaseFont which can be used to represent the given AWT Font

  Specified by:
    `awtToPdf` in interface `FontMapper`
  Parameters:
    `font` - the font to be converted
  Returns:
    a BaseFont which has similar properties to the provided Font

### pdfToAwt

    public Font pdfToAwt(BaseFont font,
                         int size)

  Returns an AWT Font which can be used to represent the given BaseFont

  Specified by:
    `pdfToAwt` in interface `FontMapper`
  Parameters:
    `font` - the font to be converted
    `size` - the desired point size of the resulting font
  Returns:
    a Font which has similar properties to the provided BaseFont

### putName

    public void putName(String awtName,
                        DefaultFontMapper.BaseFontParameters parameters)

  Maps a name to a BaseFont parameter.

  Parameters:
    `awtName` - the name
    `parameters` - the BaseFont parameter

### putAlias

    public void putAlias(String alias,
                         String awtName)

  Maps an alias to a name.

  Parameters:
    `alias` - the alias
    `awtName` - the name

### getBaseFontParameters

    public DefaultFontMapper.BaseFontParameters getBaseFontParameters(String name)

  Looks for a BaseFont parameter associated with a name.

  Parameters:
    `name` - the name
  Returns:
    the BaseFont parameter or `null` if not found.

### insertNames

    public void insertNames(Object[] allNames,
                            String path)

  Inserts the names in this map.

  Parameters:
    `allNames` - the returned value of calling `BaseFont.getAllFontNames(String, String, byte[])`
    `path` - the full path to the font

### 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.

  Parameters:
    `dir` - the directory to scan
  Returns:
    the number of files processed

### getMapper

    public HashMap getMapper()

### getAliases

    public HashMap getAliases()

Overview | Package | Class | Tree | Deprecated | Index | Help
| Hosted by Hostbasket
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD