org.apache.fop.render.pdf.pdfbox

## Class MergeTTFonts

- java.lang.Object
- - org.apache.fop.fonts.truetype.OpenFont
  - - org.apache.fop.fonts.truetype.TTFFile
    - - org.apache.fop.fonts.truetype.TTFSubSetFile
      - - org.apache.fop.render.pdf.pdfbox.MergeTTFonts

- All Implemented Interfaces:
    MergeFonts

      public class MergeTTFonts
      extends org.apache.fop.fonts.truetype.TTFSubSetFile
      implements MergeFonts

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `MergeTTFonts.Cmap`

    - ### 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 MaximumProfileTable` | `maxp`

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

      `currentPos, glyphOffsets, locaOffset, newDirTabs, offsets, output, realSize`

    - ### 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
    `MergeTTFonts(java.util.List<MergeTTFonts.Cmap> cmap)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected int[]` | `buildSubsetIndexToOrigIndexMap(java.util.Map<java.lang.Integer,java.lang.Integer> glyphs)` Get index from starting at lowest glyph position
    `protected void` | `createHmtx()` Create the hmtx table by copying metrics from original font to subset font.
    `byte[]` | `getMergedFontSubset()`
    `void` | `readFont(java.io.InputStream is, java.lang.String name, FontContainer fontContainer, java.util.Map<java.lang.Integer,java.lang.Integer> subsetGlyphs, boolean cid)` Returns a subset of the original font.
    `protected void` | `scanGlyphs(org.apache.fop.fonts.truetype.FontFileReader in, java.util.Map<java.lang.Integer,java.lang.Integer> subsetGlyphs)`

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

      `createCheckSumAdjustment, createCvt, createDirectory, createFpgm, createHead, createHhea, createHmtx, createLoca, createMaxp, createName, createOS2, createPost, createPrep, getCheckSum, getFontSubset, pad4, readFont, stream, updateCheckSum, writeBytes, writeULong, writeUShort, writeUShort`

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

      `getLastGlyfLocation, initializeFont, readIndexToLocation, 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`

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

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

- - ### Field Detail

    - #### maxp

          protected MaximumProfileTable maxp

  - ### Constructor Detail

    - #### MergeTTFonts

          public MergeTTFonts(java.util.List<MergeTTFonts.Cmap> cmap)

  - ### Method Detail

    - #### createHmtx

          protected void createHmtx()
                             throws java.io.IOException

      Create the hmtx table by copying metrics from original font to subset font. The glyphs Map contains an Integer key and Integer value that maps the original metric (key) to the subset metric (value)
      Throws:
        `java.io.IOException` - on error

    - #### readFont

          public void readFont(java.io.InputStream is,
                               java.lang.String name,
                               FontContainer fontContainer,
                               java.util.Map<java.lang.Integer,java.lang.Integer> subsetGlyphs,
                               boolean cid)
                        throws java.io.IOException

      Returns a subset of the original font.
      Specified by:
        `readFont` in interface `MergeFonts`
      Parameters:
        `is` - font file
        `name` - name
        `fontContainer` - fontContainer
        `subsetGlyphs` - Map of glyphs (glyphs has old index as (Integer) key and new index as (Integer) value)
        `cid` - is cid
      Throws:
        `java.io.IOException` - in case of an I/O problem

    - #### scanGlyphs

          protected void scanGlyphs(org.apache.fop.fonts.truetype.FontFileReader in,
                                    java.util.Map<java.lang.Integer,java.lang.Integer> subsetGlyphs)
                             throws java.io.IOException

      Overrides:
        `scanGlyphs` in class `org.apache.fop.fonts.truetype.TTFSubSetFile`
      Throws:
        `java.io.IOException`

    - #### getMergedFontSubset

          public byte[] getMergedFontSubset()
                                     throws java.io.IOException

      Specified by:
        `getMergedFontSubset` in interface `MergeFonts`
      Throws:
        `java.io.IOException`

    - #### buildSubsetIndexToOrigIndexMap

          protected int[] buildSubsetIndexToOrigIndexMap(java.util.Map<java.lang.Integer,java.lang.Integer> glyphs)

      Get index from starting at lowest glyph position
      Overrides:
        `buildSubsetIndexToOrigIndexMap` in class `org.apache.fop.fonts.truetype.TTFSubSetFile`
      Parameters:
        `glyphs` - map
      Returns:
        index map

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