< prev index next >

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

Print this page




1034 
1035     CHECK_NULL(fcVersionID = (*env)->GetFieldID(env, fcInfoClass, "fcVersion", "I"));
1036     CHECK_NULL(fcCacheDirsID = (*env)->GetFieldID(env, fcInfoClass, "cacheDirs",
1037                                                   "[Ljava/lang/String;"));
1038     CHECK_NULL(fcNameID = (*env)->GetFieldID(env, fcCompFontClass,
1039                                              "fcName", "Ljava/lang/String;"));
1040     CHECK_NULL(fcFirstFontID = (*env)->GetFieldID(env, fcCompFontClass, "firstFont",
1041                                         "Lsun/font/FontConfigManager$FontConfigFont;"));
1042     CHECK_NULL(fcAllFontsID = (*env)->GetFieldID(env, fcCompFontClass, "allFonts",
1043                                         "[Lsun/font/FontConfigManager$FontConfigFont;"));
1044     CHECK_NULL(fcFontCons = (*env)->GetMethodID(env, fcFontClass, "<init>", "()V"));
1045     CHECK_NULL(familyNameID = (*env)->GetFieldID(env, fcFontClass,
1046                                       "familyName", "Ljava/lang/String;"));
1047     CHECK_NULL(styleNameID = (*env)->GetFieldID(env, fcFontClass,
1048                                     "styleStr", "Ljava/lang/String;"));
1049     CHECK_NULL(fullNameID = (*env)->GetFieldID(env, fcFontClass,
1050                                     "fullName", "Ljava/lang/String;"));
1051     CHECK_NULL(fontFileID = (*env)->GetFieldID(env, fcFontClass,
1052                                     "fontFile", "Ljava/lang/String;"));
1053 










1054     if ((libfontconfig = openFontConfig()) == NULL) {
1055         return;
1056     }
1057 
1058     FcNameParse = (FcNameParseFuncType)dlsym(libfontconfig, "FcNameParse");
1059     FcPatternAddString =
1060         (FcPatternAddStringFuncType)dlsym(libfontconfig, "FcPatternAddString");
1061     FcConfigSubstitute =
1062         (FcConfigSubstituteFuncType)dlsym(libfontconfig, "FcConfigSubstitute");
1063     FcDefaultSubstitute = (FcDefaultSubstituteFuncType)
1064         dlsym(libfontconfig, "FcDefaultSubstitute");
1065     FcFontMatch = (FcFontMatchFuncType)dlsym(libfontconfig, "FcFontMatch");
1066     FcPatternGetString =
1067         (FcPatternGetStringFuncType)dlsym(libfontconfig, "FcPatternGetString");
1068     FcPatternDestroy =
1069         (FcPatternDestroyFuncType)dlsym(libfontconfig, "FcPatternDestroy");
1070     FcPatternGetCharSet =
1071         (FcPatternGetCharSetFuncType)dlsym(libfontconfig,
1072                                            "FcPatternGetCharSet");
1073     FcFontSort =


