< prev index next >
src/java.desktop/unix/native/common/awt/fontpath.c
Print this page
rev 11361 : imported patch refactor-fm.patch
*** 495,505 ****
* This is consistent with the requirements of the desktop environments
* on these OSes.
* This also frees us from X11 APIs as JRE is required to function in
* a "headless" mode where there is no Xserver.
*/
! static char *getPlatformFontPathChars(JNIEnv *env, jboolean noType1) {
char **fcdirs = NULL, **x11dirs = NULL, **knowndirs = NULL, *path = NULL;
/* As of 1.5 we try to use fontconfig on both Solaris and Linux.
* If its not available NULL is returned.
--- 495,505 ----
* This is consistent with the requirements of the desktop environments
* on these OSes.
* This also frees us from X11 APIs as JRE is required to function in
* a "headless" mode where there is no Xserver.
*/
! static char *getPlatformFontPathChars(JNIEnv *env, jboolean noType1, jboolean isX11) {
char **fcdirs = NULL, **x11dirs = NULL, **knowndirs = NULL, *path = NULL;
/* As of 1.5 we try to use fontconfig on both Solaris and Linux.
* If its not available NULL is returned.
*** 517,526 ****
--- 517,527 ----
* is already initialised. That is always true, but if it were not so,
* this code could throw an exception and the fontpath would fail to
* be initialised.
*/
#ifndef HEADLESS
+ if (isX11) { // The following only works in an x11 environment.
#if defined(__linux__)
/* There's no headless build on linux ... */
if (!AWTIsHeadless()) { /* .. so need to call a function to check */
#endif
/* Using the X11 font path to locate font files is now a fallback
*** 536,545 ****
--- 537,547 ----
}
AWT_UNLOCK();
#if defined(__linux__)
}
#endif
+ }
#endif /* !HEADLESS */
path = mergePaths(fcdirs, x11dirs, knowndirs, noType1);
if (fcdirs != NULL) {
char **p = fcdirs;
while (*p != NULL) free(*p++);
*** 553,569 ****
}
return path;
}
! JNIEXPORT jstring JNICALL Java_sun_awt_X11FontManager_getFontPathNative
! (JNIEnv *env, jobject thiz, jboolean noType1) {
jstring ret;
static char *ptr = NULL; /* retain result across calls */
if (ptr == NULL) {
! ptr = getPlatformFontPathChars(env, noType1);
}
ret = (*env)->NewStringUTF(env, ptr);
return ret;
}
--- 555,571 ----
}
return path;
}
! JNIEXPORT jstring JNICALL Java_sun_awt_FcFontManager_getFontPathNative
! (JNIEnv *env, jobject thiz, jboolean noType1, jboolean isX11) {
jstring ret;
static char *ptr = NULL; /* retain result across calls */
if (ptr == NULL) {
! ptr = getPlatformFontPathChars(env, noType1, isX11);
}
ret = (*env)->NewStringUTF(env, ptr);
return ret;
}
< prev index next >