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 and Description |
---|
AutoEmbeddingFontAction() |
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 |
public void add(PDFFont font)
font
- the fontpublic PDFFont getFont(OutputProfiler profiler, String name, boolean embedded, PDFFont font)
OutputProfiler.FontAction
null
to make no changesgetFont
in interface OutputProfiler.FontAction
profiler
- the OutputProfiler this action is being run onname
- the font nameembedded
- 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-2017 Big Faceless Organization