--- openjdk/jdk/src/solaris/native/sun/awt/fontpath.c~ 2007-10-30 09:39:24.000000000 +0100 +++ openjdk/jdk/src/solaris/native/sun/awt/fontpath.c 2007-11-24 23:51:34.000000000 +0100 @@ -612,6 +612,10 @@ #include <link.h> #endif + +#ifdef DIRECT_LINK_FONTCONFIG +# include <fontconfig/fontconfig.h> +#else /* DIRECT_LINK_FONTCONFIG */ #include "fontconfig.h" @@ -734,20 +738,12 @@ FcResult *result); typedef FcFontSet* (*FcFontSetCreateFuncType)(); typedef FcBool (*FcFontSetAddFuncType)(FcFontSet *s, FcPattern *font); - +#endif /* DIRECT_LINK_FONTCONFIG */ static char **getFontConfigLocations() { char **fontdirs; int numdirs = 0; - FcInitLoadConfigFuncType FcInitLoadConfig; - FcPatternBuildFuncType FcPatternBuild; - FcObjectSetFuncType FcObjectSetBuild; - FcFontListFuncType FcFontList; - FcPatternGetStringFuncType FcPatternGetString; - FcStrDirnameFuncType FcStrDirname; - FcPatternDestroyFuncType FcPatternDestroy; - FcFontSetDestroyFuncType FcFontSetDestroy; FcConfig *fontconfig; FcPattern *pattern; @@ -758,6 +754,16 @@ int i, f, found, len=0; char **fontPath; +#ifndef DIRECT_LINK_FONTCONFIG + FcInitLoadConfigFuncType FcInitLoadConfig; + FcPatternBuildFuncType FcPatternBuild; + FcObjectSetFuncType FcObjectSetBuild; + FcFontListFuncType FcFontList; + FcPatternGetStringFuncType FcPatternGetString; + FcStrDirnameFuncType FcStrDirname; + FcPatternDestroyFuncType FcPatternDestroy; + FcFontSetDestroyFuncType FcFontSetDestroy; + void* libfontconfig = openFontConfig(); if (libfontconfig == NULL) { @@ -789,6 +795,7 @@ closeFontConfig(libfontconfig, JNI_FALSE); return NULL; } +#endif /* Make calls into the fontconfig library to build a search for * outline fonts, and to get the set of full file paths from the matches. @@ -831,7 +838,9 @@ /* Free memory and close the ".so" */ (*FcFontSetDestroy)(fontSet); (*FcPatternDestroy)(pattern); +#ifndef DIRECT_LINK_FONTCONFIG closeFontConfig(libfontconfig, JNI_TRUE); +#endif return fontdirs; } @@ -849,6 +858,7 @@ Java_sun_font_FontManager_getFontConfigAASettings (JNIEnv *env, jclass obj, jstring localeStr, jstring fcNameStr) { +#ifndef DIRECT_LINK_FONTCONFIG FcNameParseFuncType FcNameParse; FcPatternAddStringFuncType FcPatternAddString; FcConfigSubstituteFuncType FcConfigSubstitute; @@ -857,6 +867,7 @@ FcPatternGetBoolFuncType FcPatternGetBool; FcPatternGetIntegerFuncType FcPatternGetInteger; FcPatternDestroyFuncType FcPatternDestroy; +#endif FcPattern *pattern, *matchPattern; FcResult result; @@ -875,6 +886,7 @@ } locale = (*env)->GetStringUTFChars(env, localeStr, 0); +#ifndef DIRECT_LINK_FONTCONFIG if ((libfontconfig = openFontConfig()) == NULL) { (*env)->ReleaseStringUTFChars (env, fcNameStr, (const char*)fcName); if (locale) { @@ -914,7 +926,7 @@ closeFontConfig(libfontconfig, JNI_FALSE); return -1; } - +#endif pattern = (*FcNameParse)((FcChar8 *)fcName); if (locale != NULL) { @@ -938,7 +950,9 @@ if (locale) { (*env)->ReleaseStringUTFChars (env, localeStr, (const char*)locale); } +#ifndef DIRECT_LINK_FONTCONFIG closeFontConfig(libfontconfig, JNI_TRUE); +#endif if (antialias == FcFalse) { return TEXT_AA_OFF; @@ -960,6 +974,7 @@ Java_sun_font_FontManager_getFontConfig (JNIEnv *env, jclass obj, jstring localeStr, jobjectArray fontInfoArray) { +#ifndef DIRECT_LINK_FONTCONFIG FcNameParseFuncType FcNameParse; FcPatternAddStringFuncType FcPatternAddString; FcConfigSubstituteFuncType FcConfigSubstitute; @@ -967,6 +982,7 @@ FcFontMatchFuncType FcFontMatch; FcPatternGetStringFuncType FcPatternGetString; FcPatternDestroyFuncType FcPatternDestroy; +#endif int i, arrlen; jobject fontInfoObj; @@ -997,6 +1013,7 @@ return; } +#ifndef DIRECT_LINK_FONTCONFIG if ((libfontconfig = openFontConfig()) == NULL) { return; } @@ -1024,6 +1041,7 @@ closeFontConfig(libfontconfig, JNI_FALSE); return; } +#endif locale = (*env)->GetStringUTFChars(env, localeStr, 0); @@ -1073,5 +1091,7 @@ if (locale) { (*env)->ReleaseStringUTFChars (env, localeStr, (const char*)locale); } +#ifndef DIRECT_LINK_FONTCONFIG closeFontConfig(libfontconfig, JNI_TRUE); +#endif } --- openjdk/jdk/make/sun/awt/Makefile~ +++ openjdk/jdk/make/sun/awt/Makefile @@ -580,6 +580,11 @@ ifeq ($(PLATFORM), linux) LDFLAGS += -L$(MOTIF_LIB) -L$(OPENWIN_LIB) endif +ifeq ($(DIRECT_LINK_FONTCONFIG), true) +CPPFLAGS += -DDIRECT_LINK_FONTCONFIG +LDFLAGS += -lfontconfig +endif + LDFLAGS += -L$(LIBDIR)/$(LIBARCH)/$(TSOBJDIR) \ $(AWT_RUNPATH) --- openjdk/jdk/make/sun/xawt/Makefile~ +++ openjdk/jdk/make/sun/xawt/Makefile @@ -62,6 +62,11 @@ LDFLAGS += -lpthread dummy := $(shell $(MKDIR) -p $(LIB_LOCATION)) endif +ifeq ($(DIRECT_LINK_FONTCONFIG), true) +CPPFLAGS += -DDIRECT_LINK_FONTCONFIG +LDFLAGS += -lfontconfig +endif + # Since this library will be living in a subdirectory below the other libraries # we need to add an extra runpath so that libraries in the upper directory # are found at runtime. --- openjdk/jdk/make/sun/awt/mawt.gmk~ 2007-08-19 09:07:02.000000000 +0200 +++ openjdk/jdk/make/sun/awt/mawt.gmk 2007-08-19 10:32:50.000000000 +0200 @@ -247,6 +247,11 @@ LDFLAGS += -L$(LIBDIR)/$(LIBARCH)/$(TSOBJDIR) \ $(AWT_RUNPATH) +ifeq ($(DIRECT_LINK_FONTCONFIG), true) +CPPFLAGS += -DDIRECT_LINK_FONTCONFIG +LDFLAGS += -lfontconfig +endif + CLASSES.export += java.io.InputStream \ java.lang.ThreadGroup