]> git.saurik.com Git - apple/icu.git/blame - icuSources/layout/SubstitutionLookups.cpp
ICU-511.34.tar.gz
[apple/icu.git] / icuSources / layout / SubstitutionLookups.cpp
CommitLineData
b75a7d8f 1/*
b75a7d8f 2 *
729e4ab9 3 * (C) Copyright IBM Corp. 1998-2008 - All Rights Reserved
b75a7d8f
A
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
17U_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*/
25void SubstitutionLookup::applySubstitutionLookups(
26 LookupProcessor *lookupProcessor,
27 SubstitutionLookupRecord *substLookupRecordArray,
28 le_uint16 substCount,
29 GlyphIterator *glyphIterator,
30 const LEFontInstance *fontInstance,
729e4ab9
A
31 le_int32 position,
32 LEErrorCode& success)
b75a7d8f 33{
729e4ab9
A
34 if (LE_FAILURE(success)) {
35 return;
36 }
37
b75a7d8f
A
38 GlyphIterator tempIterator(*glyphIterator);
39
729e4ab9 40 for (le_uint16 subst = 0; subst < substCount && LE_SUCCESS(success); subst += 1) {
b75a7d8f
A
41 le_uint16 sequenceIndex = SWAPW(substLookupRecordArray[subst].sequenceIndex);
42 le_uint16 lookupListIndex = SWAPW(substLookupRecordArray[subst].lookupListIndex);
43
44 tempIterator.setCurrStreamPosition(position);
45 tempIterator.next(sequenceIndex);
46
729e4ab9 47 lookupProcessor->applySingleLookup(lookupListIndex, &tempIterator, fontInstance, success);
b75a7d8f
A
48 }
49}
50
51U_NAMESPACE_END