1/*
2 *
3 * (C) Copyright IBM Corp. 1998-2004 - All Rights Reserved
4 *
5 */
6
7#ifndef __LOOKUPTABLES_H
8#define __LOOKUPTABLES_H
9
10/**
11 * \file
12 * \internal
13 */
14
15#include "LETypes.h"
16#include "LayoutTables.h"
17
18U_NAMESPACE_BEGIN
19
20enum LookupTableFormat
21{
22    ltfSimpleArray      = 0,
23    ltfSegmentSingle    = 2,
24    ltfSegmentArray     = 4,
25    ltfSingleTable      = 6,
26    ltfTrimmedArray     = 8
27};
28
29typedef le_int16 LookupValue;
30
31struct LookupTable
32{
33    le_int16 format;
34};
35
36struct LookupSegment
37{
38    TTGlyphID   lastGlyph;
39    TTGlyphID   firstGlyph;
40    LookupValue value;
41};
42
43struct LookupSingle
44{
45    TTGlyphID   glyph;
46    LookupValue value;
47};
48
49struct BinarySearchLookupTable : LookupTable
50{
51    le_int16 unitSize;
52    le_int16 nUnits;
53    le_int16 searchRange;
54    le_int16 entrySelector;
55    le_int16 rangeShift;
56
57    const LookupSegment *lookupSegment(const LookupSegment *segments, LEGlyphID glyph) const;
58
59    const LookupSingle *lookupSingle(const LookupSingle *entries, LEGlyphID glyph) const;
60};
61
62struct SimpleArrayLookupTable : LookupTable
63{
64    LookupValue valueArray[ANY_NUMBER];
65};
66
67struct SegmentSingleLookupTable : BinarySearchLookupTable
68{
69    LookupSegment segments[ANY_NUMBER];
70};
71
72struct SegmentArrayLookupTable : BinarySearchLookupTable
73{
74    LookupSegment segments[ANY_NUMBER];
75};
76
77struct SingleTableLookupTable : BinarySearchLookupTable
78{
79    LookupSingle entries[ANY_NUMBER];
80};
81
82struct TrimmedArrayLookupTable : LookupTable
83{
84    TTGlyphID   firstGlyph;
85    TTGlyphID   glyphCount;
86    LookupValue valueArray[ANY_NUMBER];
87};
88
89U_NAMESPACE_END
90#endif
91