iText 8.0.5 API
iText.Layout.Font.FontSet Class Reference

Reusable font set for FontProgram related data. More...

Public Member Functions

  FontSet ()
  Creates a new instance of FontSet. More...
 
int  AddDirectory (String dir, bool scanSubdirectories)
  Add all the fonts in a directory and possibly its subdirectories. More...
 
int  AddDirectory (String dir)
  Add all the fonts in a directory. More...
 
bool  AddFont (FontProgram fontProgram, String encoding, String alias, Range unicodeRange)
  Add not supported for auto creating FontPrograms. More...
 
bool  AddFont (FontProgram fontProgram, String encoding, String alias)
  Add not supported for auto creating FontPrograms. More...
 
bool  AddFont (FontProgram fontProgram, String encoding)
  Add not supported for auto creating FontPrograms. More...
 
bool  AddFont (String fontPath, String encoding, String alias, Range unicodeRange)
  Creates FontInfo , fetches iText.IO.Font.FontProgramDescriptor and adds just created FontInfo to FontSet. More...
 
bool  AddFont (String fontPath, String encoding, String alias)
  Creates FontInfo , fetches iText.IO.Font.FontProgramDescriptor and adds just created FontInfo to FontSet. More...
 
bool  AddFont (String fontPath, String encoding)
  Creates FontInfo , fetches iText.IO.Font.FontProgramDescriptor and adds just created FontInfo to FontSet. More...
 
bool  AddFont (byte[] fontData, String encoding, String alias, Range unicodeRange)
  Creates FontInfo , fetches iText.IO.Font.FontProgramDescriptor and adds just created FontInfo to FontSet. More...
 
bool  AddFont (byte[] fontData, String encoding, String alias)
  Creates FontInfo , fetches iText.IO.Font.FontProgramDescriptor and adds just created FontInfo to FontSet. More...
 
bool  AddFont (byte[] fontData, String encoding)
  Creates FontInfo , fetches iText.IO.Font.FontProgramDescriptor and adds just created FontInfo to FontSet. More...
 
bool  AddFont (String fontPath)
  Creates FontInfo , fetches iText.IO.Font.FontProgramDescriptor and adds just created FontInfo to FontSet. More...
 
bool  AddFont (byte[] fontData)
  Creates FontInfo , fetches iText.IO.Font.FontProgramDescriptor and adds just created FontInfo to FontSet. More...
 
bool  AddFont (FontInfo fontInfo, String alias, Range unicodeRange)
  Adds FontInfo with alias. More...
 
bool  AddFont (FontInfo fontInfo, String alias)
  Adds FontInfo with alias. More...
 
bool  AddFont (FontInfo fontInfo)
  Adds FontInfo. More...
 
bool  Contains (String fontName)
  Search in existed fonts for PostScript name or full font name. More...
 
ICollection< FontInfo Get (String fontName)
  Search in existed fonts for PostScript name or full font name. More...
 
ICollection< FontInfo GetFonts ()
  Gets available fonts. More...
 
ICollection< FontInfo GetFonts (iText.Layout.Font.FontSet additionalFonts)
  Gets union of available and temporary fonts. More...
 
bool  IsEmpty ()
  Returns true if this set contains no elements. More...
 
int  Size ()
  Returns the number of elements in this set. More...
 

Detailed Description

Reusable font set for FontProgram related data.

Reusable font set for FontProgram related data. Add and search fonts.

A FontSet instance could be shared for multiple threads. However FontSet filling is not thread safe operation.

See also
FontProvider

Constructor & Destructor Documentation

◆ FontSet()

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

Creates a new instance of FontSet.

Member Function Documentation

◆ AddDirectory() [1/2]

int iText.Layout.Font.FontSet.AddDirectory ( String  dir )
inline

Add all the fonts in a directory.

Parameters
dir path to directory.
Returns
number of added fonts.

◆ AddDirectory() [2/2]

int iText.Layout.Font.FontSet.AddDirectory ( String  dir,
bool  scanSubdirectories 
)
inline

Add all the fonts in a directory and possibly its subdirectories.

Parameters
dir path to directory.
scanSubdirectories recursively scan subdirectories if true.
Returns
number of added fonts.

◆ AddFont() [1/14]

bool iText.Layout.Font.FontSet.AddFont ( byte[]  fontData )
inline

Creates FontInfo , fetches iText.IO.Font.FontProgramDescriptor and adds just created FontInfo to FontSet.

Creates FontInfo , fetches iText.IO.Font.FontProgramDescriptor and adds just created FontInfo to FontSet. FontProvider.GetDefaultEncoding(iText.IO.Font.FontProgram) will be used to determine encoding.

Parameters
fontData font data.
Returns
true, if font was successfully added, otherwise false.

◆ AddFont() [2/14]

