jdk/src/solaris/native/sun/awt/fontpath.c
changeset 3931 81071c37cc91
parent 3928 be186a33df9b
child 5506 202f599c92aa
--- a/jdk/src/solaris/native/sun/awt/fontpath.c	Wed Aug 12 17:21:08 2009 +0200
+++ b/jdk/src/solaris/native/sun/awt/fontpath.c	Fri Aug 14 14:25:22 2009 -0700
@@ -1203,11 +1203,7 @@
          * Inspect the returned fonts and the ones we like (adds enough glyphs)
          * are added to the arrays and we increment 'fontCount'.
          */
-        if (includeFallbacks) {
-            nfonts = fontset->nfont;
-        } else {
-            nfonts = 1;
-        }
+        nfonts = fontset->nfont;
         family   = (FcChar8**)calloc(nfonts, sizeof(FcChar8*));
         styleStr = (FcChar8**)calloc(nfonts, sizeof(FcChar8*));
         fullname = (FcChar8**)calloc(nfonts, sizeof(FcChar8*));
@@ -1249,7 +1245,7 @@
              * adversely affects load time for minimal value-add.
              * This is still likely far more than we've had in the past.
              */
-            if (nfonts==10) {
+            if (j==10) {
                 minGlyphs = 50;
             }
             if (unionCharset == NULL) {
@@ -1268,6 +1264,9 @@
             (*FcPatternGetString)(fontPattern, FC_FAMILY, 0, &family[j]);
             (*FcPatternGetString)(fontPattern, FC_STYLE, 0, &styleStr[j]);
             (*FcPatternGetString)(fontPattern, FC_FULLNAME, 0, &fullname[j]);
+            if (!includeFallbacks) {
+                break;
+            }
         }
 
         /* Once we get here 'fontCount' is the number of returned fonts
@@ -1309,6 +1308,8 @@
                 }
                 if (includeFallbacks) {
                     (*env)->SetObjectArrayElement(env, fcFontArr, fn++,fcFont);
+                } else {
+                    break;
                 }
             }
         }