TrueTypeCollection
Date: 2017-05-25

org.apache.fontbox.ttf

## Class TrueTypeCollection

- java.lang.Object
- - org.apache.fontbox.ttf.TrueTypeCollection

- All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable

      public class TrueTypeCollection
      extends java.lang.Object
      implements java.io.Closeable

  A TrueType Collection, now more properly known as a "Font Collection" as it may contain either TrueType or OpenType fonts.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static interface` | `TrueTypeCollection.TrueTypeFontProcessor` Implement the callback method to call `processAllFonts(TrueTypeFontProcessor)`.

  - ### Constructor Summary

    Constructors
    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.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `close()`
    `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.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### TrueTypeCollection

          public TrueTypeCollection(java.io.File file)
                             throws java.io.IOException

      Creates a new TrueTypeCollection from a .ttc file.
      Parameters:
        `file` - The TTC file.
      Throws:
        `java.io.IOException` - If the font could not be parsed.

    - #### TrueTypeCollection

          public TrueTypeCollection(java.io.InputStream stream)
                             throws java.io.IOException

      Creates a new TrueTypeCollection from a .ttc input stream.
      Parameters:
        `stream` - A TTC input stream.
      Throws:
        `java.io.IOException` - If the font could not be parsed.

  - ### Method Detail

    - #### processAllFonts

          public void processAllFonts(TrueTypeCollection.TrueTypeFontProcessor trueTypeFontProcessor)
                               throws java.io.IOException

      Run the callback for each TT font in the collection.
      Parameters:
        `trueTypeFontProcessor` - the object with the callback method.
      Throws:
        `java.io.IOException`

    - #### getFontByName

          public TrueTypeFont getFontByName(java.lang.String name)
                                     throws java.io.IOException

      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:
        `java.io.IOException`

    - #### close

          public void close()
                     throws java.io.IOException

      Specified by:
        `close` in interface `java.io.Closeable`
      Specified by:
        `close` in interface `java.lang.AutoCloseable`
      Throws:
        `java.io.IOException`