3 * (C) Copyright IBM Corp. 1998-2013 - All Rights Reserved
8 #include "MorphTables.h"
9 #include "SubtableProcessor.h"
10 #include "NonContextualGlyphSubst.h"
11 #include "NonContextualGlyphSubstProc.h"
12 #include "SegmentSingleProcessor.h"
13 #include "LEGlyphStorage.h"
18 UOBJECT_DEFINE_RTTI_IMPLEMENTATION(SegmentSingleProcessor
)
20 SegmentSingleProcessor::SegmentSingleProcessor()
24 SegmentSingleProcessor::SegmentSingleProcessor(const LEReferenceTo
<MorphSubtableHeader
> &morphSubtableHeader
, LEErrorCode
&success
)
25 : NonContextualGlyphSubstitutionProcessor(morphSubtableHeader
, success
)
27 LEReferenceTo
<NonContextualGlyphSubstitutionHeader
> header(morphSubtableHeader
, success
);
28 segmentSingleLookupTable
= LEReferenceTo
<SegmentSingleLookupTable
>(morphSubtableHeader
, success
, (const SegmentSingleLookupTable
*)&header
->table
);
31 SegmentSingleProcessor::~SegmentSingleProcessor()
35 void SegmentSingleProcessor::process(LEGlyphStorage
&glyphStorage
, LEErrorCode
&success
)
37 const LookupSegment
*segments
= segmentSingleLookupTable
->segments
;
38 le_int32 glyphCount
= glyphStorage
.getGlyphCount();
41 for (glyph
= 0; glyph
< glyphCount
&& LE_SUCCESS(success
); glyph
+= 1) {
42 LEGlyphID thisGlyph
= glyphStorage
[glyph
];
43 const LookupSegment
*lookupSegment
= segmentSingleLookupTable
->lookupSegment(segmentSingleLookupTable
, segments
, thisGlyph
, success
);
45 if (lookupSegment
!= NULL
&& LE_SUCCESS(success
)) {
46 TTGlyphID newGlyph
= (TTGlyphID
) LE_GET_GLYPH(thisGlyph
) + SWAPW(lookupSegment
->value
);
48 glyphStorage
[glyph
] = LE_SET_GLYPH(thisGlyph
, newGlyph
);