public class TrueTypeCollection
extends java.lang.Object
implements java.io.Closeable
Modifier and Type | Class and Description |
---|---|
static interface |
TrueTypeCollection.TrueTypeFontProcessor
Implement the callback method to call
processAllFonts(TrueTypeFontProcessor) . |
Modifier and Type | Field and Description |
---|---|
private long[] |
fontOffsets |
private int |
numFonts |
private TTFDataStream |
stream |
Constructor and Description |
---|
TrueTypeCollection(java.io.File file)
Creates a new TrueTypeCollection from a .ttc file.
|
TrueTypeCollection(java.io.InputStream stream)
Creates a new TrueTypeCollection from a .ttc input stream.
|
TrueTypeCollection(TTFDataStream stream)
Creates a new TrueTypeCollection from a TTC stream.
|
Modifier and Type | Method and Description |
---|---|
void |
close() |
private TrueTypeFont |
getFontAtIndex(int idx) |
TrueTypeFont |
getFontByName(java.lang.String name)
Get a TT font from a collection.
|
void |
processAllFonts(TrueTypeCollection.TrueTypeFontProcessor trueTypeFontProcessor)
Run the callback for each TT font in the collection.
|
private final TTFDataStream stream
private final int numFonts
private final long[] fontOffsets
public TrueTypeCollection(java.io.File file) throws java.io.IOException
file
- The TTC file.java.io.IOException
- If the font could not be parsed.public TrueTypeCollection(java.io.InputStream stream) throws java.io.IOException
stream
- A TTC input stream.java.io.IOException
- If the font could not be parsed.TrueTypeCollection(TTFDataStream stream) throws java.io.IOException
stream
- The TTF file.java.io.IOException
- If the font could not be parsed.public void processAllFonts(TrueTypeCollection.TrueTypeFontProcessor trueTypeFontProcessor) throws java.io.IOException
trueTypeFontProcessor
- the object with the callback method.java.io.IOException
private TrueTypeFont getFontAtIndex(int idx) throws java.io.IOException
java.io.IOException
public TrueTypeFont getFontByName(java.lang.String name) throws java.io.IOException
name
- The postscript name of the font.java.io.IOException
public void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
java.io.IOException