< prev index next >

src/java.desktop/share/native/libfontmanager/hb-jdk-font.cc

Print this page

        

*** 46,59 **** { 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 ((int)*glyph < 0) { *glyph = 0; } return (*glyph != 0); } --- 46,83 ---- { JDKFontInfo *jdkFontInfo = (JDKFontInfo*)font_data; JNIEnv* env = jdkFontInfo->env; jobject font2D = jdkFontInfo->font2D; ! if (variation_selector==0){ *glyph = (hb_codepoint_t) ! env->CallIntMethod(font2D, sunFontIDs.f2dCharToGlyphMID, unicode); ! }else{ ! jintArray unicodes = NULL; ! jintArray results = NULL; ! jint* tmp = NULL; ! ! *glyph = 0; ! unicodes = env->NewIntArray(2); ! if (unicodes == NULL) goto cleanup; ! results = env->NewIntArray(2); ! if (results == NULL) goto cleanup; ! ! tmp = new jint[2]; ! if (tmp == NULL) goto cleanup; ! tmp[0] = unicode; ! tmp[1] = variation_selector; ! ! env->SetIntArrayRegion(unicodes, 0, 2, tmp); ! env->CallVoidMethod(font2D, sunFontIDs.f2dCharsToGlyphsMID, 2, unicodes, results); ! env->GetIntArrayRegion(results, 0, 2, tmp); ! *glyph = tmp[0]; ! cleanup: ! if (unicodes != NULL) env->DeleteLocalRef(unicodes); ! if (results != NULL) env->DeleteLocalRef(results); ! if (tmp != NULL) delete [] tmp; ! } if ((int)*glyph < 0) { *glyph = 0; } return (*glyph != 0); }
< prev index next >