diff --git a/src/share/classes/sun/font/CompositeFont.java b/src/share/classes/sun/font/CompositeFont.java index 43b392b5ff27d4a3f5b166134127675a562f4b47..45480ca8831a8707f9c5ecb3ae67e1fcfea4b571 100644 --- a/src/share/classes/sun/font/CompositeFont.java +++ b/src/share/classes/sun/font/CompositeFont.java @@ -71,6 +71,13 @@ public final class CompositeFont extends Font2D { } else { numSlots = componentNames.length; } + /* We will limit the number of slots to 254. + * We store the slot for a glyph id in a byte and we may use one slot + * for an EUDC font, and we may also create a composite + * using this composite as a backup for a physical font. + * So we want to leave space for the two additional slots. + */ + numSlots = (numSlots <= 254) ? numSlots : 254; /* Only the first "numMetricsSlots" slots are used for font metrics. * the rest are considered "fallback" slots". diff --git a/src/share/classes/sun/font/FileFontStrike.java b/src/share/classes/sun/font/FileFontStrike.java index f357aea1f907644596b1d8957b9e7f5a716ab46d..888be14559a58bbc4282dd96752928e08ff1a7e9 100644 --- a/src/share/classes/sun/font/FileFontStrike.java +++ b/src/share/classes/sun/font/FileFontStrike.java @@ -420,14 +420,13 @@ public class FileFontStrike extends PhysicalStrike { /* The following method is called from CompositeStrike as a special case. */ - private static final int SLOTZEROMAX = 0xffffff; int getSlot0GlyphImagePtrs(int[] glyphCodes, long[] images, int len) { int convertedCnt = 0; for (int i=0; i= SLOTZEROMAX) { + if (glyphCode >>> 24 != 0) { return convertedCnt; } else { convertedCnt++; diff --git a/src/solaris/native/sun/awt/fontpath.c b/src/solaris/native/sun/awt/fontpath.c index ba1931731b90085586642298ef0bc9ee3c4b861c..f5bd1763205c475fdfc98f5ca28c06af3e0e65b6 100644 --- a/src/solaris/native/sun/awt/fontpath.c +++ b/src/solaris/native/sun/awt/fontpath.c @@ -1217,10 +1217,11 @@ Java_sun_font_FontConfigManager_getFontConfig minGlyphs = val; } } + FcCharSet *unionCharset = NULL; for (j=0; jfonts[j]; FcChar8 *fontformat; - FcCharSet *unionCharset = NULL, *charset; + FcCharSet *charset = NULL; fontformat = NULL; (*FcPatternGetString)(fontPattern, FC_FONTFORMAT, 0, &fontformat); @@ -1278,6 +1279,9 @@ Java_sun_font_FontConfigManager_getFontConfig if (!includeFallbacks) { break; } + if (fontCount == 254) { + break; // CompositeFont will only use up to 254 slots from here. + } } /* Once we get here 'fontCount' is the number of returned fonts