Top Fields Constructors Methods
com.openhtmltopdf.pdfboxout.fontstore

public Class MainFontStore

extends AbstractFontStore
implements Closeable
Class Inheritance
All Implemented Interfaces
java.io.Closeable, java.lang.AutoCloseable
Imports
java.io.Closeable, .IOException, .InputStream, java.util.ArrayList, .HashMap, .List, .Map, org.apache.fontbox.ttf.TrueTypeCollection, .TrueTypeFont, .TrueTypeCollection.TrueTypeFontProcessor, org.apache.pdfbox.pdmodel.PDDocument, org.apache.pdfbox.pdmodel.font.PDFont, .PDType0Font, com.openhtmltopdf.css.constants.IdentValue, com.openhtmltopdf.extend.FSCacheEx, .FSCacheValue, .FSSupplier, com.openhtmltopdf.layout.SharedContext, com.openhtmltopdf.outputdevice.helper.FontFaceFontSupplier, .FontFamily, .FontResolverHelper, com.openhtmltopdf.pdfboxout.PDFontSupplier, .PdfBoxFontResolver.FontDescription

Field Summary

Modifier and TypeField and Description
private final List<TrueTypeCollection>
private final PDDocument
private final Map<String, FontFamily<PdfBoxFontResolver.FontDescription>>
private final FSCacheEx<String, FSCacheValue>
private final SharedContext

Constructor Summary

AccessConstructor and Description
public
MainFontStore(SharedContext sharedContext, PDDocument doc, FSCacheEx<String, FSCacheValue> pdfMetricsCache)

Method Summary

Modifier and TypeMethod and Description
pack-priv void
addFont(TrueTypeFont trueTypeFont, String fontFamilyNameOverride, Integer fontWeightOverride, IdentValue fontStyleOverride, boolean subset)

Add a font using a FontBox TrueTypeFont.

public void
addFont(FSSupplier<InputStream> supplier, String fontFamilyNameOverride, Integer fontWeightOverride, IdentValue fontStyleOverride, boolean subset)

public void
addFont(PDFontSupplier supplier, String fontFamilyNameOverride, Integer fontWeightOverride, IdentValue fontStyleOverride, boolean subset)

public void
addFontCollection(TrueTypeCollection collection, final String fontFamilyNameOverride, final Integer fontWeightOverride, final IdentValue fontStyleOverride, final boolean subset)

Add fonts using a FontBox TrueTypeCollection.

public void
addFontFaceFont(String fontFamilyName, IdentValue fontWeight, IdentValue fontStyle, String uri, boolean subset)

public void
addFontLazy(FSSupplier<PDFont> font, String fontFamilyNameOverride, Integer fontWeightOverride, IdentValue fontStyleOverride, boolean subset)

Add a font with a lazy loaded PDFont

private void
public void
close()

Implements java.io.Closeable.close.

Closes this stream and releases any system resources associated with it.

private FontFamily<PdfBoxFontResolver.FontDescription>
getFontFamily(String fontFamilyName)

public PdfBoxFontResolver.FontDescription

Field Detail

_collectionsToCloseback to summary
private final List<TrueTypeCollection> _collectionsToClose
_docback to summary
private final PDDocument _doc
_fontFamiliesback to summary
private final Map<String, FontFamily<PdfBoxFontResolver.FontDescription>> _fontFamilies
_fontMetricsCacheback to summary
private final FSCacheEx<String, FSCacheValue> _fontMetricsCache
_sharedContextback to summary
private final SharedContext _sharedContext

Constructor Detail

MainFontStoreback to summary
public MainFontStore(SharedContext sharedContext, PDDocument doc, FSCacheEx<String, FSCacheValue> pdfMetricsCache)

Method Detail

addFontback to summary
pack-priv void addFont(TrueTypeFont trueTypeFont, String fontFamilyNameOverride, Integer fontWeightOverride, IdentValue fontStyleOverride, boolean subset) throws IOException

Add a font using a FontBox TrueTypeFont.

addFontback to summary
public void addFont(FSSupplier<InputStream> supplier, String fontFamilyNameOverride, Integer fontWeightOverride, IdentValue fontStyleOverride, boolean subset)
addFontback to summary
public void addFont(PDFontSupplier supplier, String fontFamilyNameOverride, Integer fontWeightOverride, IdentValue fontStyleOverride, boolean subset)
addFontCollectionback to summary
public void addFontCollection(TrueTypeCollection collection, final String fontFamilyNameOverride, final Integer fontWeightOverride, final IdentValue fontStyleOverride, final boolean subset) throws IOException

Add fonts using a FontBox TrueTypeCollection.

addFontFaceFontback to summary
public void addFontFaceFont(String fontFamilyName, IdentValue fontWeight, IdentValue fontStyle, String uri, boolean subset)
addFontLazyback to summary
public void addFontLazy(FSSupplier<PDFont> font, String fontFamilyNameOverride, Integer fontWeightOverride, IdentValue fontStyleOverride, boolean subset)

Add a font with a lazy loaded PDFont

addFontToFamilyback to summary
private void addFontToFamily(boolean subset, FontFamily<PdfBoxFontResolver.FontDescription> fontFamily, PdfBoxFontResolver.FontDescription descr)
closeback to summary
public void close() throws IOException

Implements java.io.Closeable.close.

Doc from java.io.Closeable.close.

Closes this stream and releases any system resources associated with it. If the stream is already closed then invoking this method has no effect.

As noted in AutoCloseable#close(), cases where the close may fail require careful attention. It is strongly advised to relinquish the underlying resources and to internally mark the Closeable as closed, prior to throwing the IOException.

Exceptions
IOException:
if an I/O error occurs
getFontFamilyback to summary
private FontFamily<PdfBoxFontResolver.FontDescription> getFontFamily(String fontFamilyName)
resolveFontback to summary
public PdfBoxFontResolver.FontDescription resolveFont(SharedContext ctx, String fontFamily, float size, IdentValue weight, IdentValue style, IdentValue variant)

Implements abstract com.openhtmltopdf.pdfboxout.fontstore.AbstractFontStore.resolveFont.

Annotations
@Override