Class BasicFontProvider
java.lang.Object
com.itextpdf.layout.font.FontProvider
com.itextpdf.styledxmlparser.resolver.font.BasicFontProvider
A basic
FontProvider that allows configuring in the constructor which fonts are loaded by default.
-
Field Summary
FieldsModifier and TypeFieldDescriptionThe file names of the shipped fonts.protected StringThe path to the shipped fonts.Fields inherited from class com.itextpdf.layout.font.FontProvider
defaultFontFamily, pdfFonts -
Constructor Summary
ConstructorsConstructorDescriptionCreates a newBasicFontProviderinstance.BasicFontProvider(boolean registerStandardPdfFonts, boolean registerSystemFonts) Creates a newBasicFontProviderinstance.BasicFontProvider(boolean registerStandardPdfFonts, boolean registerShippedFonts, boolean registerSystemFonts) Creates a newBasicFontProviderinstance.BasicFontProvider(boolean registerStandardPdfFonts, boolean registerShippedFonts, boolean registerSystemFonts, String defaultFontFamily) Creates a newBasicFontProviderinstance.BasicFontProvider(boolean registerStandardPdfFonts, boolean registerSystemFonts, String defaultFontFamily) Creates a newBasicFontProviderinstance.BasicFontProvider(FontSet fontSet, String defaultFontFamily) Creates a newBasicFontProviderinstance. -
Method Summary
Modifier and TypeMethodDescriptionprotected RangeThis method loads a list of noto fonts from pdfCalligraph (if it is present in the classpath) into FontProvider.protected voidaddShippedFonts(Range rangeToLoad) Adds fonts shipped with the font provider.protected voidInitialize path to shipped fonts and list of font files.Methods inherited from class com.itextpdf.layout.font.FontProvider
addDirectory, addFont, addFont, addFont, addFont, addFont, addFont, addFont, addFont, addFont, addStandardPdfFonts, addSystemFonts, createFontSelector, createFontSelectorStrategy, getDefaultCacheFlag, getDefaultEmbeddingFlag, getDefaultEncoding, getDefaultFontFamily, getFontSelector, getFontSelector, getFontSet, getPdfFont, getPdfFont, reset, setFontSelectorStrategyFactory
-
Field Details
-
shippedFontResourcePath
The path to the shipped fonts. -
shippedFontNames
The file names of the shipped fonts.
-
-
Constructor Details
-
BasicFontProvider
public BasicFontProvider()Creates a newBasicFontProviderinstance. -
BasicFontProvider
public BasicFontProvider(boolean registerStandardPdfFonts, boolean registerSystemFonts) Creates a newBasicFontProviderinstance.- Parameters:
-
registerStandardPdfFonts- use true if you want to register the standard Type 1 fonts (can't be embedded) -
registerSystemFonts- use true if you want to register the system fonts (can require quite some resources)
-
BasicFontProvider
public BasicFontProvider(boolean registerStandardPdfFonts, boolean registerShippedFonts, boolean registerSystemFonts) Creates a newBasicFontProviderinstance.- Parameters:
-
registerStandardPdfFonts- use true if you want to register the standard Type 1 fonts (can't be embedded) -
registerShippedFonts- use true if you want to register the shipped fonts (can be embedded) -
registerSystemFonts- use true if you want to register the system fonts (can require quite some resources)
-
BasicFontProvider
public BasicFontProvider(boolean registerStandardPdfFonts, boolean registerSystemFonts, String defaultFontFamily) Creates a newBasicFontProviderinstance.- Parameters:
-
registerStandardPdfFonts- use true if you want to register the standard Type 1 fonts (can't be embedded) -
registerSystemFonts- use true if you want to register the system fonts (can require quite some resources) -
defaultFontFamily- default font family
-
BasicFontProvider
public BasicFontProvider(boolean registerStandardPdfFonts, boolean registerShippedFonts, boolean registerSystemFonts, String defaultFontFamily) Creates a newBasicFontProviderinstance.- Parameters:
-
registerStandardPdfFonts- use true if you want to register the standard Type 1 fonts (can't be embedded) -
registerShippedFonts- use true if you want to register the shipped fonts (can be embedded) -
registerSystemFonts- use true if you want to register the system fonts (can require quite some resources) -
defaultFontFamily- default font family
-
BasicFontProvider
Creates a newBasicFontProviderinstance.- Parameters:
-
fontSet- predefined set of fonts, could be null. -
defaultFontFamily- default font family.
-
-
Method Details
-
addCalligraphFonts
This method loads a list of noto fonts from pdfCalligraph (if it is present in the classpath) into FontProvider. The list is the following (each font is represented in regular and bold types): NotoSansArabic, NotoSansGurmukhi, NotoSansOriya, NotoSerifBengali, NotoSerifDevanagari, NotoSerifGujarati, NotoSerifHebrew, NotoSerifKannada, NotoSerifKhmer, NotoSerifMalayalam, NotoSerifTamil, NotoSerifTelugu, NotoSerifThai. If it's needed to have a BasicFontProvider without typography fonts loaded, create an extension of BasicFontProvider and override this method, so it does nothing and only returns null.- Returns:
-
a unicode
Rangethat excludes the loaded from pdfCalligraph fonts, i.e. the unicode range that is to be rendered with any other font contained in this FontProvider
-
addShippedFonts
Adds fonts shipped with the font provider. ForBasicFontProviderthis method does nothing but can be overridden to load additional fonts.- Parameters:
-
rangeToLoad- a unicodeRangeto load characters
-
initShippedFontsResourcePath
protected void initShippedFontsResourcePath()Initialize path to shipped fonts and list of font files.
-