src/solaris/native/sun/awt/fontpath.c

Print this page
rev 1379 : [mq]: fontmanager.patch

@@ -148,19 +148,30 @@
 jboolean isDisplayLocal(JNIEnv *env) {
     static jboolean isLocal = False;
     static jboolean isLocalSet = False;
     jboolean ret;
 
-    if (isLocalSet) {
-        return isLocal;
+    if (! isLocalSet) {
+      jclass geCls = (*env)->FindClass(env, "java/awt/GraphicsEnvironment");
+      jmethodID getLocalGE = (*env)->GetStaticMethodID(env, geCls,
+                                                 "getLocalGraphicsEnvironment",
+                                           "()Ljava/awt/GraphicsEnvironment;");
+      jobject ge = (*env)->CallStaticObjectMethod(env, geCls, getLocalGE);
+
+      jclass sgeCls = (*env)->FindClass(env,
+                                        "sun/java2d/SunGraphicsEnvironment");
+      if ((*env)->IsInstanceOf(env, ge, sgeCls)) {
+        jmethodID isDisplayLocal = (*env)->GetMethodID(env, sgeCls,
+                                                       "isDisplayLocal",
+                                                       "()Z");
+        isLocal = (*env)->CallBooleanMethod(env, ge, isDisplayLocal);
+      } else {
+        isLocal = True;
     }
-
-    isLocal = JNU_CallStaticMethodByName(env, NULL,
-                                         "sun/awt/X11GraphicsEnvironment",
-                                         "_isDisplayLocal",
-                                         "()Z").z;
     isLocalSet = True;
+    }
+
     return isLocal;
 }
 
 static void AddFontsToX11FontPath ( fDirRecord *fDirP )
 {

@@ -514,12 +525,12 @@
     }
 
     return path;
 }
 
-JNIEXPORT jstring JNICALL Java_sun_font_FontManager_getFontPath
-(JNIEnv *env, jclass obj, jboolean noType1) {
+JNIEXPORT jstring JNICALL Java_sun_awt_X11FontManager_getFontPath
+(JNIEnv *env, jobject thiz, jboolean noType1) {
     jstring ret;
     static char *ptr = NULL; /* retain result across calls */
 
     if (ptr == NULL) {
         ptr = getPlatformFontPathChars(env, noType1);

@@ -562,11 +573,11 @@
   }
   return doSetFontPath;
 }
 #endif /* !HEADLESS */
 
-JNIEXPORT void JNICALL Java_sun_font_FontManager_setNativeFontPath
+JNIEXPORT void JNICALL Java_sun_font_X11FontManager_setNativeFontPath
 (JNIEnv *env, jclass obj, jstring theString) {
 #ifdef HEADLESS
     return;
 #else
     fDirRecord fDir;

@@ -590,25 +601,10 @@
     AWT_UNLOCK();
 
 #endif
 }
 
-/* This isn't yet used on unix, the implementation is added since shared
- * code calls this method in preparation for future use.
- */
-/* Obtain all the fontname -> filename mappings.
- * This is called once and the results returned to Java code which can
- * use it for lookups to reduce or avoid the need to search font files.
- */
-JNIEXPORT void JNICALL
-Java_sun_font_FontManager_populateFontFileNameMap
-(JNIEnv *env, jclass obj, jobject fontToFileMap,
- jobject fontToFamilyMap, jobject familyToFontListMap, jobject locale)
-{
-    return;
-}
-
 #include <dlfcn.h>
 #ifndef __linux__ /* i.e. is solaris */
 #include <link.h>
 #endif
 

@@ -863,11 +859,11 @@
 #define TEXT_AA_LCD_HBGR 5
 #define TEXT_AA_LCD_VRGB 6
 #define TEXT_AA_LCD_VBGR 7
 
 JNIEXPORT jint JNICALL
-Java_sun_font_FontManager_getFontConfigAASettings
+Java_sun_font_FontConfigManager_getFontConfigAASettings
 (JNIEnv *env, jclass obj, jstring localeStr, jstring fcNameStr) {
 
     FcNameParseFuncType FcNameParse;
     FcPatternAddStringFuncType FcPatternAddString;
     FcConfigSubstituteFuncType FcConfigSubstitute;

@@ -973,11 +969,11 @@
         }
     }
 }
 
 JNIEXPORT jint JNICALL
-Java_sun_font_FontManager_getFontConfigVersion
+Java_sun_font_FontConfigManager_getFontConfigVersion
     (JNIEnv *env, jclass obj) {
 
     void* libfontconfig;
     FcGetVersionFuncType FcGetVersion;
     int version = 0;

@@ -998,11 +994,11 @@
     return version;
 }
 
 
 JNIEXPORT void JNICALL
-Java_sun_font_FontManager_getFontConfig
+Java_sun_font_FontConfigManager_getFontConfig
 (JNIEnv *env, jclass obj, jstring localeStr, jobject fcInfoObj,
  jobjectArray fcCompFontArray,  jboolean includeFallbacks) {
 
     FcNameParseFuncType FcNameParse;
     FcPatternAddStringFuncType FcPatternAddString;

@@ -1032,15 +1028,15 @@
     jfieldID familyNameID, styleNameID, fullNameID, fontFileID;
     jmethodID fcFontCons;
     char* debugMinGlyphsStr = getenv("J2D_DEBUG_MIN_GLYPHS");
 
     jclass fcInfoClass =
-        (*env)->FindClass(env, "sun/font/FontManager$FontConfigInfo");
+        (*env)->FindClass(env, "sun/font/FontConfigManager$FontConfigInfo");
     jclass fcCompFontClass =
-        (*env)->FindClass(env, "sun/font/FontManager$FcCompFont");
+        (*env)->FindClass(env, "sun/font/FontConfigManager$FcCompFont");
     jclass fcFontClass =
-         (*env)->FindClass(env, "sun/font/FontManager$FontConfigFont");
+         (*env)->FindClass(env, "sun/font/FontConfigManager$FontConfigFont");
 
     if (fcInfoObj == NULL || fcCompFontArray == NULL || fcInfoClass == NULL ||
         fcCompFontClass == NULL || fcFontClass == NULL) {
         return;
     }

@@ -1052,15 +1048,15 @@
 
     fcNameID = (*env)->GetFieldID(env, fcCompFontClass,
                                   "fcName", "Ljava/lang/String;");
     fcFirstFontID =
         (*env)->GetFieldID(env, fcCompFontClass, "firstFont",
-                           "Lsun/font/FontManager$FontConfigFont;");
+                           "Lsun/font/FontConfigManager$FontConfigFont;");
 
     fcAllFontsID =
         (*env)->GetFieldID(env, fcCompFontClass, "allFonts",
-                           "[Lsun/font/FontManager$FontConfigFont;");
+                           "[Lsun/font/FontConfigManager$FontConfigFont;");
 
     fcFontCons = (*env)->GetMethodID(env, fcFontClass, "<init>", "()V");
 
     familyNameID = (*env)->GetFieldID(env, fcFontClass,
                                       "familyName", "Ljava/lang/String;");