| 1 |
/* otftables.h -- define data structures for various OpenType Tables |
| 2 |
* See Also: OpenType Specification |
| 3 |
*/ |
| 4 |
|
| 5 |
#ifndef __TTF_OTFTABLES_H |
| 6 |
#define __TTF_OTFTABLES_H |
| 7 |
|
| 8 |
typedef struct |
| 9 |
{ |
| 10 |
USHORT reqFeatureIndex; |
| 11 |
USHORT featureCount; |
| 12 |
USHORT *featureIndex; /* length = featureCount */ |
| 13 |
} |
| 14 |
LangSys, *LangSysPtr; |
| 15 |
|
| 16 |
typedef struct |
| 17 |
{ |
| 18 |
ULONG tag; |
| 19 |
LangSysPtr langSys; |
| 20 |
} |
| 21 |
LangSysRecord, *LangSysRecordPtr; |
| 22 |
|
| 23 |
typedef struct |
| 24 |
{ |
| 25 |
ULONG tag; |
| 26 |
LangSysPtr defaultLangSys; |
| 27 |
USHORT langSysCount; |
| 28 |
LangSysRecord *langSysRecord; /* length = langSysCount */ |
| 29 |
} |
| 30 |
ScriptRecord, *ScriptRecordPtr; |
| 31 |
|
| 32 |
typedef struct |
| 33 |
{ |
| 34 |
USHORT scriptCount; |
| 35 |
ScriptRecord *scriptRecord; /* length = scriptCount */ |
| 36 |
} |
| 37 |
ScriptList, *ScriptListPtr; |
| 38 |
|
| 39 |
typedef struct |
| 40 |
{ |
| 41 |
ULONG tag; |
| 42 |
USHORT featureParams; |
| 43 |
USHORT lookupCount; |
| 44 |
USHORT *lookupListIndex; /* length = lookupCount */ |
| 45 |
} |
| 46 |
FeatureRecord, *FeatureRecordPtr; |
| 47 |
|
| 48 |
typedef struct |
| 49 |
{ |
| 50 |
USHORT featureCount; |
| 51 |
FeatureRecord *featureRecord; /* length = featureCount */ |
| 52 |
} |
| 53 |
FeatureList, *FeatureListPtr; |
| 54 |
|
| 55 |
typedef struct |
| 56 |
{ |
| 57 |
USHORT start; |
| 58 |
USHORT end; |
| 59 |
USHORT startCoverageIndex; |
| 60 |
} |
| 61 |
RangeRecord, *RangeRecordPtr; |
| 62 |
|
| 63 |
typedef struct |
| 64 |
{ |
| 65 |
USHORT coverageFormat; /* = 1 */ |
| 66 |
USHORT glyphCount; |
| 67 |
USHORT *glyphArray; /* length = glyphCount */ |
| 68 |
} |
| 69 |
Coverage1, *Coverage1Ptr; |
| 70 |
|
| 71 |
typedef struct |
| 72 |
{ |
| 73 |
USHORT coverageFormat; /* = 2 */ |
| 74 |
USHORT rangeCount; |
| 75 |
RangeRecordPtr rangeRecord; /* length = rangeCount */ |
| 76 |
} |
| 77 |
Coverage2, *Coverage2Ptr; |
| 78 |
|
| 79 |
typedef union |
| 80 |
{ |
| 81 |
USHORT *format; |
| 82 |
Coverage1Ptr coverage1; |
| 83 |
Coverage2Ptr coverage2; |
| 84 |
} |
| 85 |
CoveragePtr; |
| 86 |
|
| 87 |
typedef struct |
| 88 |
{ |
| 89 |
USHORT start; |
| 90 |
USHORT end; |
| 91 |
USHORT classValue; |
| 92 |
} |
| 93 |
ClassRangeRecord, *ClassRangeRecordPtr; |
| 94 |
|
| 95 |
typedef struct |
| 96 |
{ |
| 97 |
USHORT classFormat; /* = 1 */ |
| 98 |
USHORT startGlyph; |
| 99 |
USHORT glyphCount; |
| 100 |
USHORT *classValueArray; /* length = glyphCount */ |
| 101 |
} |
| 102 |
ClassDef1, *ClassDef1Ptr; |
| 103 |
|
| 104 |
typedef struct |
| 105 |
{ |
| 106 |
USHORT classFormat; /* = 2 */ |
| 107 |
USHORT classRangeCount; |
| 108 |
ClassRangeRecordPtr classRangeRecord; /* length = classRangeCount */ |
| 109 |
} |
| 110 |
ClassDef2, *ClassDef2Ptr; |
| 111 |
|
| 112 |
typedef union |
| 113 |
{ |
| 114 |
USHORT *format; |
| 115 |
ClassDef1Ptr classDef1; |
| 116 |
ClassDef2Ptr classDef2; |
| 117 |
} |
| 118 |
ClassDefPtr; |
| 119 |
|
| 120 |
typedef struct |
| 121 |
{ |
| 122 |
USHORT startSize; |
| 123 |
USHORT endSize; |
| 124 |
USHORT deltaFormat; /* = 1, 2, or 3 */ |
| 125 |
USHORT deltaValue[1]; /* variable size |
| 126 |
* (endSize-startSize+1) entries |
| 127 |
* 8, 4, or 2 entries per array element */ |
| 128 |
} |
| 129 |
Device, *DevicePtr; |
| 130 |
|
| 131 |
typedef struct |
| 132 |
{ |
| 133 |
USHORT sequenceIndex; |
| 134 |
USHORT lookupListIndex; |
| 135 |
} |
| 136 |
OtfLookupRecord, *OtfLookupRecordPtr; |
| 137 |
|
| 138 |
typedef struct |
| 139 |
{ |
| 140 |
USHORT glyphCount; |
| 141 |
USHORT otfCount; |
| 142 |
USHORT *input; /* length = glyphCount - 1 */ |
| 143 |
OtfLookupRecordPtr otf; /* length = otfCount */ |
| 144 |
} |
| 145 |
OtfRule, *OtfRulePtr; |
| 146 |
|
| 147 |
typedef struct |
| 148 |
{ |
| 149 |
USHORT otfRuleCount; |
| 150 |
OtfRulePtr otfRule; /* length = otfRuleCount */ |
| 151 |
} |
| 152 |
OtfRuleSet, *OtfRuleSetPtr; |
| 153 |
|
| 154 |
typedef struct |
| 155 |
{ |
| 156 |
USHORT lookupType; /* = 7 (GPOS) or 5 (GSUB) */ |
| 157 |
USHORT lookupFormat; /* = 1 */ |
| 158 |
CoveragePtr coverage; |
| 159 |
USHORT otfRuleSetCount; |
| 160 |
OtfRuleSetPtr otfRuleSet; /* length = otfRuleSetCount */ |
| 161 |
} |
| 162 |
OtfCtx1, *OtfCtx1Ptr; |
| 163 |
|
| 164 |
OtfCtx1Ptr makeOTFCtx1 (FILE *fp, ULONG offset); |
| 165 |
void printOTFCtx1 (FILE *fp, OtfCtx1Ptr otf); |
| 166 |
void freeOTFCtx1 (OtfCtx1Ptr otf); |
| 167 |
|
| 168 |
typedef struct |
| 169 |
{ |
| 170 |
USHORT glyphCount; |
| 171 |
USHORT otfCount; |
| 172 |
USHORT *class; /* length = glyphCount - 1 */ |
| 173 |
OtfLookupRecordPtr otf; /* length = otfCount */ |
| 174 |
} |
| 175 |
OtfClassRule, *OtfClassRulePtr; |
| 176 |
|
| 177 |
typedef struct |
| 178 |
{ |
| 179 |
USHORT otfClassRuleCnt; |
| 180 |
OtfClassRulePtr otfClassRule; /* length = otfClassRuleCnt */ |
| 181 |
} |
| 182 |
OtfClassSet, *OtfClassSetPtr; |
| 183 |
|
| 184 |
typedef struct |
| 185 |
{ |
| 186 |
USHORT lookupType; /* = 7 (GPOS) or 5 (GSUB) */ |
| 187 |
USHORT lookupFormat; /* = 2 */ |
| 188 |
CoveragePtr coverage; |
| 189 |
ClassDefPtr classDef; |
| 190 |
USHORT otfClassSetCnt; |
| 191 |
OtfClassSetPtr otfClassSet; /* length = otfClassSetCnt */ |
| 192 |
} |
| 193 |
OtfCtx2, *OtfCtx2Ptr; |
| 194 |
|
| 195 |
OtfCtx2Ptr makeOTFCtx2 (FILE *fp, ULONG offset); |
| 196 |
void printOTFCtx2 (FILE *fp, OtfCtx2Ptr otf); |
| 197 |
void freeOTFCtx2 (OtfCtx2Ptr otf); |
| 198 |
|
| 199 |
typedef struct |
| 200 |
{ |
| 201 |
USHORT lookupType; /* = 7 (GPOS) or 5 (GSUB) */ |
| 202 |
USHORT lookupFormat; /* = 3 */ |
| 203 |
USHORT glyphCount; |
| 204 |
USHORT otfCount; |
| 205 |
CoveragePtr *glyphs; /* length = glyphCount */ |
| 206 |
OtfLookupRecordPtr otf; /* length = otfCount */ |
| 207 |
} |
| 208 |
OtfCtx3, *OtfCtx3Ptr; |
| 209 |
|
| 210 |
OtfCtx3Ptr makeOTFCtx3 (FILE *fp, ULONG offset); |
| 211 |
void printOTFCtx3 (FILE *fp, OtfCtx3Ptr otf); |
| 212 |
void freeOTFCtx3 (OtfCtx3Ptr otf); |
| 213 |
|
| 214 |
typedef struct |
| 215 |
{ |
| 216 |
USHORT backtrackGlyphCount; |
| 217 |
USHORT *backtrack; /* length = backtrackGlyphCount */ |
| 218 |
USHORT inputGlyphCount; |
| 219 |
USHORT *input; /* length = inputGlyphCount - 1 */ |
| 220 |
USHORT lookaheadGlyphCount; |
| 221 |
USHORT *lookahead; /* length = lookaheadGlyphCount */ |
| 222 |
USHORT otfCount; |
| 223 |
OtfLookupRecordPtr otf; /* length = otfCount */ |
| 224 |
} |
| 225 |
ChainOtfRule, *ChainOtfRulePtr; |
| 226 |
|
| 227 |
typedef struct |
| 228 |
{ |
| 229 |
USHORT chainOtfRuleCount; |
| 230 |
ChainOtfRulePtr chainOtfRule; /* length = chainOtfRuleCount */ |
| 231 |
} |
| 232 |
ChainOtfRuleSet, *ChainOtfRuleSetPtr; |
| 233 |
|
| 234 |
typedef struct |
| 235 |
{ |
| 236 |
USHORT lookupType; /* = 8 (GPOS) or 6 (GSUB) */ |
| 237 |
USHORT lookupFormat; /* = 1 */ |
| 238 |
CoveragePtr coverage; |
| 239 |
USHORT chainOtfRuleSetCount; |
| 240 |
ChainOtfRuleSetPtr chainOtfRuleSet; /* length = chainOtfRuleSetCount */ |
| 241 |
} |
| 242 |
OtfChn1, *OtfChn1Ptr; |
| 243 |
|
| 244 |
OtfChn1Ptr makeOTFChn1 (FILE *fp, ULONG offset); |
| 245 |
void printOTFChn1 (FILE *fp, OtfChn1Ptr otf); |
| 246 |
void freeOTFChn1 (OtfChn1Ptr otf); |
| 247 |
|
| 248 |
typedef struct |
| 249 |
{ |
| 250 |
USHORT backtrackGlyphCount; |
| 251 |
USHORT *backtrack; /* length = backtrackGlyphCount */ |
| 252 |
USHORT inputGlyphCount; |
| 253 |
USHORT *input; /* length = inputGlyphCount - 1 */ |
| 254 |
USHORT lookaheadGlyphCount; |
| 255 |
USHORT *lookahead; /* length = lookaheadGlyphCount */ |
| 256 |
USHORT otfCount; |
| 257 |
OtfLookupRecordPtr otf; /* length = otfCount */ |
| 258 |
} |
| 259 |
ChainOtfClassRule, *ChainOtfClassRulePtr; |
| 260 |
|
| 261 |
typedef struct |
| 262 |
{ |
| 263 |
USHORT chainOtfClassRuleCnt; |
| 264 |
ChainOtfClassRulePtr chainOtfClassRule; /* length = chainOtfClassRuleCnt */ |
| 265 |
} |
| 266 |
ChainOtfClassSet, *ChainOtfClassSetPtr; |
| 267 |
|
| 268 |
typedef struct |
| 269 |
{ |
| 270 |
USHORT lookupType; /* = 8 (GPOS) or 6 (GSUB) */ |
| 271 |
USHORT lookupFormat; /* = 2 */ |
| 272 |
CoveragePtr coverage; |
| 273 |
ClassDefPtr backtrackClassDef; |
| 274 |
ClassDefPtr inputClassDef; |
| 275 |
ClassDefPtr lookaheadClassDef; |
| 276 |
USHORT chainOtfClassSetCnt; |
| 277 |
ChainOtfClassSetPtr chainOtfClassSet; /* length = chainOtfClassSetCnt */ |
| 278 |
} |
| 279 |
OtfChn2, *OtfChn2Ptr; |
| 280 |
|
| 281 |
OtfChn2Ptr makeOTFChn2 (FILE *fp, ULONG offset); |
| 282 |
void printOTFChn2 (FILE *fp, OtfChn2Ptr otf); |
| 283 |
void freeOTFChn2 (OtfChn2Ptr otf); |
| 284 |
|
| 285 |
typedef struct |
| 286 |
{ |
| 287 |
USHORT lookupType; /* = 8 (GPOS) or 6 (GSUB) */ |
| 288 |
USHORT lookupFormat; /* = 3 */ |
| 289 |
USHORT backtrackGlyphCount; |
| 290 |
CoveragePtr *backtrack; /* length = backtrackGlyphCount */ |
| 291 |
USHORT inputGlyphCount; |
| 292 |
CoveragePtr *input; /* length = inputGlyphCount */ |
| 293 |
USHORT lookaheadGlyphCount; |
| 294 |
CoveragePtr *lookahead; /* length = lookaheadGlyphCount */ |
| 295 |
USHORT otfCount; |
| 296 |
OtfLookupRecordPtr otf; /* length = otfCount */ |
| 297 |
} |
| 298 |
OtfChn3, *OtfChn3Ptr; |
| 299 |
|
| 300 |
OtfChn3Ptr makeOTFChn3 (FILE *fp, ULONG offset); |
| 301 |
void printOTFChn3 (FILE *fp, OtfChn3Ptr otf); |
| 302 |
void freeOTFChn3 (OtfChn3Ptr otf); |
| 303 |
|
| 304 |
#include "gpos.h" |
| 305 |
#include "gsub.h" |
| 306 |
|
| 307 |
typedef struct |
| 308 |
{ |
| 309 |
USHORT lookupType; |
| 310 |
USHORT lookupFormat; |
| 311 |
} |
| 312 |
OtfLookup, *OtfLookupPtr; |
| 313 |
|
| 314 |
typedef union |
| 315 |
{ |
| 316 |
OtfLookupPtr otf; |
| 317 |
PosLookupPtr pos; |
| 318 |
SubLookupPtr sub; |
| 319 |
} |
| 320 |
LookupPtr; |
| 321 |
|
| 322 |
typedef struct |
| 323 |
{ |
| 324 |
USHORT lookupFlag; |
| 325 |
USHORT subTableCount; |
| 326 |
USHORT markFilteringSet; |
| 327 |
LookupPtr *lookup; /* length = subTableCount */ |
| 328 |
} LookupRecord, *LookupRecordPtr; |
| 329 |
|
| 330 |
/* LookupFlag Bits */ |
| 331 |
#define LookupFlag_RightToLeft 0x0001 |
| 332 |
#define lookupFlag_IgnoreBaseGlyphs 0x0002 |
| 333 |
#define lookupFlag_IgnoreLigatures 0x0004 |
| 334 |
#define lookupFlag_IgnoreMarks 0x0008 |
| 335 |
#define lookupFlag_UseMarkFilteringSet 0x0010 |
| 336 |
#define lookupFlag_Reserved 0x00e0 |
| 337 |
#define lookupFlag_MarkAttachmentType 0xff00 |
| 338 |
|
| 339 |
typedef struct |
| 340 |
{ |
| 341 |
USHORT lookupCount; |
| 342 |
LookupRecord *lookupRecord; |
| 343 |
} |
| 344 |
LookupList, *LookupListPtr; |
| 345 |
|
| 346 |
typedef LookupPtr (MakeLookupFunc) (FILE *fp, USHORT lookupType, ULONG offset); |
| 347 |
typedef void (PrintLookupFunc) (FILE *fp, LookupPtr lookup); |
| 348 |
typedef void (FreeLookupFunc) (LookupPtr lookup); |
| 349 |
|
| 350 |
typedef struct |
| 351 |
{ |
| 352 |
Fixed version; |
| 353 |
ScriptListPtr scriptList; |
| 354 |
FeatureListPtr featureList; |
| 355 |
LookupListPtr lookupList; |
| 356 |
} |
| 357 |
GPOS, *GPOSPtr; |
| 358 |
|
| 359 |
typedef struct |
| 360 |
{ |
| 361 |
Fixed version; |
| 362 |
ScriptListPtr scriptList; |
| 363 |
FeatureListPtr featureList; |
| 364 |
LookupListPtr lookupList; |
| 365 |
} |
| 366 |
GSUB, *GSUBPtr; |
| 367 |
|
| 368 |
#endif /* __TTF_OTFTABLES_H */ |