changeset 11178:32c0fa36d169

8215799: Complex text is not rendered by webkit on Windows Reviewed-by: mbilla, kcr, prr
author arajkumar
date Fri, 18 Jan 2019 23:14:54 +0530
parents 6c5cd73318dd
children 2878dcdb7af4
files modules/javafx.graphics/src/main/java/com/sun/javafx/font/CompositeGlyphMapper.java modules/javafx.web/src/main/java/com/sun/javafx/webkit/prism/WCFontImpl.java modules/javafx.web/src/main/native/Source/WebCore/platform/graphics/java/ComplexTextControllerJava.cpp
diffstat 3 files changed, 20 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/modules/javafx.graphics/src/main/java/com/sun/javafx/font/CompositeGlyphMapper.java	Fri Jan 18 12:46:27 2019 +0100
+++ b/modules/javafx.graphics/src/main/java/com/sun/javafx/font/CompositeGlyphMapper.java	Fri Jan 18 23:14:54 2019 +0530
@@ -100,7 +100,6 @@
                 return glyphCode;
             }
         }
-        glyphMap.put(unicode, missingGlyph);
         return missingGlyph;
     }
 
--- a/modules/javafx.web/src/main/java/com/sun/javafx/webkit/prism/WCFontImpl.java	Fri Jan 18 12:46:27 2019 +0100
+++ b/modules/javafx.web/src/main/java/com/sun/javafx/webkit/prism/WCFontImpl.java	Fri Jan 18 23:14:54 2019 +0530
@@ -125,10 +125,24 @@
         return getFontStrike().getMetrics().getXHeight();
     }
 
+    private static boolean needsTextLayout(final int glyphs[]) {
+        for (int g : glyphs) {
+            if (g == 0) {
+                return true;
+            }
+        }
+        return false;
+    }
+
     @Override public int[] getGlyphCodes(char[] chars) {
         int[] glyphs = new int[chars.length];
         CharToGlyphMapper mapper = getFontStrike().getFontResource().getGlyphMapper();
         mapper.charsToGlyphs(chars.length, chars, glyphs);
+        if (needsTextLayout(glyphs)) {
+            // Call charsToGlyphs once again after doing layout if any of the glyph index is zero
+            TextUtilities.createLayout(new String(chars), getPlatformFont()).getRuns();
+            mapper.charsToGlyphs(chars.length, chars, glyphs);
+        }
         return glyphs;
     }
 
--- a/modules/javafx.web/src/main/native/Source/WebCore/platform/graphics/java/ComplexTextControllerJava.cpp	Fri Jan 18 12:46:27 2019 +0100
+++ b/modules/javafx.web/src/main/native/Source/WebCore/platform/graphics/java/ComplexTextControllerJava.cpp	Fri Jan 18 23:14:54 2019 +0530
@@ -92,6 +92,12 @@
 
 unsigned jGetCharOffset(jobject jRun, unsigned glyphIndex)
 {
+    if (!jGetGlyphCount(jRun)) {
+        // Return same value as TextRun.getCharOffset() when there is
+        // no glyph information available.
+        return glyphIndex;
+    }
+
     JNIEnv* env = WebCore_GetJavaEnv();
     static jmethodID mID = env->GetMethodID(
         PG_GetTextRun(env),