X-Git-Url: https://git.saurik.com/apple/icu.git/blobdiff_plain/fd0068a84e9996f225edba706498f6ed413d0673..46f4442e9a5a4f3b98b7c1083586332f6a8a99a4:/icuSources/layout/GlyphIterator.cpp diff --git a/icuSources/layout/GlyphIterator.cpp b/icuSources/layout/GlyphIterator.cpp index 91c5d568..d859c57c 100644 --- a/icuSources/layout/GlyphIterator.cpp +++ b/icuSources/layout/GlyphIterator.cpp @@ -1,6 +1,6 @@ /* * - * (C) Copyright IBM Corp. 1998-2005 - All Rights Reserved + * (C) Copyright IBM Corp. 1998-2008 - All Rights Reserved * */ @@ -19,7 +19,7 @@ GlyphIterator::GlyphIterator(LEGlyphStorage &theGlyphStorage, GlyphPositionAdjus FeatureMask theFeatureMask, const GlyphDefinitionTableHeader *theGlyphDefinitionTableHeader) : direction(1), position(-1), nextLimit(-1), prevLimit(-1), glyphStorage(theGlyphStorage), glyphPositionAdjustments(theGlyphPositionAdjustments), - srcIndex(-1), destIndex(-1), lookupFlags(theLookupFlags), featureMask(theFeatureMask), + srcIndex(-1), destIndex(-1), lookupFlags(theLookupFlags), featureMask(theFeatureMask), glyphGroup(0), glyphClassDefinitionTable(NULL), markAttachClassDefinitionTable(NULL) { @@ -53,6 +53,7 @@ GlyphIterator::GlyphIterator(GlyphIterator &that) destIndex = that.destIndex; lookupFlags = that.lookupFlags; featureMask = that.featureMask; + glyphGroup = that.glyphGroup; glyphClassDefinitionTable = that.glyphClassDefinitionTable; markAttachClassDefinitionTable = that.markAttachClassDefinitionTable; } @@ -70,6 +71,7 @@ GlyphIterator::GlyphIterator(GlyphIterator &that, FeatureMask newFeatureMask) destIndex = that.destIndex; lookupFlags = that.lookupFlags; featureMask = newFeatureMask; + glyphGroup = 0; glyphClassDefinitionTable = that.glyphClassDefinitionTable; markAttachClassDefinitionTable = that.markAttachClassDefinitionTable; } @@ -87,6 +89,7 @@ GlyphIterator::GlyphIterator(GlyphIterator &that, le_uint16 newLookupFlags) destIndex = that.destIndex; lookupFlags = newLookupFlags; featureMask = that.featureMask; + glyphGroup = that.glyphGroup; glyphClassDefinitionTable = that.glyphClassDefinitionTable; markAttachClassDefinitionTable = that.markAttachClassDefinitionTable; } @@ -100,6 +103,7 @@ void GlyphIterator::reset(le_uint16 newLookupFlags, FeatureMask newFeatureMask) { position = prevLimit; featureMask = newFeatureMask; + glyphGroup = 0; lookupFlags = newLookupFlags; } @@ -274,6 +278,36 @@ void GlyphIterator::setCurrGlyphPositionAdjustment(float xPlacementAdjust, float glyphPositionAdjustments->setYAdvance(position, yAdvanceAdjust); } +void GlyphIterator::clearCursiveEntryPoint() +{ + if (direction < 0) { + if (position <= nextLimit || position >= prevLimit) { + return; + } + } else { + if (position <= prevLimit || position >= nextLimit) { + return; + } + } + + glyphPositionAdjustments->clearEntryPoint(position); +} + +void GlyphIterator::clearCursiveExitPoint() +{ + if (direction < 0) { + if (position <= nextLimit || position >= prevLimit) { + return; + } + } else { + if (position <= prevLimit || position >= nextLimit) { + return; + } + } + + glyphPositionAdjustments->clearExitPoint(position); +} + void GlyphIterator::setCursiveEntryPoint(LEPoint &entryPoint) { if (direction < 0) { @@ -366,7 +400,7 @@ le_bool GlyphIterator::filterGlyph(le_uint32 index) const } } -le_bool GlyphIterator::hasFeatureTag() const +le_bool GlyphIterator::hasFeatureTag(le_bool matchGroup) const { if (featureMask == 0) { return TRUE; @@ -375,14 +409,18 @@ le_bool GlyphIterator::hasFeatureTag() const LEErrorCode success = LE_NO_ERROR; FeatureMask fm = glyphStorage.getAuxData(position, success); - return (fm & featureMask) != 0; + return ((fm & featureMask) == featureMask) && (!matchGroup || (le_int32)(fm & LE_GLYPH_GROUP_MASK) == glyphGroup); } le_bool GlyphIterator::findFeatureTag() { + //glyphGroup = 0; + while (nextInternal()) { - if (hasFeatureTag()) { - prevInternal(); + if (hasFeatureTag(FALSE)) { + LEErrorCode success = LE_NO_ERROR; + + glyphGroup = (glyphStorage.getAuxData(position, success) & LE_GLYPH_GROUP_MASK); return TRUE; } } @@ -410,7 +448,7 @@ le_bool GlyphIterator::nextInternal(le_uint32 delta) le_bool GlyphIterator::next(le_uint32 delta) { - return nextInternal(delta) && hasFeatureTag(); + return nextInternal(delta) && hasFeatureTag(TRUE); } le_bool GlyphIterator::prevInternal(le_uint32 delta) @@ -432,7 +470,7 @@ le_bool GlyphIterator::prevInternal(le_uint32 delta) le_bool GlyphIterator::prev(le_uint32 delta) { - return prevInternal(delta) && hasFeatureTag(); + return prevInternal(delta) && hasFeatureTag(TRUE); } le_int32 GlyphIterator::getMarkComponent(le_int32 markPosition) const