2000-11-28 20:56:52 +00:00
|
|
|
/*
|
|
|
|
*
|
2013-04-18 21:24:51 +00:00
|
|
|
* (C) Copyright IBM Corp. 1998-2013 - 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 "SegmentSingleProcessor.h"
|
2004-04-12 18:51:31 +00:00
|
|
|
#include "LEGlyphStorage.h"
|
2000-11-28 20:56:52 +00:00
|
|
|
#include "LESwaps.h"
|
|
|
|
|
2001-10-16 00:39:01 +00:00
|
|
|
U_NAMESPACE_BEGIN
|
|
|
|
|
2004-10-19 06:25:41 +00:00
|
|
|
UOBJECT_DEFINE_RTTI_IMPLEMENTATION(SegmentSingleProcessor)
|
2002-06-29 00:04:16 +00:00
|
|
|
|
2000-11-28 20:56:52 +00:00
|
|
|
SegmentSingleProcessor::SegmentSingleProcessor()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2013-04-18 21:24:51 +00:00
|
|
|
SegmentSingleProcessor::SegmentSingleProcessor(const LEReferenceTo<MorphSubtableHeader> &morphSubtableHeader, LEErrorCode &success)
|
|
|
|
: NonContextualGlyphSubstitutionProcessor(morphSubtableHeader, success)
|
2000-11-28 20:56:52 +00:00
|
|
|
{
|
2013-04-18 21:24:51 +00:00
|
|
|
LEReferenceTo<NonContextualGlyphSubstitutionHeader> header(morphSubtableHeader, success);
|
|
|
|
segmentSingleLookupTable = LEReferenceTo<SegmentSingleLookupTable>(morphSubtableHeader, success, (const SegmentSingleLookupTable*)&header->table);
|
2000-11-28 20:56:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
SegmentSingleProcessor::~SegmentSingleProcessor()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2013-04-18 21:24:51 +00:00
|
|
|
void SegmentSingleProcessor::process(LEGlyphStorage &glyphStorage, LEErrorCode &success)
|
2000-11-28 20:56:52 +00:00
|
|
|
{
|
2001-01-19 00:30:17 +00:00
|
|
|
const LookupSegment *segments = segmentSingleLookupTable->segments;
|
2004-05-07 23:29:16 +00:00
|
|
|
le_int32 glyphCount = glyphStorage.getGlyphCount();
|
2000-11-28 20:56:52 +00:00
|
|
|
le_int32 glyph;
|
|
|
|
|
2013-04-18 21:24:51 +00:00
|
|
|
for (glyph = 0; glyph < glyphCount && LE_SUCCESS(success); glyph += 1) {
|
2004-05-07 23:29:16 +00:00
|
|
|
LEGlyphID thisGlyph = glyphStorage[glyph];
|
2013-04-18 21:24:51 +00:00
|
|
|
const LookupSegment *lookupSegment = segmentSingleLookupTable->lookupSegment(segmentSingleLookupTable, segments, thisGlyph, success);
|
2000-11-28 20:56:52 +00:00
|
|
|
|
2013-04-18 21:24:51 +00:00
|
|
|
if (lookupSegment != NULL && LE_SUCCESS(success)) {
|
2004-04-12 18:51:31 +00:00
|
|
|
TTGlyphID newGlyph = (TTGlyphID) LE_GET_GLYPH(thisGlyph) + SWAPW(lookupSegment->value);
|
2003-02-05 00:05:40 +00:00
|
|
|
|
2004-05-07 23:29:16 +00:00
|
|
|
glyphStorage[glyph] = LE_SET_GLYPH(thisGlyph, newGlyph);
|
2000-11-28 20:56:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2001-10-16 00:39:01 +00:00
|
|
|
|
|
|
|
U_NAMESPACE_END
|