Type1SubsetFile (Apache FOP Core 2.11 API)
Date: 2025-04-24

org.apache.fop.fonts.type1

## Class Type1SubsetFile

- java.lang.Object
- - org.apache.fop.fonts.type1.Type1SubsetFile

-     public class Type1SubsetFile
      extends Object

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `Type1SubsetFile.BinaryCoder` A class to encode and decode sections of a type 1 font file.
    `static class` | `Type1SubsetFile.BytesNumber` A class used to store the last number operand and also it's size in bytes

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected List<String>` | `charNames`
    `protected String` | `eol`
    `protected List<PostscriptParser.PSElement>` | `headerSection`
    `protected static org.apache.commons.logging.Log` | `LOG`
    `protected List<PostscriptParser.PSElement>` | `mainSection`
    `protected boolean` | `standardEncoding`
    `protected HashMap<String,byte[]>` | `subsetCharStrings`
    `protected boolean` | `subsetSubroutines`
    `protected LinkedHashMap<Integer,byte[]>` | `uniqueSubs`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `Type1SubsetFile()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `byte[]` | `createSubset(InputStream in, SingleByteFont sbfont)`
    `protected String` | `findVariable(byte[] decoded, List<PostscriptParser.PSElement> elements, String[] matches, String fallback)`
    `protected byte[]` | `getBinaryEntry(int[] position, byte[] decoded)` Returns a section of a byte array determined by it's start and end position.
    `protected PostscriptParser.PSElement` | `getElement(String elementID, List<PostscriptParser.PSElement> elements)`
    `protected String` | `getEntryPart(String entry, int part)`
    `protected List<String>` | `searchEntries(HashMap<Integer,String> encodingEntries, int glyph)`
    `byte[]` | `stitchFont(ByteArrayOutputStream boasHeader, ByteArrayOutputStream boasMain, ByteArrayOutputStream boasTrailer)`
    `protected ByteArrayOutputStream` | `writeHeader(PFBData pfbData, PostscriptParser.PSElement encoding)`
    `protected ByteArrayOutputStream` | `writeMainSection(byte[] decoded, List<PostscriptParser.PSElement> mainSection, PostscriptParser.PSElement charStrings)`
    `protected void` | `writeString(String entry, ByteArrayOutputStream boas)`

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

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

- - ### Field Detail

    - #### LOG

          protected static final org.apache.commons.logging.Log LOG

    - #### subsetCharStrings

          protected HashMap<String,byte[]> subsetCharStrings

    - #### charNames

          protected List<String> charNames

    - #### uniqueSubs

          protected LinkedHashMap<Integer,byte[]> uniqueSubs

    - #### eol

          protected String eol

    - #### subsetSubroutines

          protected boolean subsetSubroutines

    - #### headerSection

          protected List<PostscriptParser.PSElement> headerSection

    - #### mainSection

          protected List<PostscriptParser.PSElement> mainSection

    - #### standardEncoding

          protected boolean standardEncoding

  - ### Constructor Detail

    - #### Type1SubsetFile

          public Type1SubsetFile()

  - ### Method Detail

    - #### createSubset

          public byte[] createSubset(InputStream in,
                                     SingleByteFont sbfont)
                              throws IOException

      Throws:
        `IOException`

    - #### stitchFont

          public byte[] stitchFont(ByteArrayOutputStream boasHeader,
                                   ByteArrayOutputStream boasMain,
                                   ByteArrayOutputStream boasTrailer)
                            throws IOException

      Throws:
        `IOException`

    - #### searchEntries

          protected List<String> searchEntries(HashMap<Integer,String> encodingEntries,
                                               int glyph)

    - #### writeHeader

          protected ByteArrayOutputStream writeHeader(PFBData pfbData,
                                                      PostscriptParser.PSElement encoding)
                                               throws IOException

      Throws:
        `IOException`

    - #### writeMainSection

          protected ByteArrayOutputStream writeMainSection(byte[] decoded,
                                                           List<PostscriptParser.PSElement> mainSection,
                                                           PostscriptParser.PSElement charStrings)
                                                    throws IOException

      Throws:
        `IOException`

    - #### findVariable

          protected String findVariable(byte[] decoded,
                                        List<PostscriptParser.PSElement> elements,
                                        String[] matches,
                                        String fallback)
                                 throws UnsupportedEncodingException

      Throws:
        `UnsupportedEncodingException`

    - #### writeString

          protected void writeString(String entry,
                                     ByteArrayOutputStream boas)
                              throws IOException

      Throws:
        `IOException`

    - #### getBinaryEntry

          protected byte[] getBinaryEntry(int[] position,
                                          byte[] decoded)

      Returns a section of a byte array determined by it's start and end position.
      Parameters:
        `position` - An array containing both the start and end position of the section to copy.
        `decoded` - The array from which to copy a section of data
      Returns:
        Returns the copy of the data section

    - #### getEntryPart

          protected String getEntryPart(String entry,
                                        int part)

    - #### getElement

          protected PostscriptParser.PSElement getElement(String elementID,
                                                          List<PostscriptParser.PSElement> elements)

Copyright © 2025 Apache Software Foundation. All rights reserved.