pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1751358 - /pdfbox/branches/2.0/fontbox/src/main/java/org/apache/fontbox/util/autodetect/FontFileFinder.java
Date Mon, 04 Jul 2016 17:58:26 GMT
Author: tilman
Date: Mon Jul  4 17:58:26 2016
New Revision: 1751358

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

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

Modified: pdfbox/branches/2.0/fontbox/src/main/java/org/apache/fontbox/util/autodetect/FontFileFinder.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/2.0/fontbox/src/main/java/org/apache/fontbox/util/autodetect/FontFileFinder.java?rev=1751358&r1=1751357&r2=1751358&view=diff
==============================================================================
--- pdfbox/branches/2.0/fontbox/src/main/java/org/apache/fontbox/util/autodetect/FontFileFinder.java
(original)
+++ pdfbox/branches/2.0/fontbox/src/main/java/org/apache/fontbox/util/autodetect/FontFileFinder.java
Mon Jul  4 17:58:26 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 file in AIX
+                && !name.equals("fonts.alias.ttf");
     }
 }



Mime
View raw message