]> git.saurik.com Git - apple/icu.git/blob - icuSources/layout/LookupTables.h
ICU-551.51.3.tar.gz
[apple/icu.git] / icuSources / layout / LookupTables.h
1 /*
2 *
3 * (C) Copyright IBM Corp. 1998-2013 - 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 #include "LETableReference.h"
18
19 U_NAMESPACE_BEGIN
20
21 enum LookupTableFormat
22 {
23 ltfSimpleArray = 0,
24 ltfSegmentSingle = 2,
25 ltfSegmentArray = 4,
26 ltfSingleTable = 6,
27 ltfTrimmedArray = 8
28 };
29
30 typedef le_int16 LookupValue;
31
32 struct LookupTable
33 {
34 le_int16 format;
35 };
36
37 struct LookupSegment
38 {
39 TTGlyphID lastGlyph;
40 TTGlyphID firstGlyph;
41 LookupValue value;
42 };
43
44 struct LookupSingle
45 {
46 TTGlyphID glyph;
47 LookupValue value;
48 };
49
50 struct BinarySearchLookupTable : LookupTable
51 {
52 le_int16 unitSize;
53 le_int16 nUnits;
54 le_int16 searchRange;
55 le_int16 entrySelector;
56 le_int16 rangeShift;
57
58 const LookupSegment *lookupSegment(const LETableReference &base, const LookupSegment *segments, LEGlyphID glyph, LEErrorCode &success) const;
59
60 const LookupSingle *lookupSingle(const LETableReference &base, const LookupSingle *entries, LEGlyphID glyph, LEErrorCode &success) const;
61 };
62
63 struct SimpleArrayLookupTable : LookupTable
64 {
65 LookupValue valueArray[ANY_NUMBER];
66 };
67 LE_VAR_ARRAY(SimpleArrayLookupTable, valueArray)
68
69 struct SegmentSingleLookupTable : BinarySearchLookupTable
70 {
71 LookupSegment segments[ANY_NUMBER];
72 };
73 LE_VAR_ARRAY(SegmentSingleLookupTable, segments)
74
75 struct SegmentArrayLookupTable : BinarySearchLookupTable
76 {
77 LookupSegment segments[ANY_NUMBER];
78 };
79 LE_VAR_ARRAY(SegmentArrayLookupTable, segments)
80
81 struct SingleTableLookupTable : BinarySearchLookupTable
82 {
83 LookupSingle entries[ANY_NUMBER];
84 };
85 LE_VAR_ARRAY(SingleTableLookupTable, entries)
86
87 struct TrimmedArrayLookupTable : LookupTable
88 {
89 TTGlyphID firstGlyph;
90 TTGlyphID glyphCount;
91 LookupValue valueArray[ANY_NUMBER];
92 };
93 LE_VAR_ARRAY(TrimmedArrayLookupTable, valueArray)
94
95 U_NAMESPACE_END
96 #endif