sl@0: /* sl@0: * sl@0: * (C) Copyright IBM Corp. 1998-2004 - All Rights Reserved sl@0: * sl@0: */ sl@0: sl@0: #include "LETypes.h" sl@0: #include "MorphTables.h" sl@0: #include "SubtableProcessor.h" sl@0: #include "NonContextualGlyphSubst.h" sl@0: #include "NonContextualGlyphSubstProc.h" sl@0: #include "SegmentArrayProcessor.h" sl@0: #include "LEGlyphStorage.h" sl@0: #include "LESwaps.h" sl@0: sl@0: U_NAMESPACE_BEGIN sl@0: sl@0: UOBJECT_DEFINE_RTTI_IMPLEMENTATION(SegmentArrayProcessor) sl@0: sl@0: SegmentArrayProcessor::SegmentArrayProcessor() sl@0: { sl@0: } sl@0: sl@0: SegmentArrayProcessor::SegmentArrayProcessor(const MorphSubtableHeader *morphSubtableHeader) sl@0: : NonContextualGlyphSubstitutionProcessor(morphSubtableHeader) sl@0: { sl@0: const NonContextualGlyphSubstitutionHeader *header = (const NonContextualGlyphSubstitutionHeader *) morphSubtableHeader; sl@0: sl@0: segmentArrayLookupTable = (const SegmentArrayLookupTable *) &header->table; sl@0: } sl@0: sl@0: SegmentArrayProcessor::~SegmentArrayProcessor() sl@0: { sl@0: } sl@0: sl@0: void SegmentArrayProcessor::process(LEGlyphStorage &glyphStorage) sl@0: { sl@0: const LookupSegment *segments = segmentArrayLookupTable->segments; sl@0: le_int32 glyphCount = glyphStorage.getGlyphCount(); sl@0: le_int32 glyph; sl@0: sl@0: for (glyph = 0; glyph < glyphCount; glyph += 1) { sl@0: LEGlyphID thisGlyph = glyphStorage[glyph]; sl@0: const LookupSegment *lookupSegment = segmentArrayLookupTable->lookupSegment(segments, thisGlyph); sl@0: sl@0: if (lookupSegment != NULL) { sl@0: TTGlyphID firstGlyph = SWAPW(lookupSegment->firstGlyph); sl@0: le_int16 offset = SWAPW(lookupSegment->value); sl@0: sl@0: if (offset != 0) { sl@0: TTGlyphID *glyphArray = (TTGlyphID *) ((char *) subtableHeader + offset); sl@0: TTGlyphID newGlyph = SWAPW(glyphArray[LE_GET_GLYPH(thisGlyph) - firstGlyph]); sl@0: sl@0: glyphStorage[glyph] = LE_SET_GLYPH(thisGlyph, newGlyph); sl@0: } sl@0: } sl@0: } sl@0: } sl@0: sl@0: U_NAMESPACE_END