37 #include "GlyphIterator.h" |
37 #include "GlyphIterator.h" |
38 #include "LESwaps.h" |
38 #include "LESwaps.h" |
39 |
39 |
40 U_NAMESPACE_BEGIN |
40 U_NAMESPACE_BEGIN |
41 |
41 |
42 le_uint32 SingleSubstitutionSubtable::process(GlyphIterator *glyphIterator, const LEGlyphFilter *filter) const |
42 le_uint32 SingleSubstitutionSubtable::process(const LEReferenceTo<SingleSubstitutionSubtable> &base, GlyphIterator *glyphIterator, LEErrorCode &success, const LEGlyphFilter *filter) const |
43 { |
43 { |
44 switch(SWAPW(subtableFormat)) |
44 switch(SWAPW(subtableFormat)) |
45 { |
45 { |
46 case 0: |
46 case 0: |
47 return 0; |
47 return 0; |
48 |
48 |
49 case 1: |
49 case 1: |
50 { |
50 { |
51 const SingleSubstitutionFormat1Subtable *subtable = (const SingleSubstitutionFormat1Subtable *) this; |
51 const LEReferenceTo<SingleSubstitutionFormat1Subtable> subtable(base, success, (const SingleSubstitutionFormat1Subtable *) this); |
52 |
52 |
53 return subtable->process(glyphIterator, filter); |
53 return subtable->process(subtable, glyphIterator, success, filter); |
54 } |
54 } |
55 |
55 |
56 case 2: |
56 case 2: |
57 { |
57 { |
58 const SingleSubstitutionFormat2Subtable *subtable = (const SingleSubstitutionFormat2Subtable *) this; |
58 const LEReferenceTo<SingleSubstitutionFormat2Subtable> subtable(base, success, (const SingleSubstitutionFormat2Subtable *) this); |
59 |
59 |
60 return subtable->process(glyphIterator, filter); |
60 return subtable->process(subtable, glyphIterator, success, filter); |
61 } |
61 } |
62 |
62 |
63 default: |
63 default: |
64 return 0; |
64 return 0; |
65 } |
65 } |
66 } |
66 } |
67 |
67 |
68 le_uint32 SingleSubstitutionFormat1Subtable::process(GlyphIterator *glyphIterator, const LEGlyphFilter *filter) const |
68 le_uint32 SingleSubstitutionFormat1Subtable::process(const LEReferenceTo<SingleSubstitutionFormat1Subtable> &base, GlyphIterator *glyphIterator, LEErrorCode &success, const LEGlyphFilter *filter) const |
69 { |
69 { |
70 LEGlyphID glyph = glyphIterator->getCurrGlyphID(); |
70 LEGlyphID glyph = glyphIterator->getCurrGlyphID(); |
71 le_int32 coverageIndex = getGlyphCoverage(glyph); |
71 le_int32 coverageIndex = getGlyphCoverage(base, glyph, success); |
72 |
72 |
73 if (coverageIndex >= 0) { |
73 if (coverageIndex >= 0) { |
74 TTGlyphID substitute = ((TTGlyphID) LE_GET_GLYPH(glyph)) + SWAPW(deltaGlyphID); |
74 TTGlyphID substitute = ((TTGlyphID) LE_GET_GLYPH(glyph)) + SWAPW(deltaGlyphID); |
75 |
75 |
76 if (filter == NULL || filter->accept(LE_SET_GLYPH(glyph, substitute))) { |
76 if (filter == NULL || filter->accept(LE_SET_GLYPH(glyph, substitute))) { |
81 } |
81 } |
82 |
82 |
83 return 0; |
83 return 0; |
84 } |
84 } |
85 |
85 |
86 le_uint32 SingleSubstitutionFormat2Subtable::process(GlyphIterator *glyphIterator, const LEGlyphFilter *filter) const |
86 le_uint32 SingleSubstitutionFormat2Subtable::process(const LEReferenceTo<SingleSubstitutionFormat2Subtable> &base, GlyphIterator *glyphIterator, LEErrorCode &success, const LEGlyphFilter *filter) const |
87 { |
87 { |
88 LEGlyphID glyph = glyphIterator->getCurrGlyphID(); |
88 LEGlyphID glyph = glyphIterator->getCurrGlyphID(); |
89 le_int32 coverageIndex = getGlyphCoverage(glyph); |
89 le_int32 coverageIndex = getGlyphCoverage(base, glyph, success); |
90 |
90 |
91 if (coverageIndex >= 0) { |
91 if (coverageIndex >= 0) { |
92 TTGlyphID substitute = SWAPW(substituteArray[coverageIndex]); |
92 TTGlyphID substitute = SWAPW(substituteArray[coverageIndex]); |
93 |
93 |
94 if (filter == NULL || filter->accept(LE_SET_GLYPH(glyph, substitute))) { |
94 if (filter == NULL || filter->accept(LE_SET_GLYPH(glyph, substitute))) { |