os/textandloc/fontservices/textshaperplugin/IcuSource/layout/SubstitutionLookups.cpp
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/textandloc/fontservices/textshaperplugin/IcuSource/layout/SubstitutionLookups.cpp	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,52 @@
     1.4 +/*
     1.5 + *
     1.6 + * (C) Copyright IBM Corp. 1998-2004 - All Rights Reserved
     1.7 + *
     1.8 + */
     1.9 +
    1.10 +#include "LETypes.h"
    1.11 +#include "LEFontInstance.h"
    1.12 +#include "OpenTypeTables.h"
    1.13 +#include "GlyphSubstitutionTables.h"
    1.14 +#include "GlyphIterator.h"
    1.15 +#include "LookupProcessor.h"
    1.16 +#include "SubstitutionLookups.h"
    1.17 +#include "CoverageTables.h"
    1.18 +#include "LESwaps.h"
    1.19 +
    1.20 +U_NAMESPACE_BEGIN
    1.21 +
    1.22 +/*
    1.23 +    NOTE: This could be optimized somewhat by keeping track
    1.24 +    of the previous sequenceIndex in the loop and doing next()
    1.25 +    or prev() of the delta between that and the current
    1.26 +    sequenceIndex instead of always resetting to the front.
    1.27 +*/
    1.28 +void SubstitutionLookup::applySubstitutionLookups(
    1.29 +        LookupProcessor *lookupProcessor,
    1.30 +        SubstitutionLookupRecord *substLookupRecordArray,
    1.31 +        le_uint16 substCount,
    1.32 +        GlyphIterator *glyphIterator,
    1.33 +        const LEFontInstance *fontInstance,
    1.34 +        le_int32 position,
    1.35 +        LEErrorCode& success)
    1.36 +{
    1.37 +    if (LE_FAILURE(success)) {
    1.38 +        return;
    1.39 +    }
    1.40 +
    1.41 +    GlyphIterator tempIterator(*glyphIterator);
    1.42 +
    1.43 +    for (le_uint16 subst = 0; subst < substCount && LE_SUCCESS(success); subst += 1) {
    1.44 +        le_uint16 sequenceIndex = SWAPW(substLookupRecordArray[subst].sequenceIndex);
    1.45 +        le_uint16 lookupListIndex = SWAPW(substLookupRecordArray[subst].lookupListIndex);
    1.46 +
    1.47 +        tempIterator.setCurrStreamPosition(position);
    1.48 +        tempIterator.next(sequenceIndex);
    1.49 +
    1.50 +        lookupProcessor->applySingleLookup(lookupListIndex, &tempIterator,
    1.51 +            fontInstance, success);
    1.52 +    }
    1.53 +}
    1.54 +
    1.55 +U_NAMESPACE_END