pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jahew...@apache.org
Subject svn commit: r1668979 - /pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDType1Font.java
Date Tue, 24 Mar 2015 20:08:10 GMT
Author: jahewson
Date: Tue Mar 24 20:08:10 2015
New Revision: 1668979

URL: http://svn.apache.org/r1668979
Log:
PDFBOX-2714: Allow base 14 fonts to use the fallback mechanism

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

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDType1Font.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDType1Font.java?rev=1668979&r1=1668978&r2=1668979&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDType1Font.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDType1Font.java Tue
Mar 24 20:08:10 2015
@@ -105,7 +105,25 @@ public class PDType1Font extends PDSimpl
 
         // todo: could load the PFB font here if we wanted to support Standard 14 embedding
         type1font = null;
-        type1Equivalent = ExternalFonts.getType1EquivalentFont(getBaseFont());
+        Type1Equivalent t1Equiv = ExternalFonts.getType1EquivalentFont(getBaseFont());
+        if (t1Equiv != null)
+        {
+            type1Equivalent = t1Equiv;
+        }
+        else
+        {
+            type1Equivalent = ExternalFonts.getType1FallbackFont(getFontDescriptor());
+            String fontName;
+            try
+            {
+                fontName = type1Equivalent.getName();
+            }
+            catch (IOException e)
+            {
+                fontName = "?";
+            }
+            LOG.warn("Using fallback font " + fontName + " for base font " + getBaseFont());
+        }
         isEmbedded = false;
         isDamaged = false;
     }



Mime
View raw message