equal
deleted
inserted
replaced
1118 if (fcName == NULL) { |
1118 if (fcName == NULL) { |
1119 continue; |
1119 continue; |
1120 } |
1120 } |
1121 pattern = (*FcNameParse)((FcChar8 *)fcName); |
1121 pattern = (*FcNameParse)((FcChar8 *)fcName); |
1122 if (pattern == NULL) { |
1122 if (pattern == NULL) { |
|
1123 (*env)->ReleaseStringUTFChars(env, fcNameStr, (const char*)fcName); |
1123 closeFontConfig(libfontconfig, JNI_FALSE); |
1124 closeFontConfig(libfontconfig, JNI_FALSE); |
1124 return; |
1125 return; |
1125 } |
1126 } |
1126 |
1127 |
1127 /* locale may not usually be necessary as fontconfig appears to apply |
1128 /* locale may not usually be necessary as fontconfig appears to apply |
1134 } |
1135 } |
1135 (*FcConfigSubstitute)(NULL, pattern, FcMatchPattern); |
1136 (*FcConfigSubstitute)(NULL, pattern, FcMatchPattern); |
1136 (*FcDefaultSubstitute)(pattern); |
1137 (*FcDefaultSubstitute)(pattern); |
1137 fontset = (*FcFontSort)(NULL, pattern, FcTrue, NULL, &result); |
1138 fontset = (*FcFontSort)(NULL, pattern, FcTrue, NULL, &result); |
1138 if (fontset == NULL) { |
1139 if (fontset == NULL) { |
|
1140 (*FcPatternDestroy)(pattern); |
|
1141 (*env)->ReleaseStringUTFChars(env, fcNameStr, (const char*)fcName); |
1139 closeFontConfig(libfontconfig, JNI_FALSE); |
1142 closeFontConfig(libfontconfig, JNI_FALSE); |
1140 return; |
1143 return; |
1141 } |
1144 } |
1142 |
1145 |
1143 /* fontconfig returned us "nfonts". If we are just getting the |
1146 /* fontconfig returned us "nfonts". If we are just getting the |
1151 styleStr = (FcChar8**)calloc(nfonts, sizeof(FcChar8*)); |
1154 styleStr = (FcChar8**)calloc(nfonts, sizeof(FcChar8*)); |
1152 fullname = (FcChar8**)calloc(nfonts, sizeof(FcChar8*)); |
1155 fullname = (FcChar8**)calloc(nfonts, sizeof(FcChar8*)); |
1153 file = (FcChar8**)calloc(nfonts, sizeof(FcChar8*)); |
1156 file = (FcChar8**)calloc(nfonts, sizeof(FcChar8*)); |
1154 if (family == NULL || styleStr == NULL || |
1157 if (family == NULL || styleStr == NULL || |
1155 fullname == NULL || file == NULL) { |
1158 fullname == NULL || file == NULL) { |
|
1159 if (family != NULL) { |
|
1160 free(family); |
|
1161 } |
|
1162 if (styleStr != NULL) { |
|
1163 free(styleStr); |
|
1164 } |
|
1165 if (fullname != NULL) { |
|
1166 free(fullname); |
|
1167 } |
|
1168 if (file != NULL) { |
|
1169 free(file); |
|
1170 } |
|
1171 (*FcPatternDestroy)(pattern); |
|
1172 (*FcFontSetDestroy)(fontset); |
|
1173 (*env)->ReleaseStringUTFChars(env, fcNameStr, (const char*)fcName); |
1156 closeFontConfig(libfontconfig, JNI_FALSE); |
1174 closeFontConfig(libfontconfig, JNI_FALSE); |
1157 return; |
1175 return; |
1158 } |
1176 } |
1159 fontCount = 0; |
1177 fontCount = 0; |
1160 minGlyphs = 20; |
1178 minGlyphs = 20; |
1177 continue; |
1195 continue; |
1178 } |
1196 } |
1179 result = (*FcPatternGetCharSet)(fontPattern, |
1197 result = (*FcPatternGetCharSet)(fontPattern, |
1180 FC_CHARSET, 0, &charset); |
1198 FC_CHARSET, 0, &charset); |
1181 if (result != FcResultMatch) { |
1199 if (result != FcResultMatch) { |
|
1200 free(family); |
|
1201 free(family); |
|
1202 free(styleStr); |
|
1203 free(file); |
|
1204 (*FcPatternDestroy)(pattern); |
|
1205 (*FcFontSetDestroy)(fontset); |
|
1206 (*env)->ReleaseStringUTFChars(env, |
|
1207 fcNameStr, (const char*)fcName); |
1182 closeFontConfig(libfontconfig, JNI_FALSE); |
1208 closeFontConfig(libfontconfig, JNI_FALSE); |
1183 return; |
1209 return; |
1184 } |
1210 } |
1185 |
1211 |
1186 /* We don't want 20 or 30 fonts, so once we hit 10 fonts, |
1212 /* We don't want 20 or 30 fonts, so once we hit 10 fonts, |