bool iText.Layout.Font.FontSet.AddFont ( byte[]  fontData,
String  encoding 
)
inline

Creates FontInfo , fetches iText.IO.Font.FontProgramDescriptor and adds just created FontInfo to FontSet.

Parameters
fontData font data.
encoding preferred font encoding.
Returns
true, if font was successfully added, otherwise false.
See also
iText.IO.Font.PdfEncodings

◆ AddFont() [3/14]

bool iText.Layout.Font.FontSet.AddFont ( byte[]  fontData,
String  encoding,
String  alias 
)
inline

Creates FontInfo , fetches iText.IO.Font.FontProgramDescriptor and adds just created FontInfo to FontSet.

Creates FontInfo , fetches iText.IO.Font.FontProgramDescriptor and adds just created FontInfo to FontSet.

Note, FontInfo.GetAlias() do not taken into account in FontInfo.Equals(System.Object). The same font with different alias will not be replaced. Alias will replace original font family in font selector algorithm.

Parameters
fontData font data.
encoding preferred font encoding.
alias font alias.
Returns
true, if font was successfully added, otherwise false.
See also
iText.IO.Font.PdfEncodings

◆ AddFont() [4/14]

bool iText.Layout.Font.FontSet.AddFont ( byte[]  fontData,
String  encoding,
String  alias,
Range  unicodeRange 
)
inline

Creates FontInfo , fetches iText.IO.Font.FontProgramDescriptor and adds just created FontInfo to FontSet.

Creates FontInfo , fetches iText.IO.Font.FontProgramDescriptor and adds just created FontInfo to FontSet.

Note, FontInfo.GetAlias() do not taken into account in FontInfo.Equals(System.Object). The same font with different alias will not be replaced. Alias will replace original font family in font selector algorithm.

Parameters
fontData font data.
encoding preferred font encoding.
alias font alias.
unicodeRange sets the specific range of characters to be used from the font
Returns
true, if font was successfully added, otherwise false.
See also
iText.IO.Font.PdfEncodings

◆ AddFont() [5/14]

bool iText.Layout.Font.FontSet.AddFont ( FontInfo  fontInfo )
inline

Adds FontInfo.

Adds FontInfo . Could be used to fill temporary font set.

Note, FontInfo.GetAlias() do not taken into account in FontInfo.Equals(System.Object). The same font with different alias will not be replaced.

Parameters
fontInfo font info.
Returns
true, if font was successfully added, otherwise false.

◆ AddFont() [6/14]

bool iText.Layout.Font.FontSet.AddFont ( FontInfo  fontInfo,
String  alias 
)
inline

Adds FontInfo with alias.

Adds FontInfo with alias. Could be used to fill temporary font set.

Note, FontInfo.GetAlias() do not taken into account in FontInfo.Equals(System.Object). The same font with different alias will not be replaced. Alias will replace original font family in font selector algorithm.

Parameters
fontInfo font info.
alias font alias.
Returns
true, if font was successfully added, otherwise false.

◆ AddFont() [7/14]

bool iText.Layout.Font.FontSet.AddFont ( FontInfo  fontInfo,
String  alias,
Range  unicodeRange 
)
inline

Adds FontInfo with alias.

Adds FontInfo with alias. Could be used to fill temporary font set.

Note, FontInfo.GetAlias() do not taken into account in FontInfo.Equals(System.Object). The same font with different alias will not be replaced. Alias will replace original font family in font selector algorithm.

Parameters
fontInfo font info.
alias font alias.
unicodeRange sets the specific range of characters to be used from the font
Returns
true, if font was successfully added, otherwise false.

◆ AddFont() [8/14]

bool iText.Layout.Font.FontSet.AddFont ( FontProgram  fontProgram,
String  encoding 
)
inline

Add not supported for auto creating FontPrograms.

Parameters
fontProgram

iText.IO.Font.FontProgram

Parameters
encoding FontEncoding for creating iText.Kernel.Font.PdfFont.
Returns
true, if font was successfully added, otherwise false.

◆ AddFont() [9/14]

bool iText.Layout.Font.FontSet.AddFont ( FontProgram  fontProgram,
String  encoding,
String  alias 
)
inline

Add not supported for auto creating FontPrograms.

Add not supported for auto creating FontPrograms.

Note, FontInfo.GetAlias() do not taken into account in FontInfo.Equals(System.Object). The same font with different alias will not be replaced. Alias will replace original font family in font selector algorithm.

Parameters
fontProgram

iText.IO.Font.FontProgram

Parameters
encoding FontEncoding for creating iText.Kernel.Font.PdfFont
alias font alias.
Returns
true, if font was successfully added, otherwise false.

◆ AddFont() [10/14]

bool iText.Layout.Font.FontSet.AddFont ( FontProgram  fontProgram,
String  encoding,
String  alias,
Range  unicodeRange 
)
inline

