blob: 73cc19d21d5c75c1446315159c2b6c6a68211453 [file] [log] [blame]
/*
* @(#)SegmentSingleProcessor.cpp 1.6 00/03/15
*
* (C) Copyright IBM Corp. 1998, 1999, 2000, 2001 - All Rights Reserved
*
*/
#include "LETypes.h"
#include "MorphTables.h"
#include "SubtableProcessor.h"
#include "NonContextualGlyphSubst.h"
#include "NonContextualGlyphSubstProc.h"
#include "SegmentSingleProcessor.h"
#include "LESwaps.h"
U_NAMESPACE_BEGIN
const char SegmentSingleProcessor::fgClassID=0;
SegmentSingleProcessor::SegmentSingleProcessor()
{
}
SegmentSingleProcessor::SegmentSingleProcessor(const MorphSubtableHeader *morphSubtableHeader)
: NonContextualGlyphSubstitutionProcessor(morphSubtableHeader)
{
const NonContextualGlyphSubstitutionHeader *header = (const NonContextualGlyphSubstitutionHeader *) morphSubtableHeader;
segmentSingleLookupTable = (const SegmentSingleLookupTable *) &header->table;
}
SegmentSingleProcessor::~SegmentSingleProcessor()
{
}
void SegmentSingleProcessor::process(LEGlyphID *glyphs, le_int32 * /*charIndices*/, le_int32 glyphCount)
{
const LookupSegment *segments = segmentSingleLookupTable->segments;
le_int32 glyph;
for (glyph = 0; glyph < glyphCount; glyph += 1) {
const LookupSegment *lookupSegment = segmentSingleLookupTable->lookupSegment(segments, glyphs[glyph]);
if (lookupSegment != NULL) {
TTGlyphID newGlyph = (TTGlyphID) LE_GET_GLYPH(glyphs[glyph]) + SWAPW(lookupSegment->value);
glyphs[glyph] = LE_SET_GLYPH(glyphs[glyph], newGlyph);
}
}
}
U_NAMESPACE_END