]> git.saurik.com Git - apple/icu.git/blob - icuSources/layout/SubstitutionLookups.cpp
ICU-6.2.4.tar.gz
[apple/icu.git] / icuSources / layout / SubstitutionLookups.cpp
1 /*
2 *
3 * (C) Copyright IBM Corp. 1998-2004 - All Rights Reserved
4 *
5 */
6
7 #include "LETypes.h"
8 #include "LEFontInstance.h"
9 #include "OpenTypeTables.h"
10 #include "GlyphSubstitutionTables.h"
11 #include "GlyphIterator.h"
12 #include "LookupProcessor.h"
13 #include "SubstitutionLookups.h"
14 #include "CoverageTables.h"
15 #include "LESwaps.h"
16
17 U_NAMESPACE_BEGIN
18
19 /*
20 NOTE: This could be optimized somewhat by keeping track
21 of the previous sequenceIndex in the loop and doing next()
22 or prev() of the delta between that and the current
23 sequenceIndex instead of always resetting to the front.
24 */
25 void SubstitutionLookup::applySubstitutionLookups(
26 LookupProcessor *lookupProcessor,
27 SubstitutionLookupRecord *substLookupRecordArray,
28 le_uint16 substCount,
29 GlyphIterator *glyphIterator,
30 const LEFontInstance *fontInstance,
31 le_int32 position)
32 {
33 GlyphIterator tempIterator(*glyphIterator);
34
35 for (le_uint16 subst = 0; subst < substCount; subst += 1) {
36 le_uint16 sequenceIndex = SWAPW(substLookupRecordArray[subst].sequenceIndex);
37 le_uint16 lookupListIndex = SWAPW(substLookupRecordArray[subst].lookupListIndex);
38
39 tempIterator.setCurrStreamPosition(position);
40 tempIterator.next(sequenceIndex);
41
42 lookupProcessor->applySingleLookup(lookupListIndex, &tempIterator, fontInstance);
43 }
44 }
45
46 U_NAMESPACE_END