org.apache.fop.fonts.truetype

## Class OFFontLoader

- java.lang.Object
- - org.apache.fop.fonts.FontLoader
  - - org.apache.fop.fonts.truetype.OFFontLoader

-     public class OFFontLoader
      extends FontLoader

  Loads a TrueType font into memory directly from the original font file.

- - ### Field Summary

    - ### Fields inherited from class org.apache.fop.fonts.FontLoader

      `embedded, fontFileURI, loaded, log, resourceResolver, returnFont, useAdvanced, useKerning`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `OFFontLoader(URI fontFileURI, InternalResourceResolver resourceResolver)` Default constructor
    `OFFontLoader(URI fontFileURI, String subFontName, boolean embedded, EmbeddingMode embeddingMode, EncodingMode encodingMode, boolean useKerning, boolean useAdvanced, InternalResourceResolver resolver, boolean simulateStyle, boolean embedAsType1, boolean useSVG)` Additional constructor for TrueType Collections.

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected void` | `read()` Reads/parses the font data.
    `static String` | `readHeader(FontFileReader fontFile)`

    - ### Methods inherited from class org.apache.fop.fonts.FontLoader

      `getFont, loadFont`

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

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

- - ### Constructor Detail

    - #### OFFontLoader

          public OFFontLoader(URI fontFileURI,
                              InternalResourceResolver resourceResolver)

      Default constructor
      Parameters:
        `fontFileURI` - the URI representing the font file
        `resourceResolver` - the resource resolver for font URI resolution

    - #### OFFontLoader

          public OFFontLoader(URI fontFileURI,
                              String subFontName,
                              boolean embedded,
                              EmbeddingMode embeddingMode,
                              EncodingMode encodingMode,
                              boolean useKerning,
                              boolean useAdvanced,
                              InternalResourceResolver resolver,
                              boolean simulateStyle,
                              boolean embedAsType1,
                              boolean useSVG)

      Additional constructor for TrueType Collections.
      Parameters:
        `fontFileURI` - the URI representing the font file
        `subFontName` - the sub-fontname of a font in a TrueType Collection (or null for normal TrueType fonts)
        `embedded` - indicates whether the font is embedded or referenced
        `embeddingMode` - the embedding mode of the font
        `encodingMode` - the requested encoding mode
        `useKerning` - true to enable loading kerning info if available, false to disable
        `useAdvanced` - true to enable loading advanced info if available, false to disable
        `resolver` - the FontResolver for font URI resolution
        `simulateStyle` - Determines whether to simulate font styles if a font does not support those by default.

  - ### Method Detail

    - #### read

          protected void read()
                       throws IOException

      Reads/parses the font data.
      Specified by:
        `read` in class `FontLoader`
      Throws:
        `IOException` - In case of an I/O error

    - #### readHeader

          public static String readHeader(FontFileReader fontFile)
                                   throws IOException

      Throws:
        `IOException`

Copyright © 2025 Apache Software Foundation. All rights reserved.