--- old/src/java.desktop/share/classes/sun/font/TrueTypeGlyphMapper.java 2018-05-31 15:12:58.000000000 -0700 +++ new/src/java.desktop/share/classes/sun/font/TrueTypeGlyphMapper.java 2018-05-31 15:12:58.000000000 -0700 @@ -93,6 +93,34 @@ } } + private char getGlyphFromCMAP(int charCode, int variationSelector) { + if (variationSelector == 0) { + return getGlyphFromCMAP(charCode); + } + try { + char glyphCode = cmap.getGlyph(charCode, variationSelector); + if (glyphCode == 0) { // retry without variation selector + return getGlyphFromCMAP(charCode); + } + if (glyphCode < numGlyphs || + glyphCode >= FileFontStrike.INVISIBLE_GLYPHS) { + return glyphCode; + } else { + if (FontUtilities.isLogging()) { + FontUtilities.getLogger().warning + (font + " out of range glyph id=" + + Integer.toHexString((int)glyphCode) + + " for char " + Integer.toHexString(charCode) + + " for vs " + Integer.toHexString(variationSelector)); + } + return (char)missingGlyph; + } + } catch(Exception e) { + handleBadCMAP(); + return (char) missingGlyph; + } + } + private void handleBadCMAP() { if (FontUtilities.isLogging()) { FontUtilities.getLogger().severe("Null Cmap for " + font + @@ -138,14 +166,27 @@ public void charsToGlyphs(int count, int[] unicodes, int[] glyphs) { for (int i=0;i= 0x10000) { + i++; } } @@ -194,6 +259,8 @@ for (int i=0; i