]>
git.saurik.com Git - apple/icu.git/blob - icuSources/layout/ClassDefinitionTables.cpp
3 * (C) Copyright IBM Corp. 1998-2010 - All Rights Reserved
8 #include "OpenTypeTables.h"
9 #include "OpenTypeUtilities.h"
10 #include "ClassDefinitionTables.h"
15 le_int32
ClassDefinitionTable::getGlyphClass(LEGlyphID glyphID
) const
17 switch(SWAPW(classFormat
)) {
23 const ClassDefFormat1Table
*f1Table
= (const ClassDefFormat1Table
*) this;
25 return f1Table
->getGlyphClass(glyphID
);
30 const ClassDefFormat2Table
*f2Table
= (const ClassDefFormat2Table
*) this;
32 return f2Table
->getGlyphClass(glyphID
);
40 le_bool
ClassDefinitionTable::hasGlyphClass(le_int32 glyphClass
) const
42 switch(SWAPW(classFormat
)) {
48 const ClassDefFormat1Table
*f1Table
= (const ClassDefFormat1Table
*) this;
50 return f1Table
->hasGlyphClass(glyphClass
);
55 const ClassDefFormat2Table
*f2Table
= (const ClassDefFormat2Table
*) this;
57 return f2Table
->hasGlyphClass(glyphClass
);
65 le_int32
ClassDefFormat1Table::getGlyphClass(LEGlyphID glyphID
) const
67 TTGlyphID ttGlyphID
= (TTGlyphID
) LE_GET_GLYPH(glyphID
);
68 TTGlyphID firstGlyph
= SWAPW(startGlyph
);
69 TTGlyphID lastGlyph
= firstGlyph
+ SWAPW(glyphCount
);
71 if (ttGlyphID
>= firstGlyph
&& ttGlyphID
< lastGlyph
) {
72 return SWAPW(classValueArray
[ttGlyphID
- firstGlyph
]);
78 le_bool
ClassDefFormat1Table::hasGlyphClass(le_int32 glyphClass
) const
80 le_uint16 count
= SWAPW(glyphCount
);
83 for (i
= 0; i
< count
; i
+= 1) {
84 if (SWAPW(classValueArray
[i
]) == glyphClass
) {
92 le_int32
ClassDefFormat2Table::getGlyphClass(LEGlyphID glyphID
) const
94 TTGlyphID ttGlyph
= (TTGlyphID
) LE_GET_GLYPH(glyphID
);
95 le_uint16 rangeCount
= SWAPW(classRangeCount
);
97 OpenTypeUtilities::getGlyphRangeIndex(ttGlyph
, classRangeRecordArray
, rangeCount
);
103 return SWAPW(classRangeRecordArray
[rangeIndex
].rangeValue
);
106 le_bool
ClassDefFormat2Table::hasGlyphClass(le_int32 glyphClass
) const
108 le_uint16 rangeCount
= SWAPW(classRangeCount
);
111 for (i
= 0; i
< rangeCount
; i
+= 1) {
112 if (SWAPW(classRangeRecordArray
[i
].rangeValue
) == glyphClass
) {