changeset 8870:2f920c764013

8219018: Adjust positions of glyphs Reviewed-by: mbalao
author bae
date Wed, 19 Jun 2019 19:07:08 +0300
parents a32dc7400435
children 95cd10d8f97c
files src/share/native/sun/font/layout/MarkToBasePosnSubtables.cpp src/share/native/sun/font/layout/MarkToLigaturePosnSubtables.cpp src/share/native/sun/font/layout/MarkToMarkPosnSubtables.cpp src/share/native/sun/font/layout/OpenTypeLayoutEngine.cpp
diffstat 4 files changed, 10 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/native/sun/font/layout/MarkToBasePosnSubtables.cpp	Mon Jul 15 07:52:23 2019 +0100
+++ b/src/share/native/sun/font/layout/MarkToBasePosnSubtables.cpp	Wed Jun 19 19:07:08 2019 +0300
@@ -80,6 +80,9 @@
     // FIXME: We probably don't want to find a base glyph before a previous ligature...
     GlyphIterator baseIterator(*glyphIterator, (le_uint16) (lfIgnoreMarks /*| lfIgnoreLigatures*/));
     LEGlyphID baseGlyph = findBaseGlyph(&baseIterator);
+    if (baseGlyph == 0xFFFF) {
+        return 0;
+    }
     le_int32 baseCoverage = getBaseCoverage(base, (LEGlyphID) baseGlyph, success);
     LEReferenceTo<BaseArray> baseArray(base, success, (const BaseArray *) ((char *) this + SWAPW(baseArrayOffset)));
     if(LE_FAILURE(success)) return 0;
--- a/src/share/native/sun/font/layout/MarkToLigaturePosnSubtables.cpp	Mon Jul 15 07:52:23 2019 +0100
+++ b/src/share/native/sun/font/layout/MarkToLigaturePosnSubtables.cpp	Wed Jun 19 19:07:08 2019 +0300
@@ -81,6 +81,9 @@
     // FIXME: we probably don't want to find a ligature before a previous base glyph...
     GlyphIterator ligatureIterator(*glyphIterator, (le_uint16) (lfIgnoreMarks /*| lfIgnoreBaseGlyphs*/));
     LEGlyphID ligatureGlyph = findLigatureGlyph(&ligatureIterator);
+    if (ligatureGlyph == 0xFFFF) {
+        return 0;
+    }
     le_int32 ligatureCoverage = getBaseCoverage(base, (LEGlyphID) ligatureGlyph, success);
     LEReferenceTo<LigatureArray> ligatureArray(base, success, SWAPW(baseArrayOffset));
     if (LE_FAILURE(success)) { return 0; }
--- a/src/share/native/sun/font/layout/MarkToMarkPosnSubtables.cpp	Mon Jul 15 07:52:23 2019 +0100
+++ b/src/share/native/sun/font/layout/MarkToMarkPosnSubtables.cpp	Wed Jun 19 19:07:08 2019 +0300
@@ -81,6 +81,9 @@
 
     GlyphIterator mark2Iterator(*glyphIterator);
     LEGlyphID mark2Glyph = findMark2Glyph(&mark2Iterator);
+    if (mark2Glyph == 0xFFFF) {
+        return 0;
+    }
     le_int32 mark2Coverage = getBaseCoverage(base, (LEGlyphID) mark2Glyph, success);
     LEReferenceTo<Mark2Array>  mark2Array(base, success, (const Mark2Array *) ((char *) this + SWAPW(baseArrayOffset)));
     if(LE_FAILURE(success)) return 0;
--- a/src/share/native/sun/font/layout/OpenTypeLayoutEngine.cpp	Mon Jul 15 07:52:23 2019 +0100
+++ b/src/share/native/sun/font/layout/OpenTypeLayoutEngine.cpp	Wed Jun 19 19:07:08 2019 +0300
@@ -543,7 +543,7 @@
             yAdjust += yKerning;
 #endif
 
-            for (le_int32 base = i; base >= 0; base = adjustments->getBaseOffset(base)) {
+            for (le_int32 base = i; base >= 0 && base < glyphCount; base = adjustments->getBaseOffset(base)) {
                 xPlacement += adjustments->getXPlacement(base);
                 yPlacement += adjustments->getYPlacement(base);
             }