You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pdfbox.apache.org by le...@apache.org on 2022/01/17 09:55:19 UTC

svn commit: r1897153 - /pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/FileSystemFontProvider.java

Author: lehmi
Date: Mon Jan 17 09:55:19 2022
New Revision: 1897153

URL: http://svn.apache.org/viewvc?rev=1897153&view=rev
Log:
PDFBOX-5363: don't try to cache any fonts if there aren't any, based on a proposal by Falko Modler

Modified:
    pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/FileSystemFontProvider.java

Modified: pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/FileSystemFontProvider.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/FileSystemFontProvider.java?rev=1897153&r1=1897152&r2=1897153&view=diff
==============================================================================
--- pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/FileSystemFontProvider.java (original)
+++ pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/FileSystemFontProvider.java Mon Jan 17 09:55:19 2022
@@ -347,19 +347,22 @@ final class FileSystemFontProvider exten
                 LOG.trace("Found " + files.size() + " fonts on the local system");
             }
 
-            // load cached FontInfo objects
-            List<FSFontInfo> cachedInfos = loadDiskCache(files);
-            if (cachedInfos != null && !cachedInfos.isEmpty())
+            if (!files.isEmpty())
             {
-                fontInfoList.addAll(cachedInfos);
-            }
-            else
-            {
-                LOG.warn("Building on-disk font cache, this may take a while");
-                scanFonts(files);
-                saveDiskCache();
-                LOG.warn("Finished building on-disk font cache, found " +
-                        fontInfoList.size() + " fonts");
+                // load cached FontInfo objects
+                List<FSFontInfo> cachedInfos = loadDiskCache(files);
+                if (cachedInfos != null && !cachedInfos.isEmpty())
+                {
+                    fontInfoList.addAll(cachedInfos);
+                }
+                else
+                {
+                    LOG.warn("Building on-disk font cache, this may take a while");
+                    scanFonts(files);
+                    saveDiskCache();
+                    LOG.warn("Finished building on-disk font cache, found " + fontInfoList.size()
+                            + " fonts");
+                }
             }
         }
         catch (AccessControlException e)