44 |
44 |
45 SegmentSingleProcessor2::SegmentSingleProcessor2() |
45 SegmentSingleProcessor2::SegmentSingleProcessor2() |
46 { |
46 { |
47 } |
47 } |
48 |
48 |
49 SegmentSingleProcessor2::SegmentSingleProcessor2(const MorphSubtableHeader2 *morphSubtableHeader) |
49 SegmentSingleProcessor2::SegmentSingleProcessor2(const LEReferenceTo<MorphSubtableHeader2> &morphSubtableHeader, LEErrorCode &success) |
50 : NonContextualGlyphSubstitutionProcessor2(morphSubtableHeader) |
50 : NonContextualGlyphSubstitutionProcessor2(morphSubtableHeader, success) |
51 { |
51 { |
52 const NonContextualGlyphSubstitutionHeader2 *header = (const NonContextualGlyphSubstitutionHeader2 *) morphSubtableHeader; |
52 const LEReferenceTo<NonContextualGlyphSubstitutionHeader2> header(morphSubtableHeader, success); |
53 |
53 |
54 segmentSingleLookupTable = (const SegmentSingleLookupTable *) &header->table; |
54 segmentSingleLookupTable = LEReferenceTo<SegmentSingleLookupTable>(morphSubtableHeader, success, &header->table); |
55 } |
55 } |
56 |
56 |
57 SegmentSingleProcessor2::~SegmentSingleProcessor2() |
57 SegmentSingleProcessor2::~SegmentSingleProcessor2() |
58 { |
58 { |
59 } |
59 } |
60 |
60 |
61 void SegmentSingleProcessor2::process(LEGlyphStorage &glyphStorage) |
61 void SegmentSingleProcessor2::process(LEGlyphStorage &glyphStorage, LEErrorCode &success) |
62 { |
62 { |
63 const LookupSegment *segments = segmentSingleLookupTable->segments; |
63 const LookupSegment *segments = segmentSingleLookupTable->segments; |
64 le_int32 glyphCount = glyphStorage.getGlyphCount(); |
64 le_int32 glyphCount = glyphStorage.getGlyphCount(); |
65 le_int32 glyph; |
65 le_int32 glyph; |
66 |
66 |
67 for (glyph = 0; glyph < glyphCount; glyph += 1) { |
67 for (glyph = 0; glyph < glyphCount; glyph += 1) { |
68 LEGlyphID thisGlyph = glyphStorage[glyph]; |
68 LEGlyphID thisGlyph = glyphStorage[glyph]; |
69 const LookupSegment *lookupSegment = segmentSingleLookupTable->lookupSegment(segments, thisGlyph); |
69 const LookupSegment *lookupSegment = segmentSingleLookupTable->lookupSegment(segmentSingleLookupTable, segments, thisGlyph, success); |
70 |
70 |
71 if (lookupSegment != NULL) { |
71 if (lookupSegment != NULL && LE_SUCCESS(success)) { |
72 TTGlyphID newGlyph = (TTGlyphID) LE_GET_GLYPH(thisGlyph) + SWAPW(lookupSegment->value); |
72 TTGlyphID newGlyph = (TTGlyphID) LE_GET_GLYPH(thisGlyph) + SWAPW(lookupSegment->value); |
73 |
73 |
74 glyphStorage[glyph] = LE_SET_GLYPH(thisGlyph, newGlyph); |
74 glyphStorage[glyph] = LE_SET_GLYPH(thisGlyph, newGlyph); |
75 } |
75 } |
76 } |
76 } |