public class FontProvider extends Object
FontSet
and collection of PdfFont
s. FontProvider depends from PdfDocument
, due to PdfFont
, it cannot be reused for different documents, but a new instance of FontProvider could be created with getFontSet()
. FontProvider the only end point for creating PdfFont
.
It is recommended to use only one FontProvider
per document. If temporary fonts per element needed, additional FontSet
can be used. For more details see Property.FONT_SET
, getPdfFont(FontInfo, FontSet)
, getStrategy(String, List, FontCharacteristics, FontSet)
.
Note, FontProvider does not close created FontProgram
s, because of possible conflicts with FontCache
.
Constructor and Description |
---|
FontProvider()
Creates a new instance of FontProvider.
|
FontProvider(FontSet fontSet)
Creates a new instance of FontProvider
|
public FontProvider(FontSet fontSet)
fontSet
- predefined set of fonts, could be null.
public FontProvider()
public boolean addFont(FontProgram fontProgram, String encoding)
public boolean addFont(byte[] fontData, String encoding)
public boolean addFont(String fontPath)
public boolean addFont(FontProgram fontProgram)
public boolean addFont(byte[] fontData)
public int addDirectory(String dir)
public int addSystemFonts()
public int addStandardPdfFonts()
public String getDefaultEncoding(FontProgram fontProgram)
public boolean getDefaultCacheFlag()
public boolean getDefaultEmbeddingFlag()
public FontSelectorStrategy getStrategy(String text, List<String> fontFamilies, FontCharacteristics fc, FontSet additonalFonts)
public FontSelectorStrategy getStrategy(String text, List<String> fontFamilies, FontCharacteristics fc)
public FontSelectorStrategy getStrategy(String text, List<String> fontFamilies)
public final FontSelector getFontSelector(List<String> fontFamilies, FontCharacteristics fc)
FontSelector
or get from cache.
fontFamilies
- target font families
fc
- instance of FontCharacteristics
.
FontSelector
.
createFontSelector(Collection, List, FontCharacteristics)
, getFontSelector(List, FontCharacteristics, FontSet)
public final FontSelector getFontSelector(List<String> fontFamilies, FontCharacteristics fc, FontSet tempFonts)
FontSelector
or get from cache.
fontFamilies
- target font families
fc
- instance of FontCharacteristics
.
tempFonts
- set of temporary fonts.
FontSelector
.
}
protected FontSelector createFontSelector(Collection<FontInfo> fonts, List<String> fontFamilies, FontCharacteristics fc)
FontSelector
. While caching is main responsibility of getFontSelector(List, FontCharacteristics, FontSet)
. This method just create a new instance of FontSelector
.
fonts
- Set of all available fonts in current context.
fontFamilies
- target font families
fc
- instance of FontCharacteristics
.
FontSelector
.
public PdfFont getPdfFont(FontInfo fontInfo)
PdfFont
.
fontInfo
- font info, to create FontProgram
and PdfFont
.
PdfFont
.
IOException
- on I/O exceptions in FontProgramFactory
.
Copyright © 1998–2017 iText Group NV. All rights reserved.