fontservices/textshaperplugin/test/letest/sfnt.h
changeset 0 1fb32624e06b
equal deleted inserted replaced
-1:000000000000 0:1fb32624e06b
       
     1 /***************************************************************************
       
     2 *
       
     3 *   Copyright (C) 1998-2002, International Business Machines
       
     4 *   Corporation and others.  All Rights Reserved.
       
     5 *
       
     6 ************************************************************************/
       
     7 
       
     8 #ifndef __SFNT_H
       
     9 #define __SFNT_H
       
    10 
       
    11 #include "LETypes.h"
       
    12 
       
    13 
       
    14 #ifndef ANY_NUMBER
       
    15 #define ANY_NUMBER 1
       
    16 #endif
       
    17 
       
    18 struct DirectoryEntry
       
    19 {
       
    20     le_uint32   tag;
       
    21     le_uint32   checksum;
       
    22     le_uint32   offset;
       
    23     le_uint32   length;
       
    24 };
       
    25 
       
    26 struct SFNTDirectory
       
    27 {
       
    28     le_uint32       scalerType;
       
    29     le_uint16       numTables;
       
    30     le_uint16       searchRange;
       
    31     le_uint16       entrySelector;
       
    32     le_uint16       rangeShift;
       
    33     DirectoryEntry  tableDirectory[ANY_NUMBER];
       
    34 };
       
    35 
       
    36 
       
    37 struct CMAPEncodingSubtableHeader
       
    38 {
       
    39     le_uint16   platformID;
       
    40     le_uint16   platformSpecificID;
       
    41     le_uint32   encodingOffset;
       
    42 };
       
    43 
       
    44 struct CMAPTable
       
    45 {
       
    46     le_uint16   version;
       
    47     le_uint16   numberSubtables;
       
    48     CMAPEncodingSubtableHeader encodingSubtableHeaders[ANY_NUMBER];
       
    49 };
       
    50 
       
    51 struct CMAPEncodingSubtable
       
    52 {
       
    53     le_uint16   format;
       
    54     le_uint16   length;
       
    55     le_uint16   language;
       
    56 };
       
    57 
       
    58 struct CMAPFormat0Encoding : CMAPEncodingSubtable
       
    59 {
       
    60     le_uint8    glyphIndexArray[256];
       
    61 };
       
    62 
       
    63 struct CMAPFormat2Subheader
       
    64 {
       
    65     le_uint16   firstCode;
       
    66     le_uint16   entryCount;
       
    67     le_int16    idDelta;
       
    68     le_uint16   idRangeOffset;
       
    69 };
       
    70 
       
    71 struct CMAPFormat2Encoding : CMAPEncodingSubtable
       
    72 {
       
    73     le_uint16  subHeadKeys[256];
       
    74     CMAPFormat2Subheader subheaders[ANY_NUMBER];
       
    75 };
       
    76 
       
    77 struct CMAPFormat4Encoding : CMAPEncodingSubtable
       
    78 {
       
    79     le_uint16   segCountX2;
       
    80     le_uint16   searchRange;
       
    81     le_uint16   entrySelector;
       
    82     le_uint16   rangeShift;
       
    83     le_uint16   endCodes[ANY_NUMBER];
       
    84 //  le_uint16   reservedPad;
       
    85 //  le_uint16   startCodes[ANY_NUMBER];
       
    86 //  le_uint16   idDelta[ANY_NUMBER];
       
    87 //  le_uint16   idRangeOffset[ANY_NUMBER];
       
    88 //  le_uint16   glyphIndexArray[ANY_NUMBER];
       
    89 };
       
    90 
       
    91 struct CMAPFormat6Encoding : CMAPEncodingSubtable
       
    92 {
       
    93     le_uint16   firstCode;
       
    94     le_uint16   entryCount;
       
    95     le_uint16   glyphIndexArray[ANY_NUMBER];
       
    96 };
       
    97 
       
    98 struct CMAPEncodingSubtable32
       
    99 {
       
   100     le_uint32   format;
       
   101     le_uint32   length;
       
   102     le_uint32   language;
       
   103 };
       
   104 
       
   105 struct CMAPGroup
       
   106 {
       
   107     le_uint32   startCharCode;
       
   108     le_uint32   endCharCode;
       
   109     le_uint32   startGlyphCode;
       
   110 };
       
   111 
       
   112 struct CMAPFormat8Encoding : CMAPEncodingSubtable32
       
   113 {
       
   114     le_uint32   is32[65536/32];
       
   115     le_uint32   nGroups;
       
   116     CMAPGroup   groups[ANY_NUMBER];
       
   117 };
       
   118 
       
   119 struct CMAPFormat10Encoding : CMAPEncodingSubtable32
       
   120 {
       
   121     le_uint32   startCharCode;
       
   122     le_uint32   numCharCodes;
       
   123     le_uint16   glyphs[ANY_NUMBER];
       
   124 };
       
   125 
       
   126 struct CMAPFormat12Encoding : CMAPEncodingSubtable32
       
   127 {
       
   128     le_uint32   nGroups;
       
   129     CMAPGroup   groups[ANY_NUMBER];
       
   130 };
       
   131 
       
   132 typedef le_int32 fixed;
       
   133 
       
   134 struct BigDate
       
   135 {
       
   136     le_uint32   bc;
       
   137     le_uint32   ad;
       
   138 };
       
   139 
       
   140 struct HEADTable
       
   141 {
       
   142     fixed       version;
       
   143     fixed       fontRevision;
       
   144     le_uint32   checksumAdjustment;
       
   145     le_uint32   magicNumber;
       
   146     le_uint16   flags;
       
   147     le_uint16   unitsPerEm;
       
   148     BigDate     created;
       
   149     BigDate     modified;
       
   150     le_int16    xMin;
       
   151     le_int16    yMin;
       
   152     le_int16    xMax;
       
   153     le_int16    yMax;
       
   154     le_int16    lowestRecPPEM;
       
   155     le_int16    fontDirectionHint;
       
   156     le_int16    indexToLocFormat;
       
   157     le_int16    glyphDataFormat;
       
   158 };
       
   159 
       
   160 struct MAXPTable
       
   161 {
       
   162     fixed       version;
       
   163     le_uint16   numGlyphs;
       
   164     le_uint16   maxPoints;
       
   165     le_uint16   maxContours;
       
   166     le_uint16   maxComponentPoints;
       
   167     le_uint16   maxComponentContours;
       
   168     le_uint16   maxZones;
       
   169     le_uint16   maxTwilightPoints;
       
   170     le_uint16   maxStorage;
       
   171     le_uint16   maxFunctionDefs;
       
   172     le_uint16   maxInstructionDefs;
       
   173     le_uint16   maxStackElements;
       
   174     le_uint16   maxSizeOfInstructions;
       
   175     le_uint16   maxComponentElements;
       
   176     le_uint16   maxComponentDepth;
       
   177 };
       
   178 
       
   179 struct HHEATable
       
   180 {
       
   181     fixed       version;
       
   182     le_int16    ascent;
       
   183     le_int16    descent;
       
   184     le_int16    lineGap;
       
   185     le_uint16   advanceWidthMax;
       
   186     le_int16    minLeftSideBearing;
       
   187     le_int16    minRightSideBearing;
       
   188     le_int16    xMaxExtent;
       
   189     le_int16    caretSlopeRise;
       
   190     le_int16    caretSlopeRun;
       
   191     le_int16    caretOffset;
       
   192     le_int16    reserved1;
       
   193     le_int16    reserved2;
       
   194     le_int16    reserved3;
       
   195     le_int16    reserved4;
       
   196     le_int16    metricDataFormat;
       
   197     le_uint16   numOfLongHorMetrics;
       
   198 };
       
   199 
       
   200 struct LongHorMetric
       
   201 {
       
   202     le_uint16   advanceWidth;
       
   203     le_int16    leftSideBearing;
       
   204 };
       
   205 
       
   206 struct HMTXTable
       
   207 {
       
   208     LongHorMetric hMetrics[ANY_NUMBER];        // ANY_NUMBER = numOfLongHorMetrics from hhea table
       
   209 //  le_int16        leftSideBearing[ANY_NUMBER]; // ANY_NUMBER = numGlyphs - numOfLongHorMetrics
       
   210 };
       
   211 
       
   212 #endif
       
   213