< prev index next >

src/java.desktop/share/classes/sun/font/SunFontManager.java

Print this page

        

@@ -1075,22 +1075,28 @@
              * directory is missing), it could find another version of Lucida
              * from the host system. This is OK because at that point we are
              * trying to gracefully handle/recover from a system
              * misconfiguration and this is probably a reasonable substitution.
              */
-            defaultPhysicalFont = (PhysicalFont)
+            Font2D font2d =
                 findFont2D(getDefaultFontFaceName(), Font.PLAIN, NO_FALLBACK);
+            if (font2d instanceof PhysicalFont) {
+                defaultPhysicalFont = (PhysicalFont) font2d;
+            }
             if (defaultPhysicalFont == null) {
                 /* Because of the findFont2D call above, if we reach here, we
                  * know all fonts have already been loaded, just accept any
                  * match at this point. If this fails we are in real trouble
                  * and I don't know how to recover from there being absolutely
                  * no fonts anywhere on the system.
                  */
                 Iterator<PhysicalFont> i = physicalFonts.values().iterator();
                 if (i.hasNext()) {
                     defaultPhysicalFont = i.next();
+                    if (font2d instanceof CompositeFont) {
+                        defaultPhysicalFont = ((CompositeFont) font2d).getSlotFont(0);
+                    }
                 } else {
                     throw new Error("Probable fatal error:No fonts found.");
                 }
             }
         }
< prev index next >