org.apache.poi.hslf.record

## Class FontCollection

- java.lang.Object
- - org.apache.poi.hslf.record.Record
  - - org.apache.poi.hslf.record.RecordContainer
    - - org.apache.poi.hslf.record.FontCollection

- All Implemented Interfaces:
    GenericRecord

      public final class FontCollection
      extends RecordContainer

  `FontCollection` ia a container that holds information about all the fonts in the presentation.

- - ### Field Summary

    - ### Fields inherited from class org.apache.poi.hslf.record.RecordContainer

      `_children`

    - ### Fields inherited from class org.apache.poi.hslf.record.Record

      `logger`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `HSLFFontInfo` | `addFont(FontInfo fontInfo)` Add font with the given FontInfo configuration to the font collection.
    `HSLFFontInfo` | `addFont(java.io.InputStream fontData)`
    `HSLFFontInfo` | `getFontInfo(int index)` Lookup a FontInfo object by its internal font index
    `HSLFFontInfo` | `getFontInfo(java.lang.String typeface)` Lookup a FontInfo object by its typeface
    `HSLFFontInfo` | `getFontInfo(java.lang.String typeface, FontCharset charset)` Lookup a FontInfo object by its typeface
    `java.util.List<HSLFFontInfo>` | `getFonts()`
    `java.util.Map<java.lang.String,java.util.function.Supplier<?>>` | `getGenericProperties()`
    `int` | `getNumberOfFonts()`
    `long` | `getRecordType()` Return the type, which is 2005
    `void` | `writeOut(java.io.OutputStream out)` Write the contents of the record back, so it can be written to disk

    - ### Methods inherited from class org.apache.poi.hslf.record.RecordContainer

      `addChildAfter, addChildBefore, appendChildRecord, findFirstOfType, getChildRecords, handleParentAwareRecords, isAnAtom, moveChildBefore, moveChildrenAfter, moveChildrenBefore, removeChild, setChildRecord, writeOut`

    - ### Methods inherited from class org.apache.poi.hslf.record.Record

      `buildRecordAtOffset, createRecordForType, findChildRecords, getGenericChildren, getGenericRecordType, writeLittleEndian, writeLittleEndian`

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

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

- - ### Method Detail

    - #### getRecordType

          public long getRecordType()

      Return the type, which is 2005
      Specified by:
        `getRecordType` in class `Record`

    - #### writeOut

          public void writeOut(java.io.OutputStream out)
                        throws java.io.IOException

      Write the contents of the record back, so it can be written to disk
      Specified by:
        `writeOut` in class `Record`
      Throws:
        `java.io.IOException`

    - #### addFont

          public HSLFFontInfo addFont(FontInfo fontInfo)

      Add font with the given FontInfo configuration to the font collection. The returned FontInfo contains the HSLF specific details and the collection uniquely contains fonts based on their typeface, i.e. calling the method with FontInfo objects having the same name results in the same HSLFFontInfo reference.
      Parameters:
        `fontInfo` - the FontInfo configuration, can be a instance of `HSLFFontInfo`, `HSLFFontInfoPredefined` or a custom implementation
      Returns:
        the register HSLFFontInfo object

    - #### addFont

          public HSLFFontInfo addFont(java.io.InputStream fontData)
                               throws java.io.IOException

      Throws:
        `java.io.IOException`

    - #### getFontInfo

          public HSLFFontInfo getFontInfo(java.lang.String typeface)

      Lookup a FontInfo object by its typeface
      Parameters:
        `typeface` - the full font name
      Returns:
        the HSLFFontInfo for the given name or `null` if not found

    - #### getFontInfo

          public HSLFFontInfo getFontInfo(java.lang.String typeface,
                                          FontCharset charset)

      Lookup a FontInfo object by its typeface
      Parameters:
        `typeface` - the full font name
        `charset` - the charset
      Returns:
        the HSLFFontInfo for the given name or `null` if not found

    - #### getFontInfo

          public HSLFFontInfo getFontInfo(int index)

      Lookup a FontInfo object by its internal font index
      Parameters:
        `index` - the internal font index
      Returns:
        the HSLFFontInfo for the given index or `null` if not found

    - #### getNumberOfFonts

          public int getNumberOfFonts()

      Returns:
        the number of registered fonts

    - #### getFonts

          public java.util.List<HSLFFontInfo> getFonts()

    - #### getGenericProperties

          public java.util.Map<java.lang.String,java.util.function.Supplier<?>> getGenericProperties()

      Specified by:
        `getGenericProperties` in interface `GenericRecord`
      Overrides:
        `getGenericProperties` in class `RecordContainer`

Copyright 2020 The Apache Software Foundation or its licensors, as applicable.