1ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru/* 2ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 385bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * (C) Copyright IBM Corp. 1998-2008 - All Rights Reserved 4ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 5ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 6ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 7ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#include "LETypes.h" 8ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#include "LEFontInstance.h" 9ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#include "OpenTypeTables.h" 10ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#include "GlyphSubstitutionTables.h" 11ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#include "GlyphIterator.h" 12ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#include "LookupProcessor.h" 13ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#include "SubstitutionLookups.h" 14ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#include "CoverageTables.h" 15ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#include "LESwaps.h" 16ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 17ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste QueruU_NAMESPACE_BEGIN 18ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 19ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru/* 20ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru NOTE: This could be optimized somewhat by keeping track 21ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru of the previous sequenceIndex in the loop and doing next() 22ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru or prev() of the delta between that and the current 23ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru sequenceIndex instead of always resetting to the front. 24ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru*/ 25ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queruvoid SubstitutionLookup::applySubstitutionLookups( 26ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru LookupProcessor *lookupProcessor, 27ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru SubstitutionLookupRecord *substLookupRecordArray, 28ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru le_uint16 substCount, 29ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru GlyphIterator *glyphIterator, 30ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru const LEFontInstance *fontInstance, 3185bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho le_int32 position, 3285bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho LEErrorCode& success) 33ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru{ 3485bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho if (LE_FAILURE(success)) { 3585bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho return; 3685bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho } 3785bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho 38ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru GlyphIterator tempIterator(*glyphIterator); 39ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 4085bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho for (le_uint16 subst = 0; subst < substCount && LE_SUCCESS(success); subst += 1) { 41ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru le_uint16 sequenceIndex = SWAPW(substLookupRecordArray[subst].sequenceIndex); 42ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru le_uint16 lookupListIndex = SWAPW(substLookupRecordArray[subst].lookupListIndex); 43ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 44ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru tempIterator.setCurrStreamPosition(position); 45ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru tempIterator.next(sequenceIndex); 46ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 4785bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho lookupProcessor->applySingleLookup(lookupListIndex, &tempIterator, fontInstance, success); 48ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru } 49ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru} 50ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 51ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste QueruU_NAMESPACE_END 52