org.apache.fop.render.pdf.pdfbox

## Class OTFSubSetFile

- java.lang.Object
- - org.apache.fop.fonts.truetype.OpenFont
  - - org.apache.fop.fonts.truetype.OTFFile
    - - org.apache.fop.fonts.truetype.OTFSubSetWriter
      - - org.apache.fop.render.pdf.pdfbox.OTFSubSetFile

- Direct Known Subclasses:
    MergeCFFFonts

      public abstract class OTFSubSetFile
      extends org.apache.fop.fonts.truetype.OTFSubSetWriter

  Reads an OpenType CFF file and generates a subset The OpenType specification can be found at the Microsoft Typography site: http://www.microsoft.com/typography/otspec/

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class org.apache.fop.fonts.truetype.OpenFont

      `org.apache.fop.fonts.truetype.OpenFont.PostScriptVersion`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected org.apache.fop.fonts.cff.CFFDataReader` | `cffReader` The CFF reader object used to read data and offsets from the original font file
    `protected java.lang.String` | `embeddedName` The embedded name to change in the name table
    `protected java.util.Map<java.lang.Integer,java.lang.Integer>` | `gidToSID` A map of the new GID to SID used to construct the charset table
    `protected java.util.List<java.lang.Integer>` | `globalUniques`
    `protected java.util.List<java.lang.Integer>` | `localUniques` A list of unique subroutines from the global / local subroutine indexes
    `static int` | `NUM_STANDARD_STRINGS` The number of standard strings in CFF
    `protected java.util.List<byte[]>` | `stringIndexData` An array used to hold the string index data for the subset font
    `protected java.util.List<byte[]>` | `subsetCharStringsIndex` A list of char string data for each glyph to be stored in the subset font
    `protected java.util.List<byte[]>` | `subsetLocalIndexSubr` List of subroutines to write to the local / global indexes in the subset font

    - ### Fields inherited from class org.apache.fop.fonts.truetype.OTFSubSetWriter

      `currentPos, output`

    - ### Fields inherited from class org.apache.fop.fonts.truetype.OTFFile

      `fileFont`

    - ### Fields inherited from class org.apache.fop.fonts.truetype.OpenFont

      `advancedTableReader, cid, dirTabs, embedFontName, familyNames, fontFile, fullName, lastLoca, locaFormat, log, mtxTab, nhmtx, notice, numberOfGlyphs, postScriptName, subFamilyName, svgs, TRACE_ENABLED, unicodeMappings, useAdvanced, useKerning`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `OTFSubSetFile()`

  - ### Method Summary

    All Methods Static Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static byte[]` | `createNewRef(int newRef, int[] operatorCode, int forceLength)`
    `protected void` | `updateCIDOffsets(org.apache.fop.render.pdf.pdfbox.OTFSubSetFile.Offsets offsets)`
    `protected abstract void` | `updateFixedOffsets(java.util.Map<java.lang.String,org.apache.fop.fonts.cff.CFFDataReader.DICTEntry> topDICT, org.apache.fop.render.pdf.pdfbox.OTFSubSetFile.Offsets offsets)`
    `protected void` | `updateOffset(byte[] out, int position, int length, int replacement)`
    `protected void` | `updateOffset(int position, int length, int replacement)`
    `protected void` | `updateOffsets(org.apache.fop.render.pdf.pdfbox.OTFSubSetFile.Offsets offsets)`
    `protected byte[]` | `writeCIDCount(org.apache.fop.fonts.cff.CFFDataReader.DICTEntry dictEntry)`
    `protected int` | `writeIndex(java.util.List<byte[]> dataArray)`
    `protected int` | `writeIndex(java.util.List<byte[]> dataArray, int offSize)`
    `protected void` | `writePrivateDict()`
    `protected int` | `writeTopDICT()`

    - ### Methods inherited from class org.apache.fop.fonts.truetype.OTFSubSetWriter

      `concatArray, getFontSubset, writeByte, writeBytes, writeCard16, writeThreeByteNumber, writeULong`

    - ### Methods inherited from class org.apache.fop.fonts.truetype.OTFFile

      `getCFFData, initializeFont, isType1, readName, updateBBoxAndOffset`

    - ### Methods inherited from class org.apache.fop.fonts.truetype.OpenFont

      `checkTTC, convertTTFUnit2PDFUnit, createCMaps, determineAscDesc, getAnsiKerning, getBBox, getBBoxRaw, getBoundingBoxes, getCapHeight, getCharSetName, getCharWidth, getCharWidthRaw, getCMaps, getCopyrightNotice, getDirectoryEntry, getEmbedFontName, getFamilyNames, getFirstChar, getFlags, getFontBBox, getFullName, getGDEF, getGPOS, getGSUB, getItalicAngle, getKerning, getLastChar, getLowerCaseAscent, getLowerCaseDescent, getMtx, getNumGlyphs, getPadSize, getPostScriptName, getStemV, getStrikeoutPosition, getStrikeoutThickness, getSubFamilyName, getTTCnames, getUnderlinePosition, getUnderlineThickness, getWeightClass, getWidths, getXHeight, guessVerticalMetricsFromGlyphBBox, handleCharacterSpacing, hasAdvancedTable, initAnsiWidths, isCFF, isEmbeddable, main, printStuff, readCMAP, readDirTabs, readFont, readFont, readFont, readFontHeader, readHorizontalHeader, readHorizontalMetrics, readKerning, readOS2, readPCLT, readPostScript, seekTab, stream`

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

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

