org.faceless.pdf2

## Class OutputProfiler.AutoEmbeddingFontAction

- java.lang.Object
- - org.faceless.pdf2.OutputProfiler.AutoEmbeddingFontAction

- All Implemented Interfaces:
    OutputProfiler.FontAction
  Enclosing class:
    OutputProfiler

      public static class OutputProfiler.AutoEmbeddingFontAction
      extends Object
      implements OutputProfiler.FontAction

  The `AutoEmbeddingFontAction` class is an implementation of `OutputProfiler.FontAction` that will replace unembedded fonts with embedded ones via a "best fit" algorithm. When a new unembedded font is encountered, the action will replace it with the closest match of the fonts registered with it. The match is based on all attributes of the font, including name, properties and glyph metrics.

  Fonts can be added to this class with the `add(org.faceless.pdf2.PDFFont)` method as possible alternatives to the fonts in the PDF. There are also two fonts added by default for the `ZapfDingbats` and `Symbol` fonts, as copies of these fonts are distributed with the PDF library.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `AutoEmbeddingFontAction()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `add(PDFFont font)` Add a new PDFFont to the set of fonts that could be substituted into the PDF.
    `PDFFont` | `getFont(OutputProfiler profiler, String name, boolean embedded, PDFFont font)` Returns the font to use instead of the specified font, or `null` to make no changes

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### AutoEmbeddingFontAction

          public AutoEmbeddingFontAction()

  - ### Method Detail

    - #### add

          public void add(PDFFont font)

      Add a new PDFFont to the set of fonts that could be substituted into the PDF.
      Parameters:
        `font` - the font

    - #### getFont

          public PDFFont getFont(OutputProfiler profiler,
                                 String name,
                                 boolean embedded,
                                 PDFFont font)

      Description copied from interface: `OutputProfiler.FontAction`
      Returns the font to use instead of the specified font, or `null` to make no changes
      Specified by:
        `getFont` in interface `OutputProfiler.FontAction`
      Parameters:
        `profiler` - the OutputProfiler this action is being run on
        `name` - the font name
        `embedded` - whether the font is embedded in the PDF - typically embedded fonts should be left unchanged.
        `font` - the font that is being replaced. Note this structure is unlikely to support the full PDFFont API, and the object cannot be reused elsewhere.

Copyright © 2001-2015 Big Faceless Organization