1222             if (val >= 0 && val <= 65536) {
1223                 minGlyphs = val;
1224             }
1225         }
1226         FcCharSet *unionCharset = NULL;
1227         for (j=0; j<nfonts; j++) {
1228             FcPattern *fontPattern = fontset->fonts[j];
1229             FcChar8 *fontformat;
1230             FcCharSet *charset = NULL;
1231 
1232             fontformat = NULL;
1233             (*FcPatternGetString)(fontPattern, FC_FONTFORMAT, 0, &fontformat);
1234             /* We only want TrueType fonts but some Linuxes still depend
1235              * on Type 1 fonts for some Locale support, so we'll allow
1236              * them there.
1237              */
1238             if (fontformat != NULL
1239                 && (strcmp((char*)fontformat, "TrueType") != 0)
1240 #if defined(__linux__) || defined(_AIX)
1241                 && (strcmp((char*)fontformat, "Type 1") != 0)

1242 #endif
1243              ) {
1244                 continue;
1245             }
1246             result = (*FcPatternGetCharSet)(fontPattern,
1247                                             FC_CHARSET, 0, &charset);
1248             if (result != FcResultMatch) {
1249                 free(family);
1250                 free(fullname);
1251                 free(styleStr);
1252                 free(file);
1253                 (*FcPatternDestroy)(pattern);
1254                 (*FcFontSetDestroy)(fontset);
1255                 closeFontConfig(libfontconfig, JNI_FALSE);
1256                 return;
1257             }
1258 
1259             /* We don't want 20 or 30 fonts, so once we hit 10 fonts,
1260              * then require that they really be adding value. Too many
1261              * adversely affects load time for minimal value-add.




1034 
1035     CHECK_NULL(fcVersionID = (*env)->GetFieldID(env, fcInfoClass, "fcVersion", "I"));
1036     CHECK_NULL(fcCacheDirsID = (*env)->GetFieldID(env, fcInfoClass, "cacheDirs",
1037                                                   "[Ljava/lang/String;"));
1038     CHECK_NULL(fcNameID = (*env)->GetFieldID(env, fcCompFontClass,
1039                                              "fcName", "Ljava/lang/String;"));
1040     CHECK_NULL(fcFirstFontID = (*env)->GetFieldID(env, fcCompFontClass, "firstFont",
1041                                         "Lsun/font/FontConfigManager$FontConfigFont;"));
1042     CHECK_NULL(fcAllFontsID = (*env)->GetFieldID(env, fcCompFontClass, "allFonts",
1043                                         "[Lsun/font/FontConfigManager$FontConfigFont;"));
1044     CHECK_NULL(fcFontCons = (*env)->GetMethodID(env, fcFontClass, "<init>", "()V"));
1045     CHECK_NULL(familyNameID = (*env)->GetFieldID(env, fcFontClass,
1046                                       "familyName", "Ljava/lang/String;"));
1047     CHECK_NULL(styleNameID = (*env)->GetFieldID(env, fcFontClass,
1048                                     "styleStr", "Ljava/lang/String;"));
1049     CHECK_NULL(fullNameID = (*env)->GetFieldID(env, fcFontClass,
1050                                     "fullName", "Ljava/lang/String;"));
1051     CHECK_NULL(fontFileID = (*env)->GetFieldID(env, fcFontClass,
1052                                     "fontFile", "Ljava/lang/String;"));
1053 
1054     jclass fontUtilitiesClass =
1055         (*env)->FindClass(env, "sun/font/FontUtilities");
1056     CHECK_NULL(fontUtilitiesClass);
1057     jfieldID isOpenJDKID =
1058         (*env)->GetStaticFieldID(env, fontUtilitiesClass, "isOpenJDK", "Z");
1059     CHECK_NULL(isOpenJDKID);
1060     jboolean isOpenJDK =
1061         (*env)->GetStaticBooleanField(env, fontUtilitiesClass, isOpenJDKID);
1062 
1063 
1064     if ((libfontconfig = openFontConfig()) == NULL) {
1065         return;
1066     }
1067 
1068     FcNameParse = (FcNameParseFuncType)dlsym(libfontconfig, "FcNameParse");
1069     FcPatternAddString =
1070         (FcPatternAddStringFuncType)dlsym(libfontconfig, "FcPatternAddString");
1071     FcConfigSubstitute =
1072         (FcConfigSubstituteFuncType)dlsym(libfontconfig, "FcConfigSubstitute");
1073     FcDefaultSubstitute = (FcDefaultSubstituteFuncType)
1074         dlsym(libfontconfig, "FcDefaultSubstitute");
1075     FcFontMatch = (FcFontMatchFuncType)dlsym(libfontconfig, "FcFontMatch");
1076     FcPatternGetString =
1077         (FcPatternGetStringFuncType)dlsym(libfontconfig, "FcPatternGetString");
1078     FcPatternDestroy =
1079         (FcPatternDestroyFuncType)dlsym(libfontconfig, "FcPatternDestroy");
1080     FcPatternGetCharSet =
1081         (FcPatternGetCharSetFuncType)dlsym(libfontconfig,
1082                                            "FcPatternGetCharSet");
1083     FcFontSort =


1232             if (val >= 0 && val <= 65536) {
1233                 minGlyphs = val;
1234             }
1235         }
1236         FcCharSet *unionCharset = NULL;
1237         for (j=0; j<nfonts; j++) {
1238             FcPattern *fontPattern = fontset->fonts[j];
1239             FcChar8 *fontformat;
1240             FcCharSet *charset = NULL;
1241 
1242             fontformat = NULL;
1243             (*FcPatternGetString)(fontPattern, FC_FONTFORMAT, 0, &fontformat);
1244             /* We only want TrueType fonts but some Linuxes still depend
1245              * on Type 1 fonts for some Locale support, so we'll allow
1246              * them there.
1247              */
1248             if (fontformat != NULL
1249                 && (strcmp((char*)fontformat, "TrueType") != 0)
1250 #if defined(__linux__) || defined(_AIX)
1251                 && (strcmp((char*)fontformat, "Type 1") != 0)
1252                 && !(isOpenJDK && (strcmp((char*)fontformat, "CFF") == 0))
1253 #endif
1254              ) {
1255                 continue;
1256             }
1257             result = (*FcPatternGetCharSet)(fontPattern,
1258                                             FC_CHARSET, 0, &charset);
1259             if (result != FcResultMatch) {
1260                 free(family);
1261                 free(fullname);
1262                 free(styleStr);
1263                 free(file);
1264                 (*FcPatternDestroy)(pattern);
1265                 (*FcFontSetDestroy)(fontset);
1266                 closeFontConfig(libfontconfig, JNI_FALSE);
1267                 return;
1268             }
1269 
1270             /* We don't want 20 or 30 fonts, so once we hit 10 fonts,
1271              * then require that they really be adding value. Too many
1272              * adversely affects load time for minimal value-add.


< prev index next >