Package com.itextpdf.io.font
Class TrueTypeCollection
- java.lang.Object
-
- com.itextpdf.io.font.TrueTypeCollection
-
public class TrueTypeCollection extends java.lang.ObjectUse this class for working with true type collection font (*.ttc)
-
-
Constructor Summary
Constructors Constructor Description TrueTypeCollection(byte[] ttc)Creates a newTrueTypeCollectioninstance by its bytes.TrueTypeCollection(java.lang.String ttcPath)Creates a newTrueTypeCollectioninstance by its file path.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description FontProgramgetFontByTccIndex(int ttcIndex)method return TrueTypeFont by ttc indexintgetTTCSize()returns the number of fonts in True Type Collection (file or bytes array)private voidinitFontSize()booleanisCached()Indicates if fonts created by the call togetFontByTccIndex(int)will be cached or not.voidsetCached(boolean cached)Sets if fonts created by the call togetFontByTccIndex(int)will be cached or not.
-
-
-
Field Detail
-
raf
protected RandomAccessFileOrArray raf
-
TTCSize
private int TTCSize
-
ttcPath
private java.lang.String ttcPath
-
ttc
private byte[] ttc
-
cached
private boolean cached
-
-
Constructor Detail
-
TrueTypeCollection
public TrueTypeCollection(byte[] ttc) throws java.io.IOExceptionCreates a newTrueTypeCollectioninstance by its bytes.- Parameters:
ttc- the byte contents of the collection- Throws:
java.io.IOException- in case the input in mal-formatted
-
TrueTypeCollection
public TrueTypeCollection(java.lang.String ttcPath) throws java.io.IOExceptionCreates a newTrueTypeCollectioninstance by its file path.- Parameters:
ttcPath- the path of the collection- Throws:
java.io.IOException- in case the input in mal-formatted
-
-
Method Detail
-
getFontByTccIndex
public FontProgram getFontByTccIndex(int ttcIndex) throws java.io.IOException
method return TrueTypeFont by ttc index- Parameters:
ttcIndex- the index for the TTC font- Returns:
- TrueTypeFont
- Throws:
java.io.IOException- in case TTC index does not exist in this TTC file
-
getTTCSize
public int getTTCSize()
returns the number of fonts in True Type Collection (file or bytes array)- Returns:
- returns the number of fonts
-
isCached
public boolean isCached()
Indicates if fonts created by the call togetFontByTccIndex(int)will be cached or not.- Returns:
trueif the created fonts will be cached,falseotherwise
-
setCached
public void setCached(boolean cached)
Sets if fonts created by the call togetFontByTccIndex(int)will be cached or not.- Parameters:
cached-trueif the created fonts will be cached,falseotherwise
-
initFontSize
private void initFontSize() throws java.io.IOException- Throws:
java.io.IOException
-
-