Example #1
0
void MarkToBaseLookup1::apply (OpenTypeText::iterator begin, OpenTypeText::iterator &mark,
							   OpenTypeText::iterator scopeEnd, OpenTypeText::iterator end) const
{
	// We should never use the first character as a mark because there
	// is nothing in front of it.
	if (mark != begin) {
		UShort markIndex;
		if (markCoverage->isCovered ((*mark)->getGlyphId(), &markIndex)) {
			OpenTypeText::iterator base = mark;
			do {
				base --;
			} while (base != begin &&
				(!markToMark && (*base)->getGlyphClass() == OpenTypeChar::gcMark));

			UShort baseIndex;
			if (baseCoverage->isCovered ((*base)->getGlyphId(), &baseIndex)) {
				// Found mark and base
				const MarkRecord &markRecord = markArray.at (markIndex);
				AnchorPtr baseAnchor = (baseArray.at (baseIndex)).at (markRecord.markClass);
				(*mark)->attach (*markRecord.markAnchor, base, *baseAnchor);
			}
		}
	}
	mark ++;
}