iText 7 7.1.10 API
iText.Layout.Font.FontProvider Class Reference

Main entry point of font selector logic. More...

Inheritance diagram for iText.Layout.Font.FontProvider:
iText.StyledXmlParser.Resolver.Font.BasicFontProvider

Public Member Functions

 FontProvider (FontSet fontSet)
 Creates a new instance of FontProvider More...
 
 FontProvider ()
 Creates a new instance of FontProvider. More...
 
 FontProvider (String defaultFontFamily)
 Creates a new instance of FontProvider. More...
 
 FontProvider (FontSet fontSet, String defaultFontFamily)
 Creates a new instance of FontProvider More...
 
virtual bool AddFont (FontProgram fontProgram, String encoding, Range unicodeRange)
 
virtual bool AddFont (FontProgram fontProgram, String encoding)
 
virtual bool AddFont (FontProgram fontProgram)
 
virtual bool AddFont (String fontPath, String encoding, Range unicodeRange)
 
virtual bool AddFont (String fontPath, String encoding)
 
virtual bool AddFont (String fontPath)
 
virtual bool AddFont (byte[] fontData, String encoding, Range unicodeRange)
 
virtual bool AddFont (byte[] fontData, String encoding)
 
virtual bool AddFont (byte[] fontData)
 
virtual int AddDirectory (String dir)
 
virtual int AddSystemFonts ()
 
virtual int AddStandardPdfFonts ()
 
virtual FontSet GetFontSet ()
 Gets FontSet. More...
 
virtual String GetDefaultFontFamily ()
 Gets the default font-family More...
 
virtual String GetDefaultEncoding (FontProgram fontProgram)
 
virtual bool GetDefaultCacheFlag ()
 
virtual bool GetDefaultEmbeddingFlag ()
 
virtual FontSelectorStrategy GetStrategy (String text, IList< String > fontFamilies, FontCharacteristics fc, FontSet additonalFonts)
 
virtual FontSelectorStrategy GetStrategy (String text, IList< String > fontFamilies, FontCharacteristics fc)
 
virtual FontSelectorStrategy GetStrategy (String text, IList< String > fontFamilies)
 
FontSelector GetFontSelector (IList< String > fontFamilies, FontCharacteristics fc)
 Create FontSelector or get from cache. More...
 
FontSelector GetFontSelector (IList< String > fontFamilies, FontCharacteristics fc, FontSet tempFonts)
 Create FontSelector or get from cache. More...
 
virtual PdfFont GetPdfFont (FontInfo fontInfo)
 Get from cache or create a new instance of iText.Kernel.Font.PdfFont. More...
 
virtual PdfFont GetPdfFont (FontInfo fontInfo, FontSet tempFonts)
 Get from cache or create a new instance of iText.Kernel.Font.PdfFont. More...
 
virtual void Reset ()
 Resets PdfFont cache. More...
 

Detailed Description

Main entry point of font selector logic.

Main entry point of font selector logic. Contains reusable FontSet and collection of iText.Kernel.Font.PdfFont s. FontProvider depends on iText.Kernel.Pdf.PdfDocument due to iText.Kernel.Font.PdfFont , so it cannot be reused for different documents unless reset with Reset() or recreated with GetFontSet(). In the former case the FontSelectorCache is reused and in the latter it's reinitialised. FontProvider the only end point for creating iText.Kernel.Font.PdfFont.

It is allowed to use only one FontProvider per document. If temporary fonts per element needed, additional FontSet can be used. For more details see iText.Layout.Properties.Property.FONT_SET , GetPdfFont(FontInfo, FontSet) , <see cref="GetStrategy(System.String, System.Collections.Generic.IList{E}, FontCharacteristics, FontSet)"/ >.

Note, FontProvider does not close created iText.IO.Font.FontProgram s, because of possible conflicts with iText.IO.Font.FontCache.

Constructor & Destructor Documentation

◆ FontProvider() [1/4]

iText.Layout.Font.FontProvider.FontProvider ( FontSet  fontSet)
inline

Creates a new instance of FontProvider

Parameters
fontSetpredefined set of fonts, could be null.

◆ FontProvider() [2/4]

iText.Layout.Font.FontProvider.FontProvider ( )
inline

Creates a new instance of FontProvider.

◆ FontProvider() [3/4]

iText.Layout.Font.FontProvider.FontProvider ( String  defaultFontFamily)
inline

Creates a new instance of FontProvider.

Parameters
defaultFontFamilydefault font family.

◆ FontProvider() [4/4]

iText.Layout.Font.FontProvider.FontProvider ( FontSet  fontSet,
String  defaultFontFamily 
)
inline

Creates a new instance of FontProvider

Parameters
fontSetpredefined set of fonts, could be null.
defaultFontFamilydefault font family.

Member Function Documentation

◆ GetDefaultFontFamily()

virtual String iText.Layout.Font.FontProvider.GetDefaultFontFamily ( )
inlinevirtual

Gets the default font-family

Returns
the default font-family

◆ GetFontSelector() [1/2]

FontSelector iText.Layout.Font.FontProvider.GetFontSelector ( IList< String >  fontFamilies,
FontCharacteristics  fc 
)
inline

Create FontSelector or get from cache.

Parameters
fontFamiliestarget font families
fcinstance of FontCharacteristics.
Returns
an instance of FontSelector.
See also
CreateFontSelector(System.Collections.Generic.ICollection<E>, System.Collections.Generic.IList<E>, FontCharacteristics) , GetFontSelector(System.Collections.Generic.IList<E>, FontCharacteristics, FontSet)

◆ GetFontSelector() [2/2]

FontSelector iText.Layout.Font.FontProvider.GetFontSelector ( IList< String >  fontFamilies,
FontCharacteristics  fc,
FontSet  tempFonts 
)
inline

Create FontSelector or get from cache.

Parameters
fontFamiliestarget font families
fcinstance of FontCharacteristics.
tempFontsset of temporary fonts.
Returns
an instance of FontSelector.
See also
CreateFontSelector(System.Collections.Generic.ICollection<E>, System.Collections.Generic.IList<E>, FontCharacteristics)

}

◆ GetFontSet()

virtual FontSet iText.Layout.Font.FontProvider.GetFontSet ( )
inlinevirtual

Gets FontSet.

Returns
the fontset

◆ GetPdfFont() [1/2]

virtual PdfFont iText.Layout.Font.FontProvider.GetPdfFont ( FontInfo  fontInfo)
inlinevirtual

Get from cache or create a new instance of iText.Kernel.Font.PdfFont.

Parameters
fontInfofont info, to create iText.IO.Font.FontProgram and iText.Kernel.Font.PdfFont.
Returns
cached or new instance of iText.Kernel.Font.PdfFont.

◆ GetPdfFont() [2/2]

virtual PdfFont iText.Layout.Font.FontProvider.GetPdfFont ( FontInfo  fontInfo,
FontSet  tempFonts 
)
inlinevirtual

Get from cache or create a new instance of iText.Kernel.Font.PdfFont.

Parameters
fontInfofont info, to create iText.IO.Font.FontProgram and iText.Kernel.Font.PdfFont.
tempFontsSet of temporary fonts.
Returns
cached or new instance of iText.Kernel.Font.PdfFont.

◆ Reset()

virtual void iText.Layout.Font.FontProvider.Reset ( )
inlinevirtual

Resets PdfFont cache.

Resets PdfFont cache . After calling that method FontProvider can be reused with another iText.Kernel.Pdf.PdfDocument