6867603: sun.font.FontManager.getDefaultPlatformFont throws NPE in OpenJDK on Solaris 10 10/08
Reviewed-by: igor, jgodinez
This commit is contained in:
parent
afb1868fc4
commit
e674d62725
@ -194,18 +194,36 @@ public class FontConfigManager {
|
|||||||
fontArr[i].style = i % 4; // depends on array order.
|
fontArr[i].style = i % 4; // depends on array order.
|
||||||
}
|
}
|
||||||
getFontConfig(getFCLocaleStr(), fcInfo, fontArr, includeFallbacks);
|
getFontConfig(getFCLocaleStr(), fcInfo, fontArr, includeFallbacks);
|
||||||
|
FontConfigFont anyFont = null;
|
||||||
/* If don't find anything (eg no libfontconfig), then just return */
|
/* If don't find anything (eg no libfontconfig), then just return */
|
||||||
for (int i = 0; i< fontArr.length; i++) {
|
for (int i = 0; i< fontArr.length; i++) {
|
||||||
FcCompFont fci = fontArr[i];
|
FcCompFont fci = fontArr[i];
|
||||||
if (fci.firstFont == null) {
|
if (fci.firstFont == null) {
|
||||||
if (FontUtilities.isLogging()) {
|
if (FontUtilities.isLogging()) {
|
||||||
Logger logger = FontUtilities.getLogger();
|
Logger logger = FontUtilities.getLogger();
|
||||||
logger.info("Fontconfig returned no fonts.");
|
logger.info("Fontconfig returned no font for " +
|
||||||
|
fontArr[i].fcName);
|
||||||
}
|
}
|
||||||
fontConfigFailed = true;
|
fontConfigFailed = true;
|
||||||
return;
|
} else if (anyFont == null) {
|
||||||
|
anyFont = fci.firstFont;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (anyFont == null) {
|
||||||
|
if (FontUtilities.isLogging()) {
|
||||||
|
Logger logger = FontUtilities.getLogger();
|
||||||
|
logger.info("Fontconfig returned no fonts at all.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
} else if (fontConfigFailed) {
|
||||||
|
for (int i = 0; i< fontArr.length; i++) {
|
||||||
|
if (fontArr[i].firstFont == null) {
|
||||||
|
fontArr[i].firstFont = anyFont;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fontConfigFonts = fontArr;
|
fontConfigFonts = fontArr;
|
||||||
|
|
||||||
if (FontUtilities.isLogging()) {
|
if (FontUtilities.isLogging()) {
|
||||||
|
@ -1203,11 +1203,7 @@ Java_sun_font_FontConfigManager_getFontConfig
|
|||||||
* Inspect the returned fonts and the ones we like (adds enough glyphs)
|
* Inspect the returned fonts and the ones we like (adds enough glyphs)
|
||||||
* are added to the arrays and we increment 'fontCount'.
|
* are added to the arrays and we increment 'fontCount'.
|
||||||
*/
|
*/
|
||||||
if (includeFallbacks) {
|
nfonts = fontset->nfont;
|
||||||
nfonts = fontset->nfont;
|
|
||||||
} else {
|
|
||||||
nfonts = 1;
|
|
||||||
}
|
|
||||||
family = (FcChar8**)calloc(nfonts, sizeof(FcChar8*));
|
family = (FcChar8**)calloc(nfonts, sizeof(FcChar8*));
|
||||||
styleStr = (FcChar8**)calloc(nfonts, sizeof(FcChar8*));
|
styleStr = (FcChar8**)calloc(nfonts, sizeof(FcChar8*));
|
||||||
fullname = (FcChar8**)calloc(nfonts, sizeof(FcChar8*));
|
fullname = (FcChar8**)calloc(nfonts, sizeof(FcChar8*));
|
||||||
@ -1249,7 +1245,7 @@ Java_sun_font_FontConfigManager_getFontConfig
|
|||||||
* adversely affects load time for minimal value-add.
|
* adversely affects load time for minimal value-add.
|
||||||
* This is still likely far more than we've had in the past.
|
* This is still likely far more than we've had in the past.
|
||||||
*/
|
*/
|
||||||
if (nfonts==10) {
|
if (j==10) {
|
||||||
minGlyphs = 50;
|
minGlyphs = 50;
|
||||||
}
|
}
|
||||||
if (unionCharset == NULL) {
|
if (unionCharset == NULL) {
|
||||||
@ -1268,6 +1264,9 @@ Java_sun_font_FontConfigManager_getFontConfig
|
|||||||
(*FcPatternGetString)(fontPattern, FC_FAMILY, 0, &family[j]);
|
(*FcPatternGetString)(fontPattern, FC_FAMILY, 0, &family[j]);
|
||||||
(*FcPatternGetString)(fontPattern, FC_STYLE, 0, &styleStr[j]);
|
(*FcPatternGetString)(fontPattern, FC_STYLE, 0, &styleStr[j]);
|
||||||
(*FcPatternGetString)(fontPattern, FC_FULLNAME, 0, &fullname[j]);
|
(*FcPatternGetString)(fontPattern, FC_FULLNAME, 0, &fullname[j]);
|
||||||
|
if (!includeFallbacks) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Once we get here 'fontCount' is the number of returned fonts
|
/* Once we get here 'fontCount' is the number of returned fonts
|
||||||
@ -1309,6 +1308,8 @@ Java_sun_font_FontConfigManager_getFontConfig
|
|||||||
}
|
}
|
||||||
if (includeFallbacks) {
|
if (includeFallbacks) {
|
||||||
(*env)->SetObjectArrayElement(env, fcFontArr, fn++,fcFont);
|
(*env)->SetObjectArrayElement(env, fcFontArr, fn++,fcFont);
|
||||||
|
} else {
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user