pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1867237 - /pdfbox/branches/issue45/pdfbox/src/main/java/org/apache/pdfbox/contentstream/operator/text/SetFontAndSize.java
Date Fri, 20 Sep 2019 16:28:58 GMT
Author: tilman
Date: Fri Sep 20 16:28:57 2019
New Revision: 1867237

URL: http://svn.apache.org/viewvc?rev=1867237&view=rev
Log:
PDFBOX-4653: clarify what font is missing when not in resources; sort imports

Modified:
    pdfbox/branches/issue45/pdfbox/src/main/java/org/apache/pdfbox/contentstream/operator/text/SetFontAndSize.java

Modified: pdfbox/branches/issue45/pdfbox/src/main/java/org/apache/pdfbox/contentstream/operator/text/SetFontAndSize.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/issue45/pdfbox/src/main/java/org/apache/pdfbox/contentstream/operator/text/SetFontAndSize.java?rev=1867237&r1=1867236&r2=1867237&view=diff
==============================================================================
--- pdfbox/branches/issue45/pdfbox/src/main/java/org/apache/pdfbox/contentstream/operator/text/SetFontAndSize.java
(original)
+++ pdfbox/branches/issue45/pdfbox/src/main/java/org/apache/pdfbox/contentstream/operator/text/SetFontAndSize.java
Fri Sep 20 16:28:57 2019
@@ -17,16 +17,20 @@
 
 package org.apache.pdfbox.contentstream.operator.text;
 
+import java.io.IOException;
+
 import java.util.List;
 
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
 import org.apache.pdfbox.contentstream.operator.MissingOperandException;
+import org.apache.pdfbox.contentstream.operator.Operator;
+import org.apache.pdfbox.contentstream.operator.OperatorName;
+import org.apache.pdfbox.contentstream.operator.OperatorProcessor;
 import org.apache.pdfbox.cos.COSBase;
 import org.apache.pdfbox.cos.COSName;
 import org.apache.pdfbox.cos.COSNumber;
-import org.apache.pdfbox.contentstream.operator.Operator;
-import org.apache.pdfbox.contentstream.operator.OperatorProcessor;
-
-import java.io.IOException;
 import org.apache.pdfbox.pdmodel.font.PDFont;
 
 /**
@@ -36,6 +40,8 @@ import org.apache.pdfbox.pdmodel.font.PD
  */
 public class SetFontAndSize extends OperatorProcessor
 {
+    private static final Log LOG = LogFactory.getLog(SetFontAndSize.class);
+
     @Override
     public void process(Operator operator, List<COSBase> arguments) throws IOException
     {
@@ -58,6 +64,10 @@ public class SetFontAndSize extends Oper
         float fontSize = ((COSNumber) base1).floatValue();
         context.getGraphicsState().getTextState().setFontSize(fontSize);
         PDFont font = context.getResources().getFont(fontName);
+        if (font == null)
+        {
+            LOG.warn("font '" + fontName.getName() + "' not found in resources");
+        }
         context.getGraphicsState().getTextState().setFont(font);
     }
 



Mime
View raw message