]>
Commit | Line | Data |
---|---|---|
b75a7d8f | 1 | /* |
b75a7d8f | 2 | * |
2ca993e8 | 3 | * (C) Copyright IBM Corp. 1998-2015 - All Rights Reserved |
b75a7d8f A |
4 | * |
5 | */ | |
6 | ||
7 | #include "LETypes.h" | |
8 | #include "MorphTables.h" | |
9 | #include "SubtableProcessor.h" | |
10 | #include "NonContextualGlyphSubst.h" | |
11 | #include "NonContextualGlyphSubstProc.h" | |
12 | #include "SingleTableProcessor.h" | |
374ca955 | 13 | #include "LEGlyphStorage.h" |
b75a7d8f A |
14 | #include "LESwaps.h" |
15 | ||
16 | U_NAMESPACE_BEGIN | |
17 | ||
374ca955 | 18 | UOBJECT_DEFINE_RTTI_IMPLEMENTATION(SingleTableProcessor) |
b75a7d8f A |
19 | |
20 | SingleTableProcessor::SingleTableProcessor() | |
21 | { | |
22 | } | |
23 | ||
57a6839d A |
24 | SingleTableProcessor::SingleTableProcessor(const LEReferenceTo<MorphSubtableHeader> &morphSubtableHeader, LEErrorCode &success) |
25 | : NonContextualGlyphSubstitutionProcessor(morphSubtableHeader, success) | |
b75a7d8f | 26 | { |
57a6839d A |
27 | LEReferenceTo<NonContextualGlyphSubstitutionHeader> header(morphSubtableHeader, success); |
28 | singleTableLookupTable = LEReferenceTo<SingleTableLookupTable>(morphSubtableHeader, success, (const SingleTableLookupTable*)&header->table); | |
b75a7d8f A |
29 | } |
30 | ||
31 | SingleTableProcessor::~SingleTableProcessor() | |
32 | { | |
33 | } | |
34 | ||
57a6839d | 35 | void SingleTableProcessor::process(LEGlyphStorage &glyphStorage, LEErrorCode &success) |
b75a7d8f A |
36 | { |
37 | const LookupSingle *entries = singleTableLookupTable->entries; | |
38 | le_int32 glyph; | |
374ca955 | 39 | le_int32 glyphCount = glyphStorage.getGlyphCount(); |
b75a7d8f | 40 | |
2ca993e8 A |
41 | if (LE_FAILURE(success)) return; |
42 | ||
b75a7d8f | 43 | for (glyph = 0; glyph < glyphCount; glyph += 1) { |
57a6839d | 44 | const LookupSingle *lookupSingle = singleTableLookupTable->lookupSingle(singleTableLookupTable, entries, glyphStorage[glyph], success); |
b75a7d8f A |
45 | |
46 | if (lookupSingle != NULL) { | |
374ca955 | 47 | glyphStorage[glyph] = SWAPW(lookupSingle->value); |
b75a7d8f A |
48 | } |
49 | } | |
50 | } | |
51 | ||
52 | U_NAMESPACE_END |