2000-11-28 20:56:52 +00:00
|
|
|
/*
|
|
|
|
* @(#)SegmentArrayProcessor.cpp 1.6 00/03/15
|
|
|
|
*
|
2003-06-03 20:58:22 +00:00
|
|
|
* (C) Copyright IBM Corp. 1998-2003 - All Rights Reserved
|
2000-11-28 20:56:52 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "LETypes.h"
|
|
|
|
#include "MorphTables.h"
|
|
|
|
#include "SubtableProcessor.h"
|
2000-12-21 02:52:24 +00:00
|
|
|
#include "NonContextualGlyphSubst.h"
|
|
|
|
#include "NonContextualGlyphSubstProc.h"
|
2000-11-28 20:56:52 +00:00
|
|
|
#include "SegmentArrayProcessor.h"
|
|
|
|
#include "LESwaps.h"
|
|
|
|
|
2001-10-16 00:39:01 +00:00
|
|
|
U_NAMESPACE_BEGIN
|
|
|
|
|
2002-06-29 00:04:16 +00:00
|
|
|
const char SegmentArrayProcessor::fgClassID=0;
|
|
|
|
|
2000-11-28 20:56:52 +00:00
|
|
|
SegmentArrayProcessor::SegmentArrayProcessor()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2001-01-19 00:30:17 +00:00
|
|
|
SegmentArrayProcessor::SegmentArrayProcessor(const MorphSubtableHeader *morphSubtableHeader)
|
2000-11-28 20:56:52 +00:00
|
|
|
: NonContextualGlyphSubstitutionProcessor(morphSubtableHeader)
|
|
|
|
{
|
2001-01-19 00:30:17 +00:00
|
|
|
const NonContextualGlyphSubstitutionHeader *header = (const NonContextualGlyphSubstitutionHeader *) morphSubtableHeader;
|
2000-11-28 20:56:52 +00:00
|
|
|
|
2001-01-19 00:30:17 +00:00
|
|
|
segmentArrayLookupTable = (const SegmentArrayLookupTable *) &header->table;
|
2000-11-28 20:56:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
SegmentArrayProcessor::~SegmentArrayProcessor()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2003-05-13 00:44:54 +00:00
|
|
|
void SegmentArrayProcessor::process(LEGlyphID *glyphs, le_int32 * /*charIndices*/, le_int32 glyphCount)
|
2000-11-28 20:56:52 +00:00
|
|
|
{
|
2001-01-19 00:30:17 +00:00
|
|
|
const LookupSegment *segments = segmentArrayLookupTable->segments;
|
2000-11-28 20:56:52 +00:00
|
|
|
le_int32 glyph;
|
|
|
|
|
2001-01-19 00:30:17 +00:00
|
|
|
for (glyph = 0; glyph < glyphCount; glyph += 1) {
|
|
|
|
const LookupSegment *lookupSegment = segmentArrayLookupTable->lookupSegment(segments, glyphs[glyph]);
|
2000-11-28 20:56:52 +00:00
|
|
|
|
2001-01-19 00:30:17 +00:00
|
|
|
if (lookupSegment != NULL) {
|
2003-02-05 00:05:40 +00:00
|
|
|
TTGlyphID firstGlyph = SWAPW(lookupSegment->firstGlyph);
|
|
|
|
le_int16 offset = SWAPW(lookupSegment->value);
|
2000-11-28 20:56:52 +00:00
|
|
|
|
2001-01-19 00:30:17 +00:00
|
|
|
if (offset != 0) {
|
2003-02-05 00:05:40 +00:00
|
|
|
TTGlyphID *glyphArray = (TTGlyphID *) ((char *) subtableHeader + offset);
|
|
|
|
TTGlyphID newGlyph = SWAPW(glyphArray[LE_GET_GLYPH(glyphs[glyph]) - firstGlyph]);
|
2000-11-28 20:56:52 +00:00
|
|
|
|
2003-02-05 00:05:40 +00:00
|
|
|
glyphs[glyph] = LE_SET_GLYPH(glyphs[glyph], newGlyph);
|
2000-11-28 20:56:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-10-16 00:39:01 +00:00
|
|
|
U_NAMESPACE_END
|