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(FontInfo fontInfo)
Adds FontInfo .
|
boolean |
addFont(FontInfo fontInfo, String alias)
Adds FontInfo with alias.
|
boolean |
addFont(FontProgram fontProgram, String encoding)
Add not supported for auto creating FontPrograms.
|
boolean |
addFont(FontProgram fontProgram, String encoding, String alias)
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 |
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 tempFonts)
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(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.
fontProgram
- FontProgram
encoding
- FontEncoding for creating PdfFont
alias
- font alias.
public boolean addFont(FontProgram fontProgram, String encoding)
Note, FontInfo.getAlias()
do not taken into account in FontInfo.equals(java.lang.Object)
. The same font with different alias will not be replaced.
fontProgram
- FontProgram
encoding
- FontEncoding for creating PdfFont
.
public 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.
fontPath
- path to font data.
encoding
- preferred font encoding.
alias
- font alias.
PdfEncodings
public boolean addFont(String fontPath, String encoding)
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.
fontPath
- path to font data.
encoding
- preferred font encoding.
PdfEncodings
public 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.
fontData
- font data.
encoding
- preferred font encoding.
alias
- font alias.
PdfEncodings
public boolean addFont(byte[] fontData, String encoding)
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.
fontData
- font data.
encoding
- preferred font encoding.
PdfEncodings
public boolean addFont(String fontPath)
FontInfo
, fetches FontProgramDescriptor
and adds just created FontInfo
to FontSet
. FontProvider.getDefaultEncoding(FontProgram)
will be used to determine encoding.
Note, FontInfo.getAlias()
do not taken into account in FontInfo.equals(java.lang.Object)
. The same font with different alias will not be replaced.
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.
Note, FontInfo.getAlias()
do not taken into account in FontInfo.equals(java.lang.Object)
. The same font with different alias will not be replaced.
fontData
- font data.
public 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.
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 tempFonts)
Note, the collection is unmodifiable.
public boolean isEmpty()
true
if this set contains no elements.
true
if this set contains no elements
public int size()
Copyright © 1998–2018 iText Group NV. All rights reserved.