pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jahew...@apache.org
Subject svn commit: r1690300 - /pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/FontMapper.java
Date Fri, 10 Jul 2015 18:10:21 GMT
Author: jahewson
Date: Fri Jul 10 18:10:21 2015
New Revision: 1690300

URL: http://svn.apache.org/r1690300
Log:
PDFBOX-2842: Handle case where there are no matching fonts

Modified:
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/FontMapper.java

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/FontMapper.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/FontMapper.java?rev=1690300&r1=1690299&r2=1690300&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/FontMapper.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/FontMapper.java Fri Jul
10 18:10:21 2015
@@ -501,15 +501,17 @@ final class FontMapper
                 // try automatic substitutes via character collection
                 PriorityQueue<FontMatch> queue = getFontMatches(fontDescriptor, cidSystemInfo);
                 FontMatch bestMatch = queue.poll();
-                FontBoxFont font = bestMatch.info.getFont();
-                
-                if (font instanceof OpenTypeFont)
+                if (bestMatch != null)
                 {
-                    return new CIDFontMapping((OpenTypeFont)font, null, true);
-                }
-                else
-                {
-                    return new CIDFontMapping(null, font, true);
+                    FontBoxFont font = bestMatch.info.getFont();
+                    if (font instanceof OpenTypeFont)
+                    {
+                        return new CIDFontMapping((OpenTypeFont)font, null, true);
+                    }
+                    else
+                    {
+                        return new CIDFontMapping(null, font, true);
+                    }  
                 }
             }
         }



Mime
View raw message