public final class FontSet extends Object
A FontSet instance could be shared for multiple threads. However FontSet filling is not thread safe operation.
FontProvider| Constructor and Description |
|---|
FontSet()
Creates a new instance of
FontSet. |
| Modifier and Type | Method and Description |
|---|---|
int |
addDirectory(String dir)
Add all the fonts in a directory.
|
int |
addDirectory(String dir,
boolean scanSubdirectories)
Add all the fonts in a directory and possibly its subdirectories.
|
boolean |
addFont(byte[] fontData)
|
boolean |
addFont(byte[] fontData,
String encoding)
|
boolean |
addFont(byte[] fontData,
String encoding,
String alias)
|
boolean |
addFont(byte[] fontData,
String encoding,
String alias,
Range unicodeRange)
|
boolean |
addFont(FontInfo fontInfo)
Adds
FontInfo. |
boolean |
addFont(FontInfo fontInfo,
String alias)
Adds
FontInfo with alias. |
boolean |
addFont(FontInfo fontInfo,
String alias,
Range unicodeRange)
Adds
FontInfo with alias. |
boolean |
addFont(com.itextpdf.io.font.FontProgram fontProgram,
String encoding)
Add not supported for auto creating FontPrograms.
|
boolean |
addFont(com.itextpdf.io.font.FontProgram fontProgram,
String encoding,
String alias)
Add not supported for auto creating FontPrograms.
|
boolean |
addFont(com.itextpdf.io.font.FontProgram fontProgram,
String encoding,
String alias,
Range unicodeRange)
Add not supported for auto creating FontPrograms.
|
boolean |
addFont(String fontPath)
|
boolean |
addFont(String fontPath,
String encoding)
|
boolean |
addFont(String fontPath,
String encoding,
String alias)
|
boolean |
addFont(String fontPath,
String encoding,
String alias,
Range unicodeRange)
|
boolean |
contains(String fontName)
Search in existed fonts for PostScript name or full font name.
|
Collection<FontInfo> |
get(String fontName)
Search in existed fonts for PostScript name or full font name.
|
Collection<FontInfo> |
getFonts()
Gets available fonts.
|
Collection<FontInfo> |
getFonts(FontSet additionalFonts)
Gets union of available and temporary fonts.
|
boolean |
isEmpty()
Returns
true if this set contains no elements. |
int |
size()
Returns the number of elements in this set.
|
public FontSet()
FontSet.public int addDirectory(String dir, boolean scanSubdirectories)
dir - path to directory.scanSubdirectories - recursively scan subdirectories if true.public int addDirectory(String dir)
dir - path to directory.public boolean addFont(com.itextpdf.io.font.FontProgram fontProgram,
String encoding,
String alias,
Range unicodeRange)
Note, FontInfo.getAlias() do not taken into account in FontInfo.equals(java.lang.Object).
The same font with different alias will not be replaced.
Alias will replace original font family in font selector algorithm.
fontProgram - FontProgramencoding - FontEncoding for creating PdfFontalias - font alias.unicodeRange - sets the specific range of characters to be used from the fontpublic boolean addFont(com.itextpdf.io.font.FontProgram fontProgram,
String encoding,
String alias)
Note, FontInfo.getAlias() do not taken into account in FontInfo.equals(java.lang.Object).
The same font with different alias will not be replaced.
Alias will replace original font family in font selector algorithm.
fontProgram - FontProgramencoding - FontEncoding for creating PdfFontalias - font alias.public boolean addFont(com.itextpdf.io.font.FontProgram fontProgram,
String encoding)
fontProgram - FontProgramencoding - FontEncoding for creating PdfFont.public boolean addFont(String fontPath, String encoding, String alias, Range unicodeRange)
FontInfo, fetches FontProgramDescriptor
and adds just created FontInfo to FontSet.
Note, FontInfo.getAlias() do not taken into account in FontInfo.equals(java.lang.Object).
The same font with different alias will not be replaced.
Alias will replace original font family in font selector algorithm.
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 fontPdfEncodingspublic boolean addFont(String fontPath, String encoding, String alias)
FontInfo, fetches FontProgramDescriptor
and adds just created FontInfo to FontSet.
Note, FontInfo.getAlias() do not taken into account in FontInfo.equals(java.lang.Object).
The same font with different alias will not be replaced.
Alias will replace original font family in font selector algorithm.
fontPath - path to font data.encoding - preferred font encoding.alias - font alias.PdfEncodingspublic boolean addFont(String fontPath, String encoding)
fontPath - path to font data.encoding - preferred font encoding.PdfEncodingspublic boolean addFont(byte[] fontData,
String encoding,
String alias,
Range unicodeRange)
FontInfo, fetches FontProgramDescriptor
and adds just created FontInfo to FontSet.
Note, FontInfo.getAlias() do not taken into account in FontInfo.equals(java.lang.Object).
The same font with different alias will not be replaced.
Alias will replace original font family in font selector algorithm.
fontData - font data.encoding - preferred font encoding.alias - font alias.unicodeRange - sets the specific range of characters to be used from the fontPdfEncodingspublic boolean addFont(byte[] fontData,
String encoding,
String alias)
FontInfo, fetches FontProgramDescriptor
and adds just created FontInfo to FontSet.
Note, FontInfo.getAlias() do not taken into account in FontInfo.equals(java.lang.Object).
The same font with different alias will not be replaced.
Alias will replace original font family in font selector algorithm.
fontData - font data.encoding - preferred font encoding.alias - font alias.PdfEncodingspublic boolean addFont(byte[] fontData,
String encoding)
fontData - font data.encoding - preferred font encoding.PdfEncodingspublic boolean addFont(String fontPath)
FontInfo, fetches FontProgramDescriptor
and adds just created FontInfo to FontSet.
FontProvider.getDefaultEncoding(FontProgram) will be used to determine encoding.fontPath - path to font data.public boolean addFont(byte[] fontData)
FontInfo, fetches FontProgramDescriptor
and adds just created FontInfo to FontSet.
FontProvider.getDefaultEncoding(FontProgram) will be used to determine encoding.fontData - font data.public boolean addFont(FontInfo fontInfo, String alias, Range unicodeRange)
FontInfo with alias. Could be used to fill temporary font set.
Note, FontInfo.getAlias() do not taken into account in FontInfo.equals(java.lang.Object).
The same font with different alias will not be replaced.
Alias will replace original font family in font selector algorithm.
fontInfo - font info.alias - font alias.unicodeRange - sets the specific range of characters to be used from the fontpublic boolean addFont(FontInfo fontInfo, String alias)
FontInfo with alias. Could be used to fill temporary font set.
Note, FontInfo.getAlias() do not taken into account in FontInfo.equals(java.lang.Object).
The same font with different alias will not be replaced.
Alias will replace original font family in font selector algorithm.
fontInfo - font info.alias - font alias.public final boolean addFont(FontInfo fontInfo)
FontInfo. Could be used to fill temporary font set.
Note, FontInfo.getAlias() do not taken into account in FontInfo.equals(java.lang.Object).
The same font with different alias will not be replaced.
fontInfo - font info.public boolean contains(String fontName)
Note, this method has O(n) complexity.
fontName - PostScript or full name.FontSet contains font with given name.public Collection<FontInfo> get(String fontName)
Note, this method has O(n) complexity.
fontName - PostScript or full name.FontInfo from set of fonts with given PostScript or full name.public Collection<FontInfo> getFonts()
Note, the collection is unmodifiable.
public Collection<FontInfo> getFonts(FontSet additionalFonts)
Note, the collection is unmodifiable.
additionalFonts - set of temporary fontspublic boolean isEmpty()
true if this set contains no elements.true if this set contains no elementspublic int size()
Copyright © 1998–2020 iText Group NV. All rights reserved.