]>
git.saurik.com Git - apple/icu.git/blob - icuSources/layout/ClassDefinitionTables.cpp
2 * @(#)ClassDefinitionTables.cpp 1.5 00/03/15
4 * (C) Copyright IBM Corp. 1998-2003 - All Rights Reserved
9 #include "OpenTypeTables.h"
10 #include "OpenTypeUtilities.h"
11 #include "ClassDefinitionTables.h"
16 le_int32
ClassDefinitionTable::getGlyphClass(LEGlyphID glyphID
) const
18 switch(SWAPW(classFormat
)) {
24 const ClassDefFormat1Table
*f1Table
= (const ClassDefFormat1Table
*) this;
26 return f1Table
->getGlyphClass(glyphID
);
31 const ClassDefFormat2Table
*f2Table
= (const ClassDefFormat2Table
*) this;
33 return f2Table
->getGlyphClass(glyphID
);
41 le_bool
ClassDefinitionTable::hasGlyphClass(le_int32 glyphClass
) const
43 switch(SWAPW(classFormat
)) {
49 const ClassDefFormat1Table
*f1Table
= (const ClassDefFormat1Table
*) this;
51 return f1Table
->hasGlyphClass(glyphClass
);
56 const ClassDefFormat2Table
*f2Table
= (const ClassDefFormat2Table
*) this;
58 return f2Table
->hasGlyphClass(glyphClass
);
66 le_int32
ClassDefFormat1Table::getGlyphClass(LEGlyphID glyphID
) const
68 TTGlyphID ttGlyphID
= (TTGlyphID
) LE_GET_GLYPH(glyphID
);
69 TTGlyphID firstGlyph
= SWAPW(startGlyph
);
70 TTGlyphID lastGlyph
= firstGlyph
+ SWAPW(glyphCount
);
72 if (ttGlyphID
> firstGlyph
&& ttGlyphID
< lastGlyph
) {
73 return SWAPW(classValueArray
[ttGlyphID
- firstGlyph
]);
79 le_bool
ClassDefFormat1Table::hasGlyphClass(le_int32 glyphClass
) const
81 le_uint16 count
= SWAPW(glyphCount
);
84 for (i
= 0; i
< count
; i
+= 1) {
85 if (SWAPW(classValueArray
[i
]) == glyphClass
) {
93 le_int32
ClassDefFormat2Table::getGlyphClass(LEGlyphID glyphID
) const
95 TTGlyphID ttGlyph
= (TTGlyphID
) LE_GET_GLYPH(glyphID
);
96 le_uint16 rangeCount
= SWAPW(classRangeCount
);
98 OpenTypeUtilities::getGlyphRangeIndex(ttGlyph
, classRangeRecordArray
, rangeCount
);
100 if (rangeIndex
< 0) {
104 return SWAPW(classRangeRecordArray
[rangeIndex
].rangeValue
);
107 le_bool
ClassDefFormat2Table::hasGlyphClass(le_int32 glyphClass
) const
109 le_uint16 rangeCount
= SWAPW(classRangeCount
);
112 for (i
= 0; i
< rangeCount
; i
+= 1) {
113 if (SWAPW(classRangeRecordArray
[i
].rangeValue
) == glyphClass
) {