< prev index next >

src/java.desktop/unix/classes/sun/font/FcFontConfiguration.java

Print this page
rev 55624 : 8227441: Enhance logging when reading the fontconfig info file

@@ -427,10 +427,13 @@
      * the system cache.
      */
     private void readFcInfo() {
         File fcFile = getFcInfoFile();
         if (!fcFile.exists()) {
+            if (FontUtilities.debugFonts()) {
+                warning("fontconfig info file " + fcFile.toString() + " does not exist");
+            }
             return;
         }
         Properties props = new Properties();
         FcFontManager fm = (FcFontManager) fontManager;
         FontConfigManager fcm = fm.getFontConfigManager();

@@ -444,10 +447,13 @@
             }
             return;
         }
         String version = (String)props.get("version");
         if (version == null || !version.equals(fileVersion)) {
+            if (FontUtilities.debugFonts()) {
+                warning("fontconfig info file caused a version mismatch");
+            }
             return;
         }
 
         // If there's a new, different fontconfig installed on the
         // system, we invalidate our fontconfig file.

@@ -456,10 +462,13 @@
             int fcVersion;
             try {
                 fcVersion = Integer.parseInt(fcVersionStr);
                 if (fcVersion != 0 &&
                     fcVersion != FontConfigManager.getFontConfigVersion()) {
+                    if (FontUtilities.debugFonts()) {
+                        warning("new, different fontconfig detected");
+                    }
                     return;
                 }
             } catch (Exception e) {
                 if (FontUtilities.debugFonts()) {
                     warning("Exception parsing version " + fcVersionStr);

@@ -478,10 +487,13 @@
             if (dir == null) {
                 break;
             }
             File dirFile = new File(dir);
             if (dirFile.exists() && dirFile.lastModified() > lastModified) {
+                if (FontUtilities.debugFonts()) {
+                    warning("Out of date cache directories detected");
+                }
                 return;
             }
             cacheDirIndex++;
         }
 

@@ -501,10 +513,13 @@
                     fci[index].fcFamily = fcnames[i];
                     fci[index].style = s;
                     String lenStr = (String)props.get(key+".length");
                     int nfonts = Integer.parseInt(lenStr);
                     if (nfonts <= 0) {
+                        if (FontUtilities.debugFonts()) {
+                            warning("Bad non-positive .length entry in fontconfig file " + fcFile.toString());
+                        }
                         return; // bad file
                     }
                     fci[index].allFonts = new FontConfigFont[nfonts];
                     for (int f=0; f<nfonts; f++) {
                         fci[index].allFonts[f] = new FontConfigFont();

@@ -512,10 +527,13 @@
                         String fullName = (String)props.get(fkey);
                         fci[index].allFonts[f].fullName = fullName;
                         fkey = key+"."+f+".file";
                         String file = (String)props.get(fkey);
                         if (file == null) {
+                            if (FontUtilities.debugFonts()) {
+                                warning("Missing file value for key " + fkey + " in fontconfig file " + fcFile.toString());
+                            }
                             return; // bad file
                         }
                         fci[index].allFonts[f].fontFile = file;
                     }
                     fci[index].firstFont =  fci[index].allFonts[0];

@@ -526,10 +544,15 @@
         } catch (Throwable t) {
             if (FontUtilities.debugFonts()) {
                 warning(t.toString());
             }
         }
+
+        if (FontUtilities.debugFonts()) {
+            PlatformLogger logger = FontUtilities.getLogger();
+            logger.info("successfully parsed the fontconfig file at " + fcFile.toString());
+        }
     }
 
     private static void warning(String msg) {
         PlatformLogger logger = PlatformLogger.getLogger("sun.awt.FontConfiguration");
         logger.warning(msg);
< prev index next >