From cf901026037f9d9fc39ea3fdb6383c5fe1622f81 Mon Sep 17 00:00:00 2001 From: Eric Mader Date: Thu, 20 Jun 2002 22:23:58 +0000 Subject: [PATCH] ICU-1068 allow for zero entry, exit anchor table offsets. Reset cursiveFirstPosition in resetCursiveLastExitPoint. X-SVN-Rev: 8911 --- .../layout/CursiveAttachmentSubtables.cpp | 32 +++++++++++++++---- icu4c/source/layout/GlyphIterator.cpp | 1 + 2 files changed, 26 insertions(+), 7 deletions(-) diff --git a/icu4c/source/layout/CursiveAttachmentSubtables.cpp b/icu4c/source/layout/CursiveAttachmentSubtables.cpp index a57e77db61e..3f4bf76673b 100644 --- a/icu4c/source/layout/CursiveAttachmentSubtables.cpp +++ b/icu4c/source/layout/CursiveAttachmentSubtables.cpp @@ -31,7 +31,7 @@ le_uint32 CursiveAttachmentSubtable::process(GlyphIterator *glyphIterator, const LEPoint entryAnchor, exitAnchor, pixels; - if (glyphIterator->hasCursiveLastExitPoint()) { + if (glyphIterator->hasCursiveLastExitPoint() && entryExitRecords[coverageIndex].entryAnchor != 0) { Offset entryOffset = SWAPW(entryExitRecords[coverageIndex].entryAnchor); const AnchorTable *entryAnchorTable = (const AnchorTable *) ((char *) this + entryOffset); @@ -65,16 +65,34 @@ le_uint32 CursiveAttachmentSubtable::process(GlyphIterator *glyphIterator, const Offset exitOffset = SWAPW(entryExitRecords[coverageIndex].exitAnchor); - const AnchorTable *exitAnchorTable = (const AnchorTable *) ((char *) this + exitOffset); + if (exitOffset != 0) { + const AnchorTable *exitAnchorTable = (const AnchorTable *) ((char *) this + exitOffset); - exitAnchorTable->getAnchor(glyphID, fontInstance, exitAnchor); + exitAnchorTable->getAnchor(glyphID, fontInstance, exitAnchor); - if (!glyphIterator->hasCursiveFirstExitPoint()) { - glyphIterator->setCursiveFirstExitPoint(); + if (!glyphIterator->hasCursiveFirstExitPoint()) { + glyphIterator->setCursiveFirstExitPoint(); + } + + glyphIterator->setCursiveLastExitPoint(exitAnchor); + } else { + /* + * We've got a glyph which is covered but doesn't have an + * exit point. We call setCursiveLastExitPoint just to set + * the position of this glyph, then resetCursiveLastExitPoint + * to do any baseline adjustments that are required for the + * sequence of attached glyphs. + * + * NOTE: we don't really care about the value of + * extiAnchor, because after we reset the last exit + * point, it won't be used. This is a bit of a hack. + * There should probably be a setCursiveLastExitPoint + * call that doesn't take an anchor... + */ + glyphIterator->setCursiveLastExitPoint(exitAnchor); + glyphIterator->resetCursiveLastExitPoint(); } - glyphIterator->setCursiveLastExitPoint(exitAnchor); - return 1; } diff --git a/icu4c/source/layout/GlyphIterator.cpp b/icu4c/source/layout/GlyphIterator.cpp index 552e9b17b86..6dd4e8ca7c6 100644 --- a/icu4c/source/layout/GlyphIterator.cpp +++ b/icu4c/source/layout/GlyphIterator.cpp @@ -316,6 +316,7 @@ void GlyphIterator::resetCursiveLastExitPoint() } cursiveLastPosition = -1; + cursiveFirstPosition = -1; cursiveBaselineAdjustment = 0; } #endif