Class Cmap


  • public final class Cmap
    extends Table
    Gives access to a 'cmap' table.

    Encoding forms support

    A number of subtable formats are designed to combine the decoding of a character stream and the computation of the glyph ID. For example, format 8 is geared to support encoding forms with one or two 16 bits code units (such as UTF-16) and has a 64K bit array to indicate those code units which represent a code point on their own and those code units which are the first of a pair. The idea is that the details of the encoding form can be captured in the font.

    Our point of view is that encoding forms are not the business of fonts, so we ignore those parts of those formats.

    Version handling

    'cmap' tables have only a minor version number. This implementation:

    • fully supports version 0 tables
    • interprets version x > 0 tables as version 0 tables
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int char2glyph​(int ch, int index)  
      int coolTypeUnicodeChar2glyph​(int usv)
      Approximates CoolType's interpretation of cmaps.
      void enumerateCmaps​(Cmap.CmapSelector selector)
      Enumerate the cmaps contained in the cmap table.
      int getCmapSubtableIndex​(int platformId, int encodingId)  
      int getHighestMappedCode​(int stOffset, boolean max2bytes)
      Get the character code that is the highest that is mapped by the cmap found at stOffset.
      int getLowestMappedCode​(int stOffset)
      Get the character code that is the lowest that is mapped by the cmap found at stOffset.
      int getMapping​(int stOffset, int charCode)
      Get the glyphID for charCode using the subtable at stOffset.
      int getOffset​(int subtableIndex)  
      int[] glyph2char​(int numGlyphs, int index)
      Get the inverted mapping from glyphs to characters for one subtable.
      boolean isSymbolic()
      Tell whether the font is symbolic.
      int probe​(int platformID, int encodingID)
      Return the offset of a give cmap subtable if present, -1 otherwise.
      void stream​(java.util.Map tables)  
      void streamForSWF​(java.util.Map tables, int numGlyphs)  
      void subsetAndStream​(Subset subset, SubsetSimpleTrueType ttSubset, java.util.Map tables)
      In the SubsetSimpleTrueType case, the client will have provided a cmap and a set of codepoints to map against it.
      void subsetAndStreamForSWF​(java.util.TreeSet codePoints, Subset subset, java.util.Map tables, boolean includeVariationCmap)  
      int unicodeChar2glyph​(int usv)
      Get the glyph mapped from a given character.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait