--- old/src/java.desktop/share/native/libfontmanager/hb-jdk-font.cc 2018-06-22 12:56:19.000000000 -0700 +++ new/src/java.desktop/share/native/libfontmanager/hb-jdk-font.cc 2018-06-22 12:56:19.000000000 -0700 @@ -48,10 +48,18 @@ JDKFontInfo *jdkFontInfo = (JDKFontInfo*)font_data; JNIEnv* env = jdkFontInfo->env; jobject font2D = jdkFontInfo->font2D; - hb_codepoint_t u = (variation_selector==0) ? unicode : variation_selector; - - *glyph = (hb_codepoint_t) - env->CallIntMethod(font2D, sunFontIDs.f2dCharToGlyphMID, u); + if (variation_selector == 0) { + *glyph = (hb_codepoint_t)env->CallIntMethod( + font2D, sunFontIDs.f2dCharToGlyphMID, unicode); + } else { + *glyph = (hb_codepoint_t)env->CallIntMethod( + font2D, sunFontIDs.f2dCharToVariationGlyphMID, + unicode, variation_selector); + } + if (env->ExceptionOccurred()) + { + env->ExceptionClear(); + } if ((int)*glyph < 0) { *glyph = 0; }