1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/textandloc/fontservices/textshaperplugin/test/letest/sfnt.h Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,213 @@
1.4 +/***************************************************************************
1.5 +*
1.6 +* Copyright (C) 1998-2002, International Business Machines
1.7 +* Corporation and others. All Rights Reserved.
1.8 +*
1.9 +************************************************************************/
1.10 +
1.11 +#ifndef __SFNT_H
1.12 +#define __SFNT_H
1.13 +
1.14 +#include "LETypes.h"
1.15 +
1.16 +
1.17 +#ifndef ANY_NUMBER
1.18 +#define ANY_NUMBER 1
1.19 +#endif
1.20 +
1.21 +struct DirectoryEntry
1.22 +{
1.23 + le_uint32 tag;
1.24 + le_uint32 checksum;
1.25 + le_uint32 offset;
1.26 + le_uint32 length;
1.27 +};
1.28 +
1.29 +struct SFNTDirectory
1.30 +{
1.31 + le_uint32 scalerType;
1.32 + le_uint16 numTables;
1.33 + le_uint16 searchRange;
1.34 + le_uint16 entrySelector;
1.35 + le_uint16 rangeShift;
1.36 + DirectoryEntry tableDirectory[ANY_NUMBER];
1.37 +};
1.38 +
1.39 +
1.40 +struct CMAPEncodingSubtableHeader
1.41 +{
1.42 + le_uint16 platformID;
1.43 + le_uint16 platformSpecificID;
1.44 + le_uint32 encodingOffset;
1.45 +};
1.46 +
1.47 +struct CMAPTable
1.48 +{
1.49 + le_uint16 version;
1.50 + le_uint16 numberSubtables;
1.51 + CMAPEncodingSubtableHeader encodingSubtableHeaders[ANY_NUMBER];
1.52 +};
1.53 +
1.54 +struct CMAPEncodingSubtable
1.55 +{
1.56 + le_uint16 format;
1.57 + le_uint16 length;
1.58 + le_uint16 language;
1.59 +};
1.60 +
1.61 +struct CMAPFormat0Encoding : CMAPEncodingSubtable
1.62 +{
1.63 + le_uint8 glyphIndexArray[256];
1.64 +};
1.65 +
1.66 +struct CMAPFormat2Subheader
1.67 +{
1.68 + le_uint16 firstCode;
1.69 + le_uint16 entryCount;
1.70 + le_int16 idDelta;
1.71 + le_uint16 idRangeOffset;
1.72 +};
1.73 +
1.74 +struct CMAPFormat2Encoding : CMAPEncodingSubtable
1.75 +{
1.76 + le_uint16 subHeadKeys[256];
1.77 + CMAPFormat2Subheader subheaders[ANY_NUMBER];
1.78 +};
1.79 +
1.80 +struct CMAPFormat4Encoding : CMAPEncodingSubtable
1.81 +{
1.82 + le_uint16 segCountX2;
1.83 + le_uint16 searchRange;
1.84 + le_uint16 entrySelector;
1.85 + le_uint16 rangeShift;
1.86 + le_uint16 endCodes[ANY_NUMBER];
1.87 +// le_uint16 reservedPad;
1.88 +// le_uint16 startCodes[ANY_NUMBER];
1.89 +// le_uint16 idDelta[ANY_NUMBER];
1.90 +// le_uint16 idRangeOffset[ANY_NUMBER];
1.91 +// le_uint16 glyphIndexArray[ANY_NUMBER];
1.92 +};
1.93 +
1.94 +struct CMAPFormat6Encoding : CMAPEncodingSubtable
1.95 +{
1.96 + le_uint16 firstCode;
1.97 + le_uint16 entryCount;
1.98 + le_uint16 glyphIndexArray[ANY_NUMBER];
1.99 +};
1.100 +
1.101 +struct CMAPEncodingSubtable32
1.102 +{
1.103 + le_uint32 format;
1.104 + le_uint32 length;
1.105 + le_uint32 language;
1.106 +};
1.107 +
1.108 +struct CMAPGroup
1.109 +{
1.110 + le_uint32 startCharCode;
1.111 + le_uint32 endCharCode;
1.112 + le_uint32 startGlyphCode;
1.113 +};
1.114 +
1.115 +struct CMAPFormat8Encoding : CMAPEncodingSubtable32
1.116 +{
1.117 + le_uint32 is32[65536/32];
1.118 + le_uint32 nGroups;
1.119 + CMAPGroup groups[ANY_NUMBER];
1.120 +};
1.121 +
1.122 +struct CMAPFormat10Encoding : CMAPEncodingSubtable32
1.123 +{
1.124 + le_uint32 startCharCode;
1.125 + le_uint32 numCharCodes;
1.126 + le_uint16 glyphs[ANY_NUMBER];
1.127 +};
1.128 +
1.129 +struct CMAPFormat12Encoding : CMAPEncodingSubtable32
1.130 +{
1.131 + le_uint32 nGroups;
1.132 + CMAPGroup groups[ANY_NUMBER];
1.133 +};
1.134 +
1.135 +typedef le_int32 fixed;
1.136 +
1.137 +struct BigDate
1.138 +{
1.139 + le_uint32 bc;
1.140 + le_uint32 ad;
1.141 +};
1.142 +
1.143 +struct HEADTable
1.144 +{
1.145 + fixed version;
1.146 + fixed fontRevision;
1.147 + le_uint32 checksumAdjustment;
1.148 + le_uint32 magicNumber;
1.149 + le_uint16 flags;
1.150 + le_uint16 unitsPerEm;
1.151 + BigDate created;
1.152 + BigDate modified;
1.153 + le_int16 xMin;
1.154 + le_int16 yMin;
1.155 + le_int16 xMax;
1.156 + le_int16 yMax;
1.157 + le_int16 lowestRecPPEM;
1.158 + le_int16 fontDirectionHint;
1.159 + le_int16 indexToLocFormat;
1.160 + le_int16 glyphDataFormat;
1.161 +};
1.162 +
1.163 +struct MAXPTable
1.164 +{
1.165 + fixed version;
1.166 + le_uint16 numGlyphs;
1.167 + le_uint16 maxPoints;
1.168 + le_uint16 maxContours;
1.169 + le_uint16 maxComponentPoints;
1.170 + le_uint16 maxComponentContours;
1.171 + le_uint16 maxZones;
1.172 + le_uint16 maxTwilightPoints;
1.173 + le_uint16 maxStorage;
1.174 + le_uint16 maxFunctionDefs;
1.175 + le_uint16 maxInstructionDefs;
1.176 + le_uint16 maxStackElements;
1.177 + le_uint16 maxSizeOfInstructions;
1.178 + le_uint16 maxComponentElements;
1.179 + le_uint16 maxComponentDepth;
1.180 +};
1.181 +
1.182 +struct HHEATable
1.183 +{
1.184 + fixed version;
1.185 + le_int16 ascent;
1.186 + le_int16 descent;
1.187 + le_int16 lineGap;
1.188 + le_uint16 advanceWidthMax;
1.189 + le_int16 minLeftSideBearing;
1.190 + le_int16 minRightSideBearing;
1.191 + le_int16 xMaxExtent;
1.192 + le_int16 caretSlopeRise;
1.193 + le_int16 caretSlopeRun;
1.194 + le_int16 caretOffset;
1.195 + le_int16 reserved1;
1.196 + le_int16 reserved2;
1.197 + le_int16 reserved3;
1.198 + le_int16 reserved4;
1.199 + le_int16 metricDataFormat;
1.200 + le_uint16 numOfLongHorMetrics;
1.201 +};
1.202 +
1.203 +struct LongHorMetric
1.204 +{
1.205 + le_uint16 advanceWidth;
1.206 + le_int16 leftSideBearing;
1.207 +};
1.208 +
1.209 +struct HMTXTable
1.210 +{
1.211 + LongHorMetric hMetrics[ANY_NUMBER]; // ANY_NUMBER = numOfLongHorMetrics from hhea table
1.212 +// le_int16 leftSideBearing[ANY_NUMBER]; // ANY_NUMBER = numGlyphs - numOfLongHorMetrics
1.213 +};
1.214 +
1.215 +#endif
1.216 +