]> git.saurik.com Git - apple/icu.git/blob - icuSources/layout/TrimmedArrayProcessor.cpp
ICU-3.13.tar.gz
[apple/icu.git] / icuSources / layout / TrimmedArrayProcessor.cpp
1 /*
2 * @(#)TrimmedArrayProcessor.cpp 1.6 00/03/15
3 *
4 * (C) Copyright IBM Corp. 1998-2003 - All Rights Reserved
5 *
6 */
7
8 #include "LETypes.h"
9 #include "MorphTables.h"
10 #include "SubtableProcessor.h"
11 #include "NonContextualGlyphSubst.h"
12 #include "NonContextualGlyphSubstProc.h"
13 #include "TrimmedArrayProcessor.h"
14 #include "LESwaps.h"
15
16 U_NAMESPACE_BEGIN
17
18 const char TrimmedArrayProcessor::fgClassID=0;
19
20 TrimmedArrayProcessor::TrimmedArrayProcessor()
21 {
22 }
23
24 TrimmedArrayProcessor::TrimmedArrayProcessor(const MorphSubtableHeader *morphSubtableHeader)
25 : NonContextualGlyphSubstitutionProcessor(morphSubtableHeader)
26 {
27 const NonContextualGlyphSubstitutionHeader *header = (const NonContextualGlyphSubstitutionHeader *) morphSubtableHeader;
28
29 trimmedArrayLookupTable = (const TrimmedArrayLookupTable *) &header->table;
30 firstGlyph = SWAPW(trimmedArrayLookupTable->firstGlyph);
31 lastGlyph = firstGlyph + SWAPW(trimmedArrayLookupTable->glyphCount);
32 }
33
34 TrimmedArrayProcessor::~TrimmedArrayProcessor()
35 {
36 }
37
38 void TrimmedArrayProcessor::process(LEGlyphID *glyphs, le_int32 * /*charIndices*/, le_int32 glyphCount)
39 {
40 le_int32 glyph;
41
42 for (glyph = 0; glyph < glyphCount; glyph += 1) {
43 TTGlyphID ttGlyph = (TTGlyphID) LE_GET_GLYPH(glyphs[glyph]);
44
45 if ((ttGlyph > firstGlyph) && (ttGlyph < lastGlyph)) {
46 TTGlyphID newGlyph = SWAPW(trimmedArrayLookupTable->valueArray[ttGlyph - firstGlyph]);
47
48 glyphs[glyph] = LE_SET_GLYPH(glyphs[glyph], newGlyph);
49 }
50 }
51 }
52
53 U_NAMESPACE_END