• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  *
3  * (C) Copyright IBM Corp. 1998-2013 - All Rights Reserved
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"
13 #include "LEGlyphStorage.h"
14 #include "LESwaps.h"
15 
16 U_NAMESPACE_BEGIN
17 
UOBJECT_DEFINE_RTTI_IMPLEMENTATION(SingleTableProcessor)18 UOBJECT_DEFINE_RTTI_IMPLEMENTATION(SingleTableProcessor)
19 
20 SingleTableProcessor::SingleTableProcessor()
21 {
22 }
23 
SingleTableProcessor(const LEReferenceTo<MorphSubtableHeader> & morphSubtableHeader,LEErrorCode & success)24 SingleTableProcessor::SingleTableProcessor(const LEReferenceTo<MorphSubtableHeader> &morphSubtableHeader, LEErrorCode &success)
25   : NonContextualGlyphSubstitutionProcessor(morphSubtableHeader, success)
26 {
27   LEReferenceTo<NonContextualGlyphSubstitutionHeader> header(morphSubtableHeader, success);
28   singleTableLookupTable = LEReferenceTo<SingleTableLookupTable>(morphSubtableHeader, success, (const SingleTableLookupTable*)&header->table);
29 }
30 
~SingleTableProcessor()31 SingleTableProcessor::~SingleTableProcessor()
32 {
33 }
34 
process(LEGlyphStorage & glyphStorage,LEErrorCode & success)35 void SingleTableProcessor::process(LEGlyphStorage &glyphStorage, LEErrorCode &success)
36 {
37     const LookupSingle *entries = singleTableLookupTable->entries;
38     le_int32 glyph;
39     le_int32 glyphCount = glyphStorage.getGlyphCount();
40 
41     for (glyph = 0; glyph < glyphCount; glyph += 1) {
42       const LookupSingle *lookupSingle = singleTableLookupTable->lookupSingle(singleTableLookupTable, entries, glyphStorage[glyph], success);
43 
44         if (lookupSingle != NULL) {
45             glyphStorage[glyph] = SWAPW(lookupSingle->value);
46         }
47     }
48 }
49 
50 U_NAMESPACE_END
51