• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  *
3  * (C) Copyright IBM Corp. 1998-2004 - 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 MorphSubtableHeader * moprhSubtableHeader)24 SingleTableProcessor::SingleTableProcessor(const MorphSubtableHeader *moprhSubtableHeader)
25   : NonContextualGlyphSubstitutionProcessor(moprhSubtableHeader)
26 {
27     const NonContextualGlyphSubstitutionHeader *header = (const NonContextualGlyphSubstitutionHeader *) moprhSubtableHeader;
28 
29     singleTableLookupTable = (const SingleTableLookupTable *) &header->table;
30 }
31 
~SingleTableProcessor()32 SingleTableProcessor::~SingleTableProcessor()
33 {
34 }
35 
process(LEGlyphStorage & glyphStorage)36 void SingleTableProcessor::process(LEGlyphStorage &glyphStorage)
37 {
38     const LookupSingle *entries = singleTableLookupTable->entries;
39     le_int32 glyph;
40     le_int32 glyphCount = glyphStorage.getGlyphCount();
41 
42     for (glyph = 0; glyph < glyphCount; glyph += 1) {
43         const LookupSingle *lookupSingle = singleTableLookupTable->lookupSingle(entries, glyphStorage[glyph]);
44 
45         if (lookupSingle != NULL) {
46             glyphStorage[glyph] = SWAPW(lookupSingle->value);
47         }
48     }
49 }
50 
51 U_NAMESPACE_END
52