Top Fields Constructors Methods
com.openhtmltopdf.pdfboxout.fontstore

public Class FallbackFontStore

extends Object
implements Closeable
Class Inheritance
All Implemented Interfaces
java.io.Closeable, java.lang.AutoCloseable
Imports
java.io.Closeable, .IOException, .InputStream, java.util.ArrayList, .Arrays, .Collections, .Comparator, .List, 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.FontResolverHelper, com.openhtmltopdf.pdfboxout.PDFontSupplier, .PdfBoxFontResolver.FontDescription

Field Summary

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

Constructor Summary

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

Method Summary

Modifier and TypeMethod and Description
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)

private void
pack-priv void
addFont(TrueTypeFont trueTypeFont, String fontFamilyNameOverride, Integer fontWeightOverride, IdentValue fontStyleOverride, boolean subset)

Add a font using a FontBox TrueTypeFont.

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

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

Add a font with a lazy loaded PDFont

public void
close()

Implements java.io.Closeable.close.

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

private int
getFamilyPriority(String fontFamily, List<String> desiredFamilies)

private int
getFontPriority(PdfBoxFontResolver.FontDescription font, String[] families, IdentValue weight, IdentValue desiredStyle, IdentValue variant)

public List<PdfBoxFontResolver.FontDescription>
resolveFonts(SharedContext ctx, String[] families, float size, IdentValue weight, IdentValue style, IdentValue variant)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

_collectionsToCloseback to summary
private final List<TrueTypeCollection> _collectionsToClose
_docback to summary
private final PDDocument _doc
_fontMetricsCacheback to summary
private final FSCacheEx<String, FSCacheValue> _fontMetricsCache
fontsback to summary
private final List<PdfBoxFontResolver.FontDescription> fonts

Constructor Detail

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

Method Detail

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)
addFontback to summary
private void addFont(boolean subset, PdfBoxFontResolver.FontDescription descr)
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.

addFontCollectionback to summary
public void addFontCollection(TrueTypeCollection collection, String fontFamilyNameOverride, Integer fontWeightOverride, IdentValue fontStyleOverride, boolean subset) throws IOException
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

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
getFamilyPriorityback to summary
private int getFamilyPriority(String fontFamily, List<String> desiredFamilies)
getFontPriorityback to summary
private int getFontPriority(PdfBoxFontResolver.FontDescription font, String[] families, IdentValue weight, IdentValue desiredStyle, IdentValue variant)
resolveFontsback to summary
public List<PdfBoxFontResolver.FontDescription> resolveFonts(SharedContext ctx, String[] families, float size, IdentValue weight, IdentValue style, IdentValue variant)