Class FontSet
Reusable font set for FontProgram related data.
public sealed class FontSet
- Inheritance
-
FontSet
- Inherited Members
Remarks
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.Constructors
FontSet()
Creates a new instance of FontSet.
public FontSet()
- See Also
Methods
AddDirectory(string)
Add all the fonts in a directory.
public int AddDirectory(string dir)
Parameters
dir
stringpath to directory.
Returns
- int
number of added fonts.
- See Also
AddDirectory(string, bool)
Add all the fonts in a directory and possibly its subdirectories.
public int AddDirectory(string dir, bool scanSubdirectories)
Parameters
Returns
- int
number of added fonts.
- See Also
AddFont(byte[])
Creates FontInfo , fetches FontProgramDescriptor and adds just created FontInfo to FontSet.
public bool AddFont(byte[] fontData)
Parameters
fontData
byte[]font data.
Returns
- bool
true, if font was successfully added, otherwise false.
Remarks
Creates FontInfo , fetches FontProgramDescriptor and adds just created FontInfo to FontSet. GetDefaultEncoding(FontProgram) will be used to determine encoding.
- See Also
AddFont(byte[], string)
Creates FontInfo , fetches FontProgramDescriptor and adds just created FontInfo to FontSet.
public bool AddFont(byte[] fontData, string encoding)
Parameters
Returns
- bool
true, if font was successfully added, otherwise false.
- See Also
AddFont(byte[], string, string)
Creates FontInfo , fetches FontProgramDescriptor and adds just created FontInfo to FontSet.
public bool AddFont(byte[] fontData, string encoding, string alias)
Parameters
Returns
- bool
true, if font was successfully added, otherwise false.
Remarks
Creates FontInfo , fetches FontProgramDescriptor and adds just created FontInfo to FontSet.
Note, GetAlias() do not taken into account in Equals(object). The same font with different alias will not be replaced. Alias will replace original font family in font selector algorithm.- See Also
AddFont(byte[], string, string, Range)
Creates FontInfo , fetches FontProgramDescriptor and adds just created FontInfo to FontSet.
public bool AddFont(byte[] fontData, string encoding, string alias, Range unicodeRange)
Parameters
fontData
byte[]font data.
encoding
stringpreferred font encoding.
alias
stringfont alias.
unicodeRange
Rangesets the specific range of characters to be used from the font
Returns
- bool
true, if font was successfully added, otherwise false.
Remarks
Creates FontInfo , fetches FontProgramDescriptor and adds just created FontInfo to FontSet.
Note, GetAlias() do not taken into account in Equals(object). The same font with different alias will not be replaced. Alias will replace original font family in font selector algorithm.- See Also
AddFont(string)
Creates FontInfo , fetches FontProgramDescriptor and adds just created FontInfo to FontSet.
public bool AddFont(string fontPath)
Parameters
fontPath
stringpath to font data.
Returns
- bool
true, if font was successfully added, otherwise false.
Remarks
Creates FontInfo , fetches FontProgramDescriptor and adds just created FontInfo to FontSet. GetDefaultEncoding(FontProgram) will be used to determine encoding.
- See Also
AddFont(string, string)
Creates FontInfo , fetches FontProgramDescriptor and adds just created FontInfo to FontSet.
public bool AddFont(string fontPath, string encoding)
Parameters
Returns
- bool
true, if font was successfully added, otherwise false.
- See Also
AddFont(string, string, string)
Creates FontInfo , fetches FontProgramDescriptor and adds just created FontInfo to FontSet.
public bool AddFont(string fontPath, string encoding, string alias)
Parameters
fontPath
stringpath to font data.
encoding
stringpreferred font encoding.
alias
stringfont alias.
Returns
- bool
true, if font was successfully added, otherwise false.
Remarks
Creates FontInfo , fetches FontProgramDescriptor and adds just created FontInfo to FontSet.
Note, GetAlias() do not taken into account in Equals(object). The same font with different alias will not be replaced. Alias will replace original font family in font selector algorithm.- See Also
AddFont(string, string, string, Range)
Creates FontInfo , fetches FontProgramDescriptor and adds just created FontInfo to FontSet.
public bool AddFont(string fontPath, string encoding, string alias, Range unicodeRange)
Parameters
fontPath
stringpath to font data.
encoding
stringpreferred font encoding.
alias
stringfont alias, will replace original font family.
unicodeRange
Rangesets the specific range of characters to be used from the font
Returns
- bool
true, if font was successfully added, otherwise false.
Remarks
Creates FontInfo , fetches FontProgramDescriptor and adds just created FontInfo to FontSet.
Note, GetAlias() do not taken into account in Equals(object). The same font with different alias will not be replaced. Alias will replace original font family in font selector algorithm.- See Also
AddFont(FontProgram, string)
Add not supported for auto creating FontPrograms.
public bool AddFont(FontProgram fontProgram, string encoding)
Parameters
fontProgram
FontProgramencoding
stringFontEncoding for creating PdfFont.
Returns
- bool
true, if font was successfully added, otherwise false.
- See Also
AddFont(FontProgram, string, string)
Add not supported for auto creating FontPrograms.
public bool AddFont(FontProgram fontProgram, string encoding, string alias)
Parameters
fontProgram
FontProgramencoding
stringFontEncoding for creating PdfFont
alias
stringfont alias.
Returns
- bool
true, if font was successfully added, otherwise false.
Remarks
Add not supported for auto creating FontPrograms.
Note, GetAlias() do not taken into account in Equals(object). The same font with different alias will not be replaced. Alias will replace original font family in font selector algorithm.- See Also
AddFont(FontProgram, string, string, Range)
Add not supported for auto creating FontPrograms.
public bool AddFont(FontProgram fontProgram, string encoding, string alias, Range unicodeRange)
Parameters
fontProgram
FontProgramencoding
stringFontEncoding for creating PdfFont
alias
stringfont alias.
unicodeRange
Rangesets the specific range of characters to be used from the font
Returns
- bool
true, if font was successfully added, otherwise false.
Remarks
Add not supported for auto creating FontPrograms.
Note, GetAlias() do not taken into account in Equals(object). The same font with different alias will not be replaced. Alias will replace original font family in font selector algorithm.- See Also
AddFont(FontInfo)
Adds FontInfo.
public bool AddFont(FontInfo fontInfo)
Parameters
fontInfo
FontInfofont info.
Returns
- bool
true, if font was successfully added, otherwise false.
Remarks
Adds FontInfo . Could be used to fill temporary font set.
Note, GetAlias() do not taken into account in Equals(object). The same font with different alias will not be replaced.- See Also
AddFont(FontInfo, string)
Adds FontInfo with alias.
public bool AddFont(FontInfo fontInfo, string alias)
Parameters
Returns
- bool
true, if font was successfully added, otherwise false.
Remarks
Adds FontInfo with alias. Could be used to fill temporary font set.
Note, GetAlias() do not taken into account in Equals(object). The same font with different alias will not be replaced. Alias will replace original font family in font selector algorithm.- See Also
AddFont(FontInfo, string, Range)
Adds FontInfo with alias.
public bool AddFont(FontInfo fontInfo, string alias, Range unicodeRange)
Parameters
fontInfo
FontInfofont info.
alias
stringfont alias.
unicodeRange
Rangesets the specific range of characters to be used from the font
Returns
- bool
true, if font was successfully added, otherwise false.
Remarks
Adds FontInfo with alias. Could be used to fill temporary font set.
Note, GetAlias() do not taken into account in Equals(object). The same font with different alias will not be replaced. Alias will replace original font family in font selector algorithm.- See Also
Contains(string)
Search in existed fonts for PostScript name or full font name.
public bool Contains(string fontName)
Parameters
fontName
stringPostScript or full name.
Returns
Remarks
Search in existed fonts for PostScript name or full font name.
Note, this method has O(n) complexity.- See Also
Get(string)
Search in existed fonts for PostScript name or full font name.
public ICollection<FontInfo> Get(string fontName)
Parameters
fontName
stringPostScript or full name.
Returns
- ICollection<FontInfo>
Collection of FontInfo from set of fonts with given PostScript or full name.
Remarks
Search in existed fonts for PostScript name or full font name.
Note, this method has O(n) complexity.- See Also
GetFonts()
Gets available fonts.
public ICollection<FontInfo> GetFonts()
Returns
- ICollection<FontInfo>
set of all available fonts
Remarks
Gets available fonts.
Note, the collection is unmodifiable.- See Also
GetFonts(FontSet)
Gets union of available and temporary fonts.
public ICollection<FontInfo> GetFonts(FontSet additionalFonts)
Parameters
additionalFonts
FontSetset of temporary fonts
Returns
- ICollection<FontInfo>
set of all available and temporary fonts
Remarks
Gets union of available and temporary fonts.
Note, the collection is unmodifiable.- See Also
IsEmpty()
Returns true if this set contains no elements.
public bool IsEmpty()
Returns
- See Also
Size()
Returns the number of elements in this set.
public int Size()
Returns
- int
the number of elements in this set
- See Also