Class TrueTypeCollection
java.lang.Object
org.apache.fontbox.ttf.TrueTypeCollection
- All Implemented Interfaces:
Closeable, AutoCloseable
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceImplement the callback method to callprocessAllFonts(TrueTypeFontProcessor). -
Constructor Summary
ConstructorsConstructorDescriptionTrueTypeCollection(File file) Creates a new TrueTypeCollection from a .ttc file.TrueTypeCollection(InputStream stream) Creates a new TrueTypeCollection from a .ttc input stream. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()getFontByName(String name) Get a TT font from a collection.voidprocessAllFonts(TrueTypeCollection.TrueTypeFontProcessor trueTypeFontProcessor) Run the callback for each TT font in the collection.
-
Constructor Details
-
TrueTypeCollection
Creates a new TrueTypeCollection from a .ttc file.- Parameters:
file- The TTC file.- Throws:
IOException- If the font could not be parsed.
-
TrueTypeCollection
Creates a new TrueTypeCollection from a .ttc input stream.- Parameters:
stream- A TTC input stream.- Throws:
IOException- If the font could not be parsed.
-
-
Method Details
-
processAllFonts
public void processAllFonts(TrueTypeCollection.TrueTypeFontProcessor trueTypeFontProcessor) throws IOException Run the callback for each TT font in the collection.- Parameters:
trueTypeFontProcessor- the object with the callback method.- Throws:
IOException
-
getFontByName
Get a TT font from a collection.- Parameters:
name- The postscript name of the font.- Returns:
- The found font, nor null if none is found.
- Throws:
IOException
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-