pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1863095 - in /pdfbox/trunk: fontbox/src/main/java/org/apache/fontbox/ttf/CFFTable.java pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDCIDFontType0.java pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDType1CFont.java
Date Mon, 15 Jul 2019 16:30:13 GMT
Author: tilman
Date: Mon Jul 15 16:30:13 2019
New Revision: 1863095

URL: http://svn.apache.org/viewvc?rev=1863095&view=rev
Log:
PDFBOX-4071: SonarQube fix / refactor

Modified:
    pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/ttf/CFFTable.java
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDCIDFontType0.java
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDType1CFont.java

Modified: pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/ttf/CFFTable.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/ttf/CFFTable.java?rev=1863095&r1=1863094&r2=1863095&view=diff
==============================================================================
--- pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/ttf/CFFTable.java (original)
+++ pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/ttf/CFFTable.java Mon Jul 15 16:30:13
2019
@@ -50,7 +50,7 @@ public class CFFTable extends TTFTable
         byte[] bytes = data.read((int)getLength());
 
         CFFParser parser = new CFFParser();
-        cffFont = parser.parse(bytes, new ByteSource(font)).get(0);
+        cffFont = parser.parse(bytes, new CFFBytesource(font)).get(0);
 
         initialized = true;
     }
@@ -66,11 +66,11 @@ public class CFFTable extends TTFTable
     /**
      * Allows bytes to be re-read later by CFFParser.
      */
-    private static class ByteSource implements CFFParser.ByteSource
+    private static class CFFBytesource implements CFFParser.ByteSource
     {
         private final TrueTypeFont ttf;
         
-        ByteSource(TrueTypeFont ttf)
+        CFFBytesource(TrueTypeFont ttf)
         {
            this.ttf = ttf; 
         }

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDCIDFontType0.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDCIDFontType0.java?rev=1863095&r1=1863094&r2=1863095&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDCIDFontType0.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDCIDFontType0.java Mon
Jul 15 16:30:13 2019
@@ -97,7 +97,7 @@ public class PDCIDFontType0 extends PDCI
             CFFParser cffParser = new CFFParser();
             try
             {
-                cffFont = cffParser.parse(bytes, new ByteSource()).get(0);
+                cffFont = cffParser.parse(bytes, new FF3ByteSource()).get(0);
             }
             catch (IOException e)
             {
@@ -478,13 +478,12 @@ public class PDCIDFontType0 extends PDCI
         return 500;
     }
 
-    private class ByteSource implements CFFParser.ByteSource
+    private class FF3ByteSource implements CFFParser.ByteSource
     {
         @Override
         public byte[] getBytes() throws IOException
         {
-            PDStream ff3Stream = getFontDescriptor().getFontFile3();
-            return IOUtils.toByteArray(ff3Stream.createInputStream());
+            return getFontDescriptor().getFontFile3().toByteArray();
         }
     }
 }

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDType1CFont.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDType1CFont.java?rev=1863095&r1=1863094&r2=1863095&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDType1CFont.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDType1CFont.java Mon
Jul 15 16:30:13 2019
@@ -99,7 +99,7 @@ public class PDType1CFont extends PDSimp
             {
                 // note: this could be an OpenType file, fortunately CFFParser can handle
that
                 CFFParser cffParser = new CFFParser();
-                cffEmbedded = (CFFType1Font)cffParser.parse(bytes, new ByteSource()).get(0);
+                cffEmbedded = (CFFType1Font)cffParser.parse(bytes, new FF3ByteSource()).get(0);
             }
         }
         catch (IOException e)
@@ -422,13 +422,12 @@ public class PDType1CFont extends PDSimp
         return ".notdef";
     }
     
-    private class ByteSource implements CFFParser.ByteSource
+    private class FF3ByteSource implements CFFParser.ByteSource
     {
         @Override
         public byte[] getBytes() throws IOException
         {
-            PDStream ff3Stream = getFontDescriptor().getFontFile3();
-            return IOUtils.toByteArray(ff3Stream.createInputStream());
+            return getFontDescriptor().getFontFile3().toByteArray();
         }
     }
 }



Mime
View raw message