You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pdfbox.apache.org by ti...@apache.org on 2016/07/08 15:39:09 UTC

svn commit: r1751926 - /pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/util/autodetect/FontFileFinder.java

Author: tilman
Date: Fri Jul  8 15:39:09 2016
New Revision: 1751926

URL: http://svn.apache.org/viewvc?rev=1751926&view=rev
Log:
PDFBOX-3377: exclude fonts.*

Modified:
    pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/util/autodetect/FontFileFinder.java

Modified: pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/util/autodetect/FontFileFinder.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/util/autodetect/FontFileFinder.java?rev=1751926&r1=1751925&r2=1751926&view=diff
==============================================================================
--- pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/util/autodetect/FontFileFinder.java (original)
+++ pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/util/autodetect/FontFileFinder.java Fri Jul  8 15:39:09 2016
@@ -20,6 +20,8 @@ package org.apache.fontbox.util.autodete
 import java.io.File;
 import java.net.URI;
 import java.util.List;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 
 /**
  * Helps to autodetect/locate available operating system fonts. This class is based on a class provided by Apache FOP.
@@ -27,6 +29,7 @@ import java.util.List;
  */
 public class FontFileFinder
 {
+    private static final Log LOG = LogFactory.getLog(FontFileFinder.class);
 
     private FontDirFinder fontDirFinder = null;
 
@@ -123,8 +126,16 @@ public class FontFileFinder
                     }
                     else
                     {
+                        if (LOG.isDebugEnabled())
+                        {
+                            LOG.debug("checkFontfile check " + file);
+                        }
                         if (checkFontfile(file))
                         {
+                            if (LOG.isDebugEnabled())
+                            {
+                                LOG.debug("checkFontfile found " + file);
+                            }
                             results.add(file.toURI());
                         }
                     }
@@ -142,6 +153,8 @@ public class FontFileFinder
     private boolean checkFontfile(File file)
     {
         String name = file.getName().toLowerCase();
-        return name.endsWith(".ttf") || name.endsWith(".otf") || name.endsWith(".pfb") || name.endsWith(".ttc");
+        return (name.endsWith(".ttf") || name.endsWith(".otf") || name.endsWith(".pfb") || name.endsWith(".ttc")) 
+                // PDFBOX-3377 exclude weird files in AIX
+                && !name.startsWith("fonts.");
     }
 }