< prev index next >

src/java.desktop/share/native/libfreetype/src/sfnt/ttcmap.c

Print this page

        

@@ -1,21 +1,21 @@
-/***************************************************************************/
-/*                                                                         */
-/*  ttcmap.c                                                               */
-/*                                                                         */
-/*    TrueType character mapping table (cmap) support (body).              */
-/*                                                                         */
-/*  Copyright 2002-2018 by                                                 */
-/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
-/*                                                                         */
-/*  This file is part of the FreeType project, and may only be used,       */
-/*  modified, and distributed under the terms of the FreeType project      */
-/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */
-/*  this file you indicate that you have read the license and              */
-/*  understand and accept it fully.                                        */
-/*                                                                         */
-/***************************************************************************/
+/****************************************************************************
+ *
+ * ttcmap.c
+ *
+ *   TrueType character mapping table (cmap) support (body).
+ *
+ * Copyright (C) 2002-2019 by
+ * David Turner, Robert Wilhelm, and Werner Lemberg.
+ *
+ * This file is part of the FreeType project, and may only be used,
+ * modified, and distributed under the terms of the FreeType project
+ * license, LICENSE.TXT.  By continuing to use, modify, or distribute
+ * this file you indicate that you have read the license and
+ * understand and accept it fully.
+ *
+ */
 
 
 #include <ft2build.h>
 #include FT_INTERNAL_DEBUG_H
 

@@ -25,21 +25,20 @@
 #include FT_INTERNAL_STREAM_H
 #include FT_SERVICE_POSTSCRIPT_CMAPS_H
 #include "ttload.h"
 #include "ttcmap.h"
 #include "ttpost.h"
-#include "sfntpic.h"
 
 
-  /*************************************************************************/
-  /*                                                                       */
-  /* The macro FT_COMPONENT is used in trace mode.  It is an implicit      */
-  /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log  */
-  /* messages during execution.                                            */
-  /*                                                                       */
+  /**************************************************************************
+   *
+   * The macro FT_COMPONENT is used in trace mode.  It is an implicit
+   * parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log
+   * messages during execution.
+   */
 #undef  FT_COMPONENT
-#define FT_COMPONENT  trace_ttcmap
+#define FT_COMPONENT  ttcmap
 
 
 #define TT_PEEK_SHORT   FT_PEEK_SHORT
 #define TT_PEEK_USHORT  FT_PEEK_USHORT
 #define TT_PEEK_UINT24  FT_PEEK_UOFF3

@@ -75,23 +74,23 @@
   /*****                           FORMAT 0                            *****/
   /*****                                                               *****/
   /*************************************************************************/
   /*************************************************************************/
 
