public class FontProvider extends Object
FontSet and collection of PdfFonts.
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 FontPrograms, 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
|
| Modifier and Type | Method and Description |
|---|---|
int |
addDirectory(String dir) |
boolean |
addFont(byte[] fontData) |
boolean |
addFont(byte[] fontData,
String encoding) |
boolean |
addFont(com.itextpdf.io.font.FontProgram fontProgram) |
boolean |
addFont(com.itextpdf.io.font.FontProgram fontProgram,
String encoding) |
boolean |
addFont(String fontPath) |
boolean |
addFont(String fontPath,
String encoding) |
int |
addStandardPdfFonts() |
int |
addSystemFonts() |
protected FontSelector |
createFontSelector(Collection<FontInfo> fonts,
List<String> fontFamilies,
FontCharacteristics fc)
Create a new instance of
FontSelector. |
boolean |
getDefaultCacheFlag() |
boolean |
getDefaultEmbeddingFlag() |
String |
getDefaultEncoding(com.itextpdf.io.font.FontProgram fontProgram) |
FontSelector |
getFontSelector(List<String> fontFamilies,
FontCharacteristics fc)
Create
FontSelector or get from cache. |
FontSelector |
getFontSelector(List<String> fontFamilies,
FontCharacteristics fc,
FontSet tempFonts)
Create
FontSelector or get from cache. |
FontSet |
getFontSet()
Gets
FontSet. |
PdfFont |
getPdfFont(FontInfo fontInfo)
Get from cache or create a new instance of
PdfFont. |
PdfFont |
getPdfFont(FontInfo fontInfo,
FontSet tempFonts)
Get from cache or create a new instance of
PdfFont. |
FontSelectorStrategy |
getStrategy(String text,
List<String> fontFamilies) |
FontSelectorStrategy |
getStrategy(String text,
List<String> fontFamilies,
FontCharacteristics fc) |
FontSelectorStrategy |
getStrategy(String text,
List<String> fontFamilies,
FontCharacteristics fc,
FontSet additonalFonts) |
public FontProvider(FontSet fontSet)
fontSet - predefined set of fonts, could be null.public FontProvider()
public boolean addFont(com.itextpdf.io.font.FontProgram fontProgram,
String encoding)
public boolean addFont(byte[] fontData,
String encoding)
public boolean addFont(String fontPath)
public boolean addFont(com.itextpdf.io.font.FontProgram fontProgram)
public boolean addFont(byte[] fontData)
public int addDirectory(String dir)
public int addSystemFonts()
public int addStandardPdfFonts()
public String getDefaultEncoding(com.itextpdf.io.font.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 familiesfc - 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 familiesfc - 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 familiesfc - instance of FontCharacteristics.FontSelector.public PdfFont getPdfFont(FontInfo fontInfo)
PdfFont.Copyright © 1998–2017 iText Group NV. All rights reserved.