From 158e093a66d9e6f869b926f61b77744e621688a5 Mon Sep 17 00:00:00 2001 From: mbalao Date: Tue, 24 Sep 2019 19:07:02 -0300 Subject: [PATCH] 8227129: Better ligature for subtables Reviewed-by: bae --- .../sun/font/layout/AlternateSubstSubtables.cpp | 4 ++++ .../sun/font/layout/CursiveAttachmentSubtables.cpp | 4 ++++ .../sun/font/layout/LigatureSubstSubtables.cpp | 4 ++++ .../sun/font/layout/MarkToBasePosnSubtables.cpp | 4 ++++ .../sun/font/layout/MarkToLigaturePosnSubtables.cpp | 4 ++++ .../sun/font/layout/MarkToMarkPosnSubtables.cpp | 4 ++++ src/share/native/sun/font/layout/MorphTables.cpp | 6 ++++-- .../sun/font/layout/PairPositioningSubtables.cpp | 12 ++++++++++++ .../native/sun/font/layout/SegmentArrayProcessor.cpp | 2 ++ .../sun/font/layout/SegmentArrayProcessor2.cpp | 2 ++ .../sun/font/layout/SegmentSingleProcessor.cpp | 2 ++ .../sun/font/layout/SegmentSingleProcessor2.cpp | 2 ++ .../native/sun/font/layout/SimpleArrayProcessor.cpp | 2 ++ .../sun/font/layout/SinglePositioningSubtables.cpp | 12 ++++++++++++ .../sun/font/layout/SingleSubstitutionSubtables.cpp | 12 ++++++++++++ .../native/sun/font/layout/SingleTableProcessor.cpp | 2 ++ 16 files changed, 76 insertions(+), 2 deletions(-) diff --git a/src/share/native/sun/font/layout/AlternateSubstSubtables.cpp b/src/share/native/sun/font/layout/AlternateSubstSubtables.cpp index b27d4ee50..d27afeae1 100644 --- a/src/share/native/sun/font/layout/AlternateSubstSubtables.cpp +++ b/src/share/native/sun/font/layout/AlternateSubstSubtables.cpp @@ -42,6 +42,10 @@ U_NAMESPACE_BEGIN le_uint32 AlternateSubstitutionSubtable::process(const LEReferenceTo &base, GlyphIterator *glyphIterator, LEErrorCode &success, const LEGlyphFilter *filter) const { + if (LE_FAILURE(success)) { + return 0; + } + // NOTE: For now, we'll just pick the first alternative... LEGlyphID glyph = glyphIterator->getCurrGlyphID(); le_int32 coverageIndex = getGlyphCoverage(base, glyph, success); diff --git a/src/share/native/sun/font/layout/CursiveAttachmentSubtables.cpp b/src/share/native/sun/font/layout/CursiveAttachmentSubtables.cpp index 0f230f12e..44c2015a9 100644 --- a/src/share/native/sun/font/layout/CursiveAttachmentSubtables.cpp +++ b/src/share/native/sun/font/layout/CursiveAttachmentSubtables.cpp @@ -41,6 +41,10 @@ U_NAMESPACE_BEGIN le_uint32 CursiveAttachmentSubtable::process(const LEReferenceTo &base, GlyphIterator *glyphIterator, const LEFontInstance *fontInstance, LEErrorCode &success) const { + if (LE_FAILURE(success)) { + return 0; + } + LEGlyphID glyphID = glyphIterator->getCurrGlyphID(); le_int32 coverageIndex = getGlyphCoverage(base, glyphID, success); le_uint16 eeCount = SWAPW(entryExitCount); diff --git a/src/share/native/sun/font/layout/LigatureSubstSubtables.cpp b/src/share/native/sun/font/layout/LigatureSubstSubtables.cpp index 552094095..48cdbf49f 100644 --- a/src/share/native/sun/font/layout/LigatureSubstSubtables.cpp +++ b/src/share/native/sun/font/layout/LigatureSubstSubtables.cpp @@ -42,6 +42,10 @@ U_NAMESPACE_BEGIN le_uint32 LigatureSubstitutionSubtable::process(const LETableReference &base, GlyphIterator *glyphIterator, LEErrorCode &success, const LEGlyphFilter *filter) const { + if (LE_FAILURE(success)) { + return 0; + } + LEGlyphID glyph = glyphIterator->getCurrGlyphID(); le_int32 coverageIndex = getGlyphCoverage(base, glyph, success); diff --git a/src/share/native/sun/font/layout/MarkToBasePosnSubtables.cpp b/src/share/native/sun/font/layout/MarkToBasePosnSubtables.cpp index f8081a9c2..713de9a60 100644 --- a/src/share/native/sun/font/layout/MarkToBasePosnSubtables.cpp +++ b/src/share/native/sun/font/layout/MarkToBasePosnSubtables.cpp @@ -53,6 +53,10 @@ LEGlyphID MarkToBasePositioningSubtable::findBaseGlyph(GlyphIterator *glyphItera le_int32 MarkToBasePositioningSubtable::process(const LETableReference &base, GlyphIterator *glyphIterator, const LEFontInstance *fontInstance, LEErrorCode &success) const { + if (LE_FAILURE(success)) { + return 0; + } + LEGlyphID markGlyph = glyphIterator->getCurrGlyphID(); le_int32 markCoverage = getGlyphCoverage(base, (LEGlyphID) markGlyph, success); diff --git a/src/share/native/sun/font/layout/MarkToLigaturePosnSubtables.cpp b/src/share/native/sun/font/layout/MarkToLigaturePosnSubtables.cpp index e70f35c50..106d1a9a4 100644 --- a/src/share/native/sun/font/layout/MarkToLigaturePosnSubtables.cpp +++ b/src/share/native/sun/font/layout/MarkToLigaturePosnSubtables.cpp @@ -52,6 +52,10 @@ LEGlyphID MarkToLigaturePositioningSubtable::findLigatureGlyph(GlyphIterator *gl le_int32 MarkToLigaturePositioningSubtable::process(const LETableReference &base, GlyphIterator *glyphIterator, const LEFontInstance *fontInstance, LEErrorCode &success) const { + if (LE_FAILURE(success)) { + return 0; + } + LEGlyphID markGlyph = glyphIterator->getCurrGlyphID(); le_int32 markCoverage = getGlyphCoverage(base, (LEGlyphID) markGlyph, success); diff --git a/src/share/native/sun/font/layout/MarkToMarkPosnSubtables.cpp b/src/share/native/sun/font/layout/MarkToMarkPosnSubtables.cpp index 0e16a2fce..4648eb7ef 100644 --- a/src/share/native/sun/font/layout/MarkToMarkPosnSubtables.cpp +++ b/src/share/native/sun/font/layout/MarkToMarkPosnSubtables.cpp @@ -53,6 +53,10 @@ LEGlyphID MarkToMarkPositioningSubtable::findMark2Glyph(GlyphIterator *glyphIter le_int32 MarkToMarkPositioningSubtable::process(const LETableReference &base, GlyphIterator *glyphIterator, const LEFontInstance *fontInstance, LEErrorCode &success) const { + if (LE_FAILURE(success)) { + return 0; + } + LEGlyphID markGlyph = glyphIterator->getCurrGlyphID(); le_int32 markCoverage = getGlyphCoverage(base, (LEGlyphID) markGlyph, success); diff --git a/src/share/native/sun/font/layout/MorphTables.cpp b/src/share/native/sun/font/layout/MorphTables.cpp index 152b94774..cfbb82592 100644 --- a/src/share/native/sun/font/layout/MorphTables.cpp +++ b/src/share/native/sun/font/layout/MorphTables.cpp @@ -46,8 +46,10 @@ U_NAMESPACE_BEGIN void MorphTableHeader::process(const LETableReference &base, LEGlyphStorage &glyphStorage, LEErrorCode &success) const { - le_uint32 chainCount = SWAPL(this->nChains); - LEReferenceTo chainHeader(base, success, chains); // moving header + if (LE_FAILURE(success)) return; + + le_uint32 chainCount = SWAPL(this->nChains); + LEReferenceTo chainHeader(base, success, chains); // moving header LEReferenceToArrayOf chainHeaderArray(base, success, chains, chainCount); le_uint32 chain; diff --git a/src/share/native/sun/font/layout/PairPositioningSubtables.cpp b/src/share/native/sun/font/layout/PairPositioningSubtables.cpp index 41922b7fa..5cb30d37a 100644 --- a/src/share/native/sun/font/layout/PairPositioningSubtables.cpp +++ b/src/share/native/sun/font/layout/PairPositioningSubtables.cpp @@ -43,6 +43,10 @@ U_NAMESPACE_BEGIN le_uint32 PairPositioningSubtable::process(const LEReferenceTo &base, GlyphIterator *glyphIterator, const LEFontInstance *fontInstance, LEErrorCode &success) const { + if (LE_FAILURE(success)) { + return 0; + } + switch(SWAPW(subtableFormat)) { case 0: @@ -74,6 +78,10 @@ le_uint32 PairPositioningSubtable::process(const LEReferenceTo &base, GlyphIterator *glyphIterator, const LEFontInstance *fontInstance, LEErrorCode &success) const { + if (LE_FAILURE(success)) { + return 0; + } + LEGlyphID firstGlyph = glyphIterator->getCurrGlyphID(); le_int32 coverageIndex = getGlyphCoverage(base, firstGlyph, success); GlyphIterator tempIterator(*glyphIterator); @@ -123,6 +131,10 @@ le_uint32 PairPositioningFormat1Subtable::process(const LEReferenceTo &base, GlyphIterator *glyphIterator, const LEFontInstance *fontInstance, LEErrorCode &success) const { + if (LE_FAILURE(success)) { + return 0; + } + LEGlyphID firstGlyph = glyphIterator->getCurrGlyphID(); le_int32 coverageIndex = getGlyphCoverage(base, firstGlyph, success); diff --git a/src/share/native/sun/font/layout/SegmentArrayProcessor.cpp b/src/share/native/sun/font/layout/SegmentArrayProcessor.cpp index a8b8d0c64..18523574c 100644 --- a/src/share/native/sun/font/layout/SegmentArrayProcessor.cpp +++ b/src/share/native/sun/font/layout/SegmentArrayProcessor.cpp @@ -59,6 +59,8 @@ SegmentArrayProcessor::~SegmentArrayProcessor() void SegmentArrayProcessor::process(LEGlyphStorage &glyphStorage, LEErrorCode &success) { + if (LE_FAILURE(success)) return; + const LookupSegment *segments = segmentArrayLookupTable->segments; le_int32 glyphCount = glyphStorage.getGlyphCount(); le_int32 glyph; diff --git a/src/share/native/sun/font/layout/SegmentArrayProcessor2.cpp b/src/share/native/sun/font/layout/SegmentArrayProcessor2.cpp index 89222a0cd..ca73c053e 100644 --- a/src/share/native/sun/font/layout/SegmentArrayProcessor2.cpp +++ b/src/share/native/sun/font/layout/SegmentArrayProcessor2.cpp @@ -59,6 +59,8 @@ SegmentArrayProcessor2::~SegmentArrayProcessor2() void SegmentArrayProcessor2::process(LEGlyphStorage &glyphStorage, LEErrorCode &success) { + if (LE_FAILURE(success)) return; + const LookupSegment *segments = segmentArrayLookupTable->segments; le_int32 glyphCount = glyphStorage.getGlyphCount(); le_int32 glyph; diff --git a/src/share/native/sun/font/layout/SegmentSingleProcessor.cpp b/src/share/native/sun/font/layout/SegmentSingleProcessor.cpp index 42866a547..bbbe14560 100644 --- a/src/share/native/sun/font/layout/SegmentSingleProcessor.cpp +++ b/src/share/native/sun/font/layout/SegmentSingleProcessor.cpp @@ -59,6 +59,8 @@ SegmentSingleProcessor::~SegmentSingleProcessor() void SegmentSingleProcessor::process(LEGlyphStorage &glyphStorage, LEErrorCode &success) { + if (LE_FAILURE(success)) return; + const LookupSegment *segments = segmentSingleLookupTable->segments; le_int32 glyphCount = glyphStorage.getGlyphCount(); le_int32 glyph; diff --git a/src/share/native/sun/font/layout/SegmentSingleProcessor2.cpp b/src/share/native/sun/font/layout/SegmentSingleProcessor2.cpp index 557278351..d6b182289 100644 --- a/src/share/native/sun/font/layout/SegmentSingleProcessor2.cpp +++ b/src/share/native/sun/font/layout/SegmentSingleProcessor2.cpp @@ -60,6 +60,8 @@ SegmentSingleProcessor2::~SegmentSingleProcessor2() void SegmentSingleProcessor2::process(LEGlyphStorage &glyphStorage, LEErrorCode &success) { + if (LE_FAILURE(success)) return; + const LookupSegment *segments = segmentSingleLookupTable->segments; le_int32 glyphCount = glyphStorage.getGlyphCount(); le_int32 glyph; diff --git a/src/share/native/sun/font/layout/SimpleArrayProcessor.cpp b/src/share/native/sun/font/layout/SimpleArrayProcessor.cpp index 1aa71b002..749daa082 100644 --- a/src/share/native/sun/font/layout/SimpleArrayProcessor.cpp +++ b/src/share/native/sun/font/layout/SimpleArrayProcessor.cpp @@ -59,6 +59,8 @@ SimpleArrayProcessor::~SimpleArrayProcessor() void SimpleArrayProcessor::process(LEGlyphStorage &glyphStorage, LEErrorCode &success) { + if (LE_FAILURE(success)) return; + le_int32 glyphCount = glyphStorage.getGlyphCount(); le_int32 glyph; diff --git a/src/share/native/sun/font/layout/SinglePositioningSubtables.cpp b/src/share/native/sun/font/layout/SinglePositioningSubtables.cpp index fd912b448..4d32e3a4c 100644 --- a/src/share/native/sun/font/layout/SinglePositioningSubtables.cpp +++ b/src/share/native/sun/font/layout/SinglePositioningSubtables.cpp @@ -42,6 +42,10 @@ U_NAMESPACE_BEGIN le_uint32 SinglePositioningSubtable::process(const LEReferenceTo &base, GlyphIterator *glyphIterator, const LEFontInstance *fontInstance, LEErrorCode &success) const { + if (LE_FAILURE(success)) { + return 0; + } + switch(SWAPW(subtableFormat)) { case 0: @@ -68,6 +72,10 @@ le_uint32 SinglePositioningSubtable::process(const LEReferenceTo &base, GlyphIterator *glyphIterator, const LEFontInstance *fontInstance, LEErrorCode &success) const { + if (LE_FAILURE(success)) { + return 0; + } + LEGlyphID glyph = glyphIterator->getCurrGlyphID(); le_int32 coverageIndex = getGlyphCoverage(base, glyph, success); if (LE_FAILURE(success)) { @@ -85,6 +93,10 @@ le_uint32 SinglePositioningFormat1Subtable::process(const LEReferenceTo &base, GlyphIterator *glyphIterator, const LEFontInstance *fontInstance, LEErrorCode &success) const { + if (LE_FAILURE(success)) { + return 0; + } + LEGlyphID glyph = glyphIterator->getCurrGlyphID(); le_int16 coverageIndex = (le_int16) getGlyphCoverage(base, glyph, success); if (LE_FAILURE(success)) { diff --git a/src/share/native/sun/font/layout/SingleSubstitutionSubtables.cpp b/src/share/native/sun/font/layout/SingleSubstitutionSubtables.cpp index ccbc0523d..81f7a28a1 100644 --- a/src/share/native/sun/font/layout/SingleSubstitutionSubtables.cpp +++ b/src/share/native/sun/font/layout/SingleSubstitutionSubtables.cpp @@ -41,6 +41,10 @@ U_NAMESPACE_BEGIN le_uint32 SingleSubstitutionSubtable::process(const LEReferenceTo &base, GlyphIterator *glyphIterator, LEErrorCode &success, const LEGlyphFilter *filter) const { + if (LE_FAILURE(success)) { + return 0; + } + switch(SWAPW(subtableFormat)) { case 0: @@ -67,6 +71,10 @@ le_uint32 SingleSubstitutionSubtable::process(const LEReferenceTo &base, GlyphIterator *glyphIterator, LEErrorCode &success, const LEGlyphFilter *filter) const { + if (LE_FAILURE(success)) { + return 0; + } + LEGlyphID glyph = glyphIterator->getCurrGlyphID(); le_int32 coverageIndex = getGlyphCoverage(base, glyph, success); if (LE_FAILURE(success)) { @@ -88,6 +96,10 @@ le_uint32 SingleSubstitutionFormat1Subtable::process(const LEReferenceTo &base, GlyphIterator *glyphIterator, LEErrorCode &success, const LEGlyphFilter *filter) const { + if (LE_FAILURE(success)) { + return 0; + } + LEGlyphID glyph = glyphIterator->getCurrGlyphID(); le_int32 coverageIndex = getGlyphCoverage(base, glyph, success); if (LE_FAILURE(success)) { diff --git a/src/share/native/sun/font/layout/SingleTableProcessor.cpp b/src/share/native/sun/font/layout/SingleTableProcessor.cpp index e7c7c868b..b613c5a66 100644 --- a/src/share/native/sun/font/layout/SingleTableProcessor.cpp +++ b/src/share/native/sun/font/layout/SingleTableProcessor.cpp @@ -59,6 +59,8 @@ SingleTableProcessor::~SingleTableProcessor() void SingleTableProcessor::process(LEGlyphStorage &glyphStorage, LEErrorCode &success) { + if (LE_FAILURE(success)) return; + const LookupSingle *entries = singleTableLookupTable->entries; le_int32 glyph; le_int32 glyphCount = glyphStorage.getGlyphCount(); -- GitLab