-  /*************************************************************************/
-  /*                                                                       */
-  /* TABLE OVERVIEW                                                        */
-  /* --------------                                                        */
-  /*                                                                       */
-  /*   NAME        OFFSET         TYPE          DESCRIPTION                */
-  /*                                                                       */
-  /*   format      0              USHORT        must be 0                  */
-  /*   length      2              USHORT        table length in bytes      */
-  /*   language    4              USHORT        Mac language code          */
-  /*   glyph_ids   6              BYTE[256]     array of glyph indices     */
-  /*               262                                                     */
-  /*                                                                       */
+  /**************************************************************************
+   *
+   * TABLE OVERVIEW
+   * --------------
+   *
+   *   NAME        OFFSET         TYPE          DESCRIPTION
+   *
+   *   format      0              USHORT        must be 0
+   *   length      2              USHORT        table length in bytes
+   *   language    4              USHORT        Mac language code
+   *   glyph_ids   6              BYTE[256]     array of glyph indices
+   *               262
+   */
 
 #ifdef TT_CONFIG_CMAP_FORMAT_0
 
   FT_CALLBACK_DEF( FT_Error )
   tt_cmap0_validate( FT_Byte*      table,

@@ -236,61 +235,61 @@
   /***** arguments.                                                    *****/
   /*****                                                               *****/
   /*************************************************************************/
   /*************************************************************************/
 
-  /*************************************************************************/
-  /*                                                                       */
-  /* TABLE OVERVIEW                                                        */
-  /* --------------                                                        */
-  /*                                                                       */
-  /*   NAME        OFFSET         TYPE            DESCRIPTION              */
-  /*                                                                       */
-  /*   format      0              USHORT          must be 2                */
-  /*   length      2              USHORT          table length in bytes    */
-  /*   language    4              USHORT          Mac language code        */
-  /*   keys        6              USHORT[256]     sub-header keys          */
-  /*   subs        518            SUBHEAD[NSUBS]  sub-headers array        */
-  /*   glyph_ids   518+NSUB*8     USHORT[]        glyph ID array           */
-  /*                                                                       */
-  /* The `keys' table is used to map charcode high bytes to sub-headers.   */
-  /* The value of `NSUBS' is the number of sub-headers defined in the      */
-  /* table and is computed by finding the maximum of the `keys' table.     */
-  /*                                                                       */
-  /* Note that for any `n', `keys[n]' is a byte offset within the `subs'   */
-  /* table, i.e., it is the corresponding sub-header index multiplied      */
-  /* by 8.                                                                 */
-  /*                                                                       */
-  /* Each sub-header has the following format.                             */
-  /*                                                                       */
-  /*   NAME        OFFSET      TYPE            DESCRIPTION                 */
-  /*                                                                       */
-  /*   first       0           USHORT          first valid low-byte        */
-  /*   count       2           USHORT          number of valid low-bytes   */
-  /*   delta       4           SHORT           see below                   */
-  /*   offset      6           USHORT          see below                   */
-  /*                                                                       */
-  /* A sub-header defines, for each high byte, the range of valid          */
-  /* low bytes within the charmap.  Note that the range defined by `first' */
-  /* and `count' must be completely included in the interval [0..255]      */
-  /* according to the specification.                                       */
-  /*                                                                       */
-  /* If a character code is contained within a given sub-header, then      */
-  /* mapping it to a glyph index is done as follows.                       */
-  /*                                                                       */
-  /* * The value of `offset' is read.  This is a _byte_ distance from the  */
-  /*   location of the `offset' field itself into a slice of the           */
-  /*   `glyph_ids' table.  Let's call it `slice' (it is a USHORT[], too).  */
-  /*                                                                       */
-  /* * The value `slice[char.lo - first]' is read.  If it is 0, there is   */
-  /*   no glyph for the charcode.  Otherwise, the value of `delta' is      */
-  /*   added to it (modulo 65536) to form a new glyph index.               */
-  /*                                                                       */
-  /* It is up to the validation routine to check that all offsets fall     */
-  /* within the glyph IDs table (and not within the `subs' table itself or */
-  /* outside of the CMap).                                                 */
-  /*                                                                       */
+  /**************************************************************************
+   *
+   * TABLE OVERVIEW
+   * --------------
+   *
+   *   NAME        OFFSET         TYPE            DESCRIPTION
+   *
+   *   format      0              USHORT          must be 2
+   *   length      2              USHORT          table length in bytes
+   *   language    4              USHORT          Mac language code
+   *   keys        6              USHORT[256]     sub-header keys
+   *   subs        518            SUBHEAD[NSUBS]  sub-headers array
+   *   glyph_ids   518+NSUB*8     USHORT[]        glyph ID array
+   *
+   * The `keys' table is used to map charcode high bytes to sub-headers.
+   * The value of `NSUBS' is the number of sub-headers defined in the
+   * table and is computed by finding the maximum of the `keys' table.
+   *
+   * Note that for any `n', `keys[n]' is a byte offset within the `subs'
+   * table, i.e., it is the corresponding sub-header index multiplied
+   * by 8.
+   *
+   * Each sub-header has the following format.
+   *
+   *   NAME        OFFSET      TYPE            DESCRIPTION
+   *
+   *   first       0           USHORT          first valid low-byte
+   *   count       2           USHORT          number of valid low-bytes
+   *   delta       4           SHORT           see below
+   *   offset      6           USHORT          see below
+   *
+   * A sub-header defines, for each high byte, the range of valid
+   * low bytes within the charmap.  Note that the range defined by `first'
+   * and `count' must be completely included in the interval [0..255]
+   * according to the specification.
+   *
+   * If a character code is contained within a given sub-header, then
+   * mapping it to a glyph index is done as follows.
+   *
+   * - The value of `offset' is read.  This is a _byte_ distance from the
+   *   location of the `offset' field itself into a slice of the
+   *   `glyph_ids' table.  Let's call it `slice' (it is a USHORT[], too).
+   *
+   * - The value `slice[char.lo - first]' is read.  If it is 0, there is
+   *   no glyph for the charcode.  Otherwise, the value of `delta' is
+   *   added to it (modulo 65536) to form a new glyph index.
+   *
+   * It is up to the validation routine to check that all offsets fall
+   * within the glyph IDs table (and not within the `subs' table itself or
+   * outside of the CMap).
+   */
 
 #ifdef TT_CONFIG_CMAP_FORMAT_2
 
   FT_CALLBACK_DEF( FT_Error )
   tt_cmap2_validate( FT_Byte*      table,

@@ -624,72 +623,72 @@
   /*****                           FORMAT 4                            *****/
   /*****                                                               *****/
   /*************************************************************************/
   /*************************************************************************/
 
-  /*************************************************************************/
-  /*                                                                       */
-  /* TABLE OVERVIEW                                                        */
-  /* --------------                                                        */
-  /*                                                                       */
-  /*   NAME          OFFSET         TYPE              DESCRIPTION          */
-  /*                                                                       */
-  /*   format        0              USHORT            must be 4            */
-  /*   length        2              USHORT            table length         */
-  /*                                                  in bytes             */
-  /*   language      4              USHORT            Mac language code    */
-  /*                                                                       */
-  /*   segCountX2    6              USHORT            2*NUM_SEGS           */
-  /*   searchRange   8              USHORT            2*(1 << LOG_SEGS)    */
-  /*   entrySelector 10             USHORT            LOG_SEGS             */
-  /*   rangeShift    12             USHORT            segCountX2 -         */
-  /*                                                    searchRange        */
-  /*                                                                       */
-  /*   endCount      14             USHORT[NUM_SEGS]  end charcode for     */
-  /*                                                  each segment; last   */
-  /*                                                  is 0xFFFF            */
-  /*                                                                       */
-  /*   pad           14+NUM_SEGS*2  USHORT            padding              */
-  /*                                                                       */
-  /*   startCount    16+NUM_SEGS*2  USHORT[NUM_SEGS]  first charcode for   */
-  /*                                                  each segment         */
-  /*                                                                       */
-  /*   idDelta       16+NUM_SEGS*4  SHORT[NUM_SEGS]   delta for each       */
-  /*                                                  segment              */
-  /*   idOffset      16+NUM_SEGS*6  SHORT[NUM_SEGS]   range offset for     */
-  /*                                                  each segment; can be */
-  /*                                                  zero                 */
-  /*                                                                       */
-  /*   glyphIds      16+NUM_SEGS*8  USHORT[]          array of glyph ID    */
-  /*                                                  ranges               */
-  /*                                                                       */
-  /* Character codes are modelled by a series of ordered (increasing)      */
-  /* intervals called segments.  Each segment has start and end codes,     */
-  /* provided by the `startCount' and `endCount' arrays.  Segments must    */
-  /* not overlap, and the last segment should always contain the value     */
-  /* 0xFFFF for `endCount'.                                                */
-  /*                                                                       */
-  /* The fields `searchRange', `entrySelector' and `rangeShift' are better */
-  /* ignored (they are traces of over-engineering in the TrueType          */
-  /* specification).                                                       */
-  /*                                                                       */
-  /* Each segment also has a signed `delta', as well as an optional offset */
-  /* within the `glyphIds' table.                                          */
-  /*                                                                       */
-  /* If a segment's idOffset is 0, the glyph index corresponding to any    */
-  /* charcode within the segment is obtained by adding the value of        */
-  /* `idDelta' directly to the charcode, modulo 65536.                     */
-  /*                                                                       */
-  /* Otherwise, a glyph index is taken from the glyph IDs sub-array for    */
-  /* the segment, and the value of `idDelta' is added to it.               */
-  /*                                                                       */
-  /*                                                                       */
-  /* Finally, note that a lot of fonts contain an invalid last segment,    */
-  /* where `start' and `end' are correctly set to 0xFFFF but both `delta'  */
-  /* and `offset' are incorrect (e.g., `opens___.ttf' which comes with     */
-  /* OpenOffice.org).  We need special code to deal with them correctly.   */
-  /*                                                                       */
+  /**************************************************************************
+   *
+   * TABLE OVERVIEW
+   * --------------
+   *
+   *   NAME          OFFSET         TYPE              DESCRIPTION
+   *
+   *   format        0              USHORT            must be 4
+   *   length        2              USHORT            table length
+   *                                                  in bytes
+   *   language      4              USHORT            Mac language code
+   *
+   *   segCountX2    6              USHORT            2*NUM_SEGS
+   *   searchRange   8              USHORT            2*(1 << LOG_SEGS)
+   *   entrySelector 10             USHORT            LOG_SEGS
+   *   rangeShift    12             USHORT            segCountX2 -
+   *                                                    searchRange
+   *
+   *   endCount      14             USHORT[NUM_SEGS]  end charcode for
+   *                                                  each segment; last
+   *                                                  is 0xFFFF
+   *
+   *   pad           14+NUM_SEGS*2  USHORT            padding
+   *
+   *   startCount    16+NUM_SEGS*2  USHORT[NUM_SEGS]  first charcode for
+   *                                                  each segment
+   *
+   *   idDelta       16+NUM_SEGS*4  SHORT[NUM_SEGS]   delta for each
+   *                                                  segment
+   *   idOffset      16+NUM_SEGS*6  SHORT[NUM_SEGS]   range offset for
+   *                                                  each segment; can be
+   *                                                  zero
+   *
+   *   glyphIds      16+NUM_SEGS*8  USHORT[]          array of glyph ID
+   *                                                  ranges
+   *
+   * Character codes are modelled by a series of ordered (increasing)
+   * intervals called segments.  Each segment has start and end codes,
+   * provided by the `startCount' and `endCount' arrays.  Segments must
+   * not overlap, and the last segment should always contain the value
+   * 0xFFFF for `endCount'.
+   *
+   * The fields `searchRange', `entrySelector' and `rangeShift' are better
+   * ignored (they are traces of over-engineering in the TrueType
+   * specification).
+   *
+   * Each segment also has a signed `delta', as well as an optional offset
+   * within the `glyphIds' table.
+   *
+   * If a segment's idOffset is 0, the glyph index corresponding to any
+   * charcode within the segment is obtained by adding the value of
+   * `idDelta' directly to the charcode, modulo 65536.
+   *
+   * Otherwise, a glyph index is taken from the glyph IDs sub-array for
+   * the segment, and the value of `idDelta' is added to it.
+   *
+   *
+   * Finally, note that a lot of fonts contain an invalid last segment,
+   * where `start' and `end' are correctly set to 0xFFFF but both `delta'
+   * and `offset' are incorrect (e.g., `opens___.ttf' which comes with
+   * OpenOffice.org).  We need special code to deal with them correctly.
+   */
 
 #ifdef TT_CONFIG_CMAP_FORMAT_4
 
   typedef struct  TT_CMap4Rec_
   {

@@ -1571,27 +1570,27 @@
   /*****                          FORMAT 6                             *****/
   /*****                                                               *****/
   /*************************************************************************/
   /*************************************************************************/
 
-  /*************************************************************************/
-  /*                                                                       */
-  /* TABLE OVERVIEW                                                        */
-  /* --------------                                                        */
-  /*                                                                       */
-  /*   NAME        OFFSET          TYPE             DESCRIPTION            */
-  /*                                                                       */
-  /*   format       0              USHORT           must be 6              */
-  /*   length       2              USHORT           table length in bytes  */
-  /*   language     4              USHORT           Mac language code      */
-  /*                                                                       */
-  /*   first        6              USHORT           first segment code     */
-  /*   count        8              USHORT           segment size in chars  */
-  /*   glyphIds     10             USHORT[count]    glyph IDs              */
-  /*                                                                       */
-  /* A very simplified segment mapping.                                    */
-  /*                                                                       */
+  /**************************************************************************
+   *
+   * TABLE OVERVIEW
+   * --------------
+   *
+   *   NAME        OFFSET          TYPE             DESCRIPTION
+   *
+   *   format       0              USHORT           must be 6
+   *   length       2              USHORT           table length in bytes
+   *   language     4              USHORT           Mac language code
+   *
+   *   first        6              USHORT           first segment code
+   *   count        8              USHORT           segment size in chars
+   *   glyphIds     10             USHORT[count]    glyph IDs
+   *
+   * A very simplified segment mapping.
+   */
 
 #ifdef TT_CONFIG_CMAP_FORMAT_6
 
   FT_CALLBACK_DEF( FT_Error )
   tt_cmap6_validate( FT_Byte*      table,

@@ -1766,30 +1765,30 @@
   /*****   `is32[char_hi] != 0' and `is32[char_lo] != 0'.              *****/
   /*****                                                               *****/
   /*************************************************************************/
   /*************************************************************************/
 
-  /*************************************************************************/
-  /*                                                                       */
-  /* TABLE OVERVIEW                                                        */
-  /* --------------                                                        */
-  /*                                                                       */
-  /*   NAME        OFFSET         TYPE        DESCRIPTION                  */
-  /*                                                                       */
-  /*   format      0              USHORT      must be 8                    */
-  /*   reserved    2              USHORT      reserved                     */
-  /*   length      4              ULONG       length in bytes              */
-  /*   language    8              ULONG       Mac language code            */
-  /*   is32        12             BYTE[8192]  32-bitness bitmap            */
-  /*   count       8204           ULONG       number of groups             */
-  /*                                                                       */
-  /* This header is followed by `count' groups of the following format:    */
-  /*                                                                       */
-  /*   start       0              ULONG       first charcode               */
-  /*   end         4              ULONG       last charcode                */
-  /*   startId     8              ULONG       start glyph ID for the group */
-  /*                                                                       */
+  /**************************************************************************
+   *
+   * TABLE OVERVIEW
+   * --------------
+   *
+   *   NAME        OFFSET         TYPE        DESCRIPTION
+   *
+   *   format      0              USHORT      must be 8
+   *   reserved    2              USHORT      reserved
+   *   length      4              ULONG       length in bytes
+   *   language    8              ULONG       Mac language code
+   *   is32        12             BYTE[8192]  32-bitness bitmap
+   *   count       8204           ULONG       number of groups
+   *
+   * This header is followed by `count' groups of the following format:
+   *
+   *   start       0              ULONG       first charcode
+   *   end         4              ULONG       last charcode
+   *   startId     8              ULONG       start glyph ID for the group
+   */
 
 #ifdef TT_CONFIG_CMAP_FORMAT_8
 
   FT_CALLBACK_DEF( FT_Error )
   tt_cmap8_validate( FT_Byte*      table,

@@ -2035,26 +2034,26 @@
   /*****                          FORMAT 10                            *****/
   /*****                                                               *****/
   /*************************************************************************/
   /*************************************************************************/
 
-  /*************************************************************************/
-  /*                                                                       */
-  /* TABLE OVERVIEW                                                        */
-  /* --------------                                                        */
-  /*                                                                       */
-  /*   NAME      OFFSET  TYPE               DESCRIPTION                    */
-  /*                                                                       */
-  /*   format     0      USHORT             must be 10                     */
-  /*   reserved   2      USHORT             reserved                       */
-  /*   length     4      ULONG              length in bytes                */
-  /*   language   8      ULONG              Mac language code              */
-  /*                                                                       */
-  /*   start     12      ULONG              first char in range            */
-  /*   count     16      ULONG              number of chars in range       */
-  /*   glyphIds  20      USHORT[count]      glyph indices covered          */
-  /*                                                                       */
+  /**************************************************************************
+   *
+   * TABLE OVERVIEW
+   * --------------
+   *
+   *   NAME      OFFSET  TYPE               DESCRIPTION
+   *
+   *   format     0      USHORT             must be 10
+   *   reserved   2      USHORT             reserved
+   *   length     4      ULONG              length in bytes
+   *   language   8      ULONG              Mac language code
+   *
+   *   start     12      ULONG              first char in range
+   *   count     16      ULONG              number of chars in range
+   *   glyphIds  20      USHORT[count]      glyph indices covered
+   */
 
 #ifdef TT_CONFIG_CMAP_FORMAT_10
 
   FT_CALLBACK_DEF( FT_Error )
   tt_cmap10_validate( FT_Byte*      table,

@@ -2207,30 +2206,30 @@
   /*****                          FORMAT 12                            *****/
   /*****                                                               *****/
   /*************************************************************************/
   /*************************************************************************/
 
-  /*************************************************************************/
-  /*                                                                       */
-  /* TABLE OVERVIEW                                                        */
-  /* --------------                                                        */
-  /*                                                                       */
-  /*   NAME        OFFSET     TYPE       DESCRIPTION                       */
-  /*                                                                       */
-  /*   format      0          USHORT     must be 12                        */
-  /*   reserved    2          USHORT     reserved                          */
-  /*   length      4          ULONG      length in bytes                   */
-  /*   language    8          ULONG      Mac language code                 */
-  /*   count       12         ULONG      number of groups                  */
-  /*               16                                                      */
-  /*                                                                       */
-  /* This header is followed by `count' groups of the following format:    */
-  /*                                                                       */
-  /*   start       0          ULONG      first charcode                    */
-  /*   end         4          ULONG      last charcode                     */
-  /*   startId     8          ULONG      start glyph ID for the group      */
-  /*                                                                       */
+  /**************************************************************************
+   *
+   * TABLE OVERVIEW
+   * --------------
+   *
+   *   NAME        OFFSET     TYPE       DESCRIPTION
+   *
+   *   format      0          USHORT     must be 12
+   *   reserved    2          USHORT     reserved
+   *   length      4          ULONG      length in bytes
+   *   language    8          ULONG      Mac language code
+   *   count       12         ULONG      number of groups
+   *               16
+   *
+   * This header is followed by `count' groups of the following format:
+   *
+   *   start       0          ULONG      first charcode
+   *   end         4          ULONG      last charcode
+   *   startId     8          ULONG      start glyph ID for the group
+   */
 
 #ifdef TT_CONFIG_CMAP_FORMAT_12
 
   typedef struct  TT_CMap12Rec_
   {

@@ -2563,30 +2562,30 @@
   /*****                          FORMAT 13                            *****/
   /*****                                                               *****/
   /*************************************************************************/
   /*************************************************************************/
 
-  /*************************************************************************/
-  /*                                                                       */
-  /* TABLE OVERVIEW                                                        */
-  /* --------------                                                        */
-  /*                                                                       */
-  /*   NAME        OFFSET     TYPE       DESCRIPTION                       */
-  /*                                                                       */
-  /*   format      0          USHORT     must be 13                        */
-  /*   reserved    2          USHORT     reserved                          */
-  /*   length      4          ULONG      length in bytes                   */
-  /*   language    8          ULONG      Mac language code                 */
-  /*   count       12         ULONG      number of groups                  */
-  /*               16                                                      */
-  /*                                                                       */
-  /* This header is followed by `count' groups of the following format:    */
-  /*                                                                       */
-  /*   start       0          ULONG      first charcode                    */
-  /*   end         4          ULONG      last charcode                     */
-  /*   glyphId     8          ULONG      glyph ID for the whole group      */
-  /*                                                                       */
+  /**************************************************************************
+   *
+   * TABLE OVERVIEW
+   * --------------
+   *
+   *   NAME        OFFSET     TYPE       DESCRIPTION
+   *
+   *   format      0          USHORT     must be 13
+   *   reserved    2          USHORT     reserved
+   *   length      4          ULONG      length in bytes
+   *   language    8          ULONG      Mac language code
+   *   count       12         ULONG      number of groups
+   *               16
+   *
+   * This header is followed by `count' groups of the following format:
+   *
+   *   start       0          ULONG      first charcode
+   *   end         4          ULONG      last charcode
+   *   glyphId     8          ULONG      glyph ID for the whole group
+   */
 
 #ifdef TT_CONFIG_CMAP_FORMAT_13
 
   typedef struct  TT_CMap13Rec_
   {

@@ -2889,62 +2888,63 @@
   /*****                           FORMAT 14                           *****/
   /*****                                                               *****/
   /*************************************************************************/
   /*************************************************************************/
 
-  /*************************************************************************/
-  /*                                                                       */
-  /* TABLE OVERVIEW                                                        */
-  /* --------------                                                        */
-  /*                                                                       */
-  /*   NAME         OFFSET  TYPE    DESCRIPTION                            */
-  /*                                                                       */
-  /*   format         0     USHORT  must be 14                             */
-  /*   length         2     ULONG   table length in bytes                  */
-  /*   numSelector    6     ULONG   number of variation sel. records       */
-  /*                                                                       */
-  /* Followed by numSelector records, each of which looks like             */
-  /*                                                                       */
-  /*   varSelector    0     UINT24  Unicode codepoint of sel.              */
-  /*   defaultOff     3     ULONG   offset to a default UVS table          */
-  /*                                describing any variants to be found in */
-  /*                                the normal Unicode subtable.           */
-  /*   nonDefOff      7     ULONG   offset to a non-default UVS table      */
-  /*                                describing any variants not in the     */
-  /*                                standard cmap, with GIDs here          */
-  /* (either offset may be 0 NULL)                                         */
-  /*                                                                       */
-  /* Selectors are sorted by code point.                                   */
-  /*                                                                       */
-  /* A default Unicode Variation Selector (UVS) subtable is just a list of */
-  /* ranges of code points which are to be found in the standard cmap.  No */
-  /* glyph IDs (GIDs) here.                                                */
-  /*                                                                       */
-  /*   numRanges      0     ULONG   number of ranges following             */
-  /*                                                                       */
-  /* A range looks like                                                    */
-  /*                                                                       */
-  /*   uniStart       0     UINT24  code point of the first character in   */
-  /*                                this range                             */
-  /*   additionalCnt  3     UBYTE   count of additional characters in this */
-  /*                                range (zero means a range of a single  */
-  /*                                character)                             */
-  /*                                                                       */
-  /* Ranges are sorted by `uniStart'.                                      */
-  /*                                                                       */
-  /* A non-default Unicode Variation Selector (UVS) subtable is a list of  */
-  /* mappings from codepoint to GID.                                       */
-  /*                                                                       */
-  /*   numMappings    0     ULONG   number of mappings                     */
-  /*                                                                       */
-  /* A range looks like                                                    */
-  /*                                                                       */
-  /*   uniStart       0     UINT24  code point of the first character in   */
-  /*                                this range                             */
-  /*   GID            3     USHORT  and its GID                            */
-  /*                                                                       */
-  /* Ranges are sorted by `uniStart'.                                      */
+  /**************************************************************************
+   *
+   * TABLE OVERVIEW
+   * --------------
+   *
+   *   NAME         OFFSET  TYPE    DESCRIPTION
+   *
+   *   format         0     USHORT  must be 14
+   *   length         2     ULONG   table length in bytes
+   *   numSelector    6     ULONG   number of variation sel. records
+   *
+   * Followed by numSelector records, each of which looks like
+   *
+   *   varSelector    0     UINT24  Unicode codepoint of sel.
+   *   defaultOff     3     ULONG   offset to a default UVS table
+   *                                describing any variants to be found in
+   *                                the normal Unicode subtable.
+   *   nonDefOff      7     ULONG   offset to a non-default UVS table
+   *                                describing any variants not in the
+   *                                standard cmap, with GIDs here
+   * (either offset may be 0 NULL)
+   *
+   * Selectors are sorted by code point.
+   *
+   * A default Unicode Variation Selector (UVS) subtable is just a list of
+   * ranges of code points which are to be found in the standard cmap.  No
+   * glyph IDs (GIDs) here.
+   *
+   *   numRanges      0     ULONG   number of ranges following
+   *
+   * A range looks like
+   *
+   *   uniStart       0     UINT24  code point of the first character in
+   *                                this range
+   *   additionalCnt  3     UBYTE   count of additional characters in this
+   *                                range (zero means a range of a single
+   *                                character)
+   *
+   * Ranges are sorted by `uniStart'.
+   *
+   * A non-default Unicode Variation Selector (UVS) subtable is a list of
+   * mappings from codepoint to GID.
+   *
+   *   numMappings    0     ULONG   number of mappings
+   *
+   * A range looks like
+   *
+   *   uniStart       0     UINT24  code point of the first character in
+   *                                this range
+   *   GID            3     USHORT  and its GID
+   *
+   * Ranges are sorted by `uniStart'.
+   */
 
 #ifdef TT_CONFIG_CMAP_FORMAT_14
 
   typedef struct  TT_CMap14Rec_
   {

@@ -3679,10 +3679,13 @@
     FT_Service_PsCMaps  psnames = (FT_Service_PsCMaps)face->psnames;
 
     FT_UNUSED( pointer );
 
 
+    if ( !psnames->unicodes_init )
+      return FT_THROW( Unimplemented_Feature );
+
     return psnames->unicodes_init( memory,
                                    unicodes,
                                    face->root.num_glyphs,
                                    (PS_GetGlyphNameFunc)&tt_get_glyph_name,
                                    (PS_FreeGlyphNameFunc)NULL,

@@ -3747,74 +3750,18 @@
     (TT_CMap_Info_GetFunc)NULL   /* get_cmap_info */
   )
 
 #endif /* FT_CONFIG_OPTION_POSTSCRIPT_NAMES */
 
-#ifndef FT_CONFIG_OPTION_PIC
 
   static const TT_CMap_Class  tt_cmap_classes[] =
   {
 #define TTCMAPCITEM( a )  &a,
 #include "ttcmapc.h"
     NULL,
   };
 
-#else /*FT_CONFIG_OPTION_PIC*/
-
-  void
-  FT_Destroy_Class_tt_cmap_classes( FT_Library      library,
-                                    TT_CMap_Class*  clazz )
-  {
-    FT_Memory  memory = library->memory;
-
-
-    if ( clazz )
-      FT_FREE( clazz );
-  }
-
-
-  FT_Error
-  FT_Create_Class_tt_cmap_classes( FT_Library       library,
-                                   TT_CMap_Class**  output_class )
-  {
-    TT_CMap_Class*     clazz  = NULL;
-    TT_CMap_ClassRec*  recs;
-    FT_Error           error;
-    FT_Memory          memory = library->memory;
-
-    int  i = 0;
-
-
-#define TTCMAPCITEM( a ) i++;
-#include "ttcmapc.h"
-
-    /* allocate enough space for both the pointers */
-    /* plus terminator and the class instances     */
-    if ( FT_ALLOC( clazz, sizeof ( *clazz ) * ( i + 1 ) +
-                          sizeof ( TT_CMap_ClassRec ) * i ) )
-      return error;
-
-    /* the location of the class instances follows the array of pointers */
-    recs = (TT_CMap_ClassRec*)( (char*)clazz +
-                                sizeof ( *clazz ) * ( i + 1 ) );
-    i    = 0;
-
-#undef TTCMAPCITEM
-#define  TTCMAPCITEM( a )             \
-    FT_Init_Class_ ## a( &recs[i] );  \
-    clazz[i] = &recs[i];              \
-    i++;
-#include "ttcmapc.h"
-
-    clazz[i] = NULL;
-
-    *output_class = clazz;
-    return FT_Err_Ok;
-  }
-
-#endif /*FT_CONFIG_OPTION_PIC*/
-
 
   /* parse the `cmap' table and build the corresponding TT_CMap objects */
   /* in the current face                                                */
   /*                                                                    */
   FT_LOCAL_DEF( FT_Error )

@@ -3857,11 +3804,11 @@
 
       if ( offset && offset <= face->cmap_size - 2 )
       {
         FT_Byte* volatile              cmap   = table + offset;
         volatile FT_UInt               format = TT_PEEK_USHORT( cmap );
-        const TT_CMap_Class* volatile  pclazz = TT_CMAP_CLASSES_GET;
+        const TT_CMap_Class* volatile  pclazz = tt_cmap_classes;
         TT_CMap_Class volatile         clazz;
 
 
         for ( ; *pclazz; pclazz++ )
         {
< prev index next >