Add not supported for auto creating FontPrograms.

Add not supported for auto creating FontPrograms.

Note, FontInfo.GetAlias() do not taken into account in FontInfo.Equals(System.Object). The same font with different alias will not be replaced. Alias will replace original font family in font selector algorithm.

Parameters
fontProgram

iText.IO.Font.FontProgram

Parameters
encoding FontEncoding for creating iText.Kernel.Font.PdfFont
alias font alias.
unicodeRange sets the specific range of characters to be used from the font
Returns
true, if font was successfully added, otherwise false.

◆ AddFont() [11/14]

bool iText.Layout.Font.FontSet.AddFont ( String  fontPath )
inline

Creates FontInfo , fetches iText.IO.Font.FontProgramDescriptor and adds just created FontInfo to FontSet.

Creates FontInfo , fetches iText.IO.Font.FontProgramDescriptor and adds just created FontInfo to FontSet. FontProvider.GetDefaultEncoding(iText.IO.Font.FontProgram) will be used to determine encoding.

Parameters
fontPath path to font data.
Returns
true, if font was successfully added, otherwise false.

◆ AddFont() [12/14]

bool iText.Layout.Font.FontSet.AddFont ( String  fontPath,
String  encoding 
)
inline

Creates FontInfo , fetches iText.IO.Font.FontProgramDescriptor and adds just created FontInfo to FontSet.

Parameters
fontPath path to font data.
encoding preferred font encoding.
Returns
true, if font was successfully added, otherwise false.
See also
iText.IO.Font.PdfEncodings

◆ AddFont() [13/14]

bool iText.Layout.Font.FontSet.AddFont ( String  fontPath,
String  encoding,
String  alias 
)
inline

Creates FontInfo , fetches iText.IO.Font.FontProgramDescriptor and adds just created FontInfo to FontSet.

Creates FontInfo , fetches iText.IO.Font.FontProgramDescriptor and adds just created FontInfo to FontSet.

Note, FontInfo.GetAlias() do not taken into account in FontInfo.Equals(System.Object). The same font with different alias will not be replaced. Alias will replace original font family in font selector algorithm.

Parameters
fontPath path to font data.
encoding preferred font encoding.
alias font alias.
Returns
true, if font was successfully added, otherwise false.
See also
iText.IO.Font.PdfEncodings

◆ AddFont() [14/14]

bool iText.Layout.Font.FontSet.AddFont ( String  fontPath,
String  encoding,
String  alias,
Range  unicodeRange 
)
inline

Creates FontInfo , fetches iText.IO.Font.FontProgramDescriptor and adds just created FontInfo to FontSet.

Creates FontInfo , fetches iText.IO.Font.FontProgramDescriptor and adds just created FontInfo to FontSet.

Note, FontInfo.GetAlias() do not taken into account in FontInfo.Equals(System.Object). The same font with different alias will not be replaced. Alias will replace original font family in font selector algorithm.

Parameters
fontPath path to font data.
encoding preferred font encoding.
alias font alias, will replace original font family.
unicodeRange sets the specific range of characters to be used from the font
Returns
true, if font was successfully added, otherwise false.
See also
iText.IO.Font.PdfEncodings

◆ Contains()

bool iText.Layout.Font.FontSet.Contains ( String  fontName )
inline

Search in existed fonts for PostScript name or full font name.

Search in existed fonts for PostScript name or full font name.

Note, this method has O(n) complexity.

Parameters
fontName PostScript or full name.
Returns
true, if FontSet contains font with given name.

◆ Get()

ICollection<FontInfo> iText.Layout.Font.FontSet.Get ( String  fontName )
inline

Search in existed fonts for PostScript name or full font name.

Search in existed fonts for PostScript name or full font name.

Note, this method has O(n) complexity.

Parameters
fontName PostScript or full name.
Returns
Collection of FontInfo from set of fonts with given PostScript or full name.

◆ GetFonts() [1/2]

ICollection<FontInfo> iText.Layout.Font.FontSet.GetFonts ( )
inline

Gets available fonts.

Gets available fonts.

Note, the collection is unmodifiable.

Returns
set of all available fonts

◆ GetFonts() [2/2]

ICollection<FontInfo> iText.Layout.Font.FontSet.GetFonts ( iText.Layout.Font.FontSet  additionalFonts )
inline

Gets union of available and temporary fonts.

Gets union of available and temporary fonts.

Note, the collection is unmodifiable.

Parameters
additionalFonts set of temporary fonts
Returns
set of all available and temporary fonts

◆ IsEmpty()

bool iText.Layout.Font.FontSet.IsEmpty ( )
inline

Returns true if this set contains no elements.

Returns

true if this set contains no elements

◆ Size()

int iText.Layout.Font.FontSet.Size ( )
inline

Returns the number of elements in this set.

Returns
the number of elements in this set