- - ### Field Detail

    - #### gidToSID

          protected java.util.Map<java.lang.Integer,java.lang.Integer> gidToSID

      A map of the new GID to SID used to construct the charset table

    - #### subsetLocalIndexSubr

          protected java.util.List<byte[]> subsetLocalIndexSubr

      List of subroutines to write to the local / global indexes in the subset font

    - #### localUniques

          protected java.util.List<java.lang.Integer> localUniques

      A list of unique subroutines from the global / local subroutine indexes

    - #### globalUniques

          protected java.util.List<java.lang.Integer> globalUniques

    - #### subsetCharStringsIndex

          protected java.util.List<byte[]> subsetCharStringsIndex

      A list of char string data for each glyph to be stored in the subset font

    - #### embeddedName

          protected java.lang.String embeddedName

      The embedded name to change in the name table

    - #### stringIndexData

          protected java.util.List<byte[]> stringIndexData

      An array used to hold the string index data for the subset font

    - #### cffReader

          protected org.apache.fop.fonts.cff.CFFDataReader cffReader

      The CFF reader object used to read data and offsets from the original font file

    - #### NUM_STANDARD_STRINGS

          public static final int NUM_STANDARD_STRINGS

      The number of standard strings in CFF
      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### OTFSubSetFile

          public OTFSubSetFile()
                        throws java.io.IOException

      Throws:
        `java.io.IOException`

  - ### Method Detail

    - #### writeTopDICT

          protected int writeTopDICT()
                              throws java.io.IOException

      Throws:
        `java.io.IOException`

    - #### writeCIDCount

          protected byte[] writeCIDCount(org.apache.fop.fonts.cff.CFFDataReader.DICTEntry dictEntry)
                                  throws java.io.IOException

      Throws:
        `java.io.IOException`

    - #### createNewRef

          public static byte[] createNewRef(int newRef,
                                            int[] operatorCode,
                                            int forceLength)

    - #### writeIndex

          protected int writeIndex(java.util.List<byte[]> dataArray)

    - #### writeIndex

          protected int writeIndex(java.util.List<byte[]> dataArray,
                                   int offSize)

    - #### writePrivateDict

          protected void writePrivateDict()
                                   throws java.io.IOException

      Throws:
        `java.io.IOException`

    - #### updateOffsets

          protected void updateOffsets(org.apache.fop.render.pdf.pdfbox.OTFSubSetFile.Offsets offsets)
                                throws java.io.IOException

      Throws:
        `java.io.IOException`

    - #### updateFixedOffsets

          protected abstract void updateFixedOffsets(java.util.Map<java.lang.String,org.apache.fop.fonts.cff.CFFDataReader.DICTEntry> topDICT,
                                                     org.apache.fop.render.pdf.pdfbox.OTFSubSetFile.Offsets offsets)
                                              throws java.io.IOException

      Throws:
        `java.io.IOException`

    - #### updateCIDOffsets

          protected void updateCIDOffsets(org.apache.fop.render.pdf.pdfbox.OTFSubSetFile.Offsets offsets)
                                   throws java.io.IOException

      Throws:
        `java.io.IOException`

    - #### updateOffset

          protected void updateOffset(int position,
                                      int length,
                                      int replacement)
                               throws java.io.IOException

      Throws:
        `java.io.IOException`

    - #### updateOffset

          protected void updateOffset(byte[] out,
                                      int position,
                                      int length,
                                      int replacement)

Copyright 2007-2025 The Apache Software Foundation. All Rights Reserved.