pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1629707 - in /pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/font: ./ descriptor/
Date Mon, 06 Oct 2014 16:39:57 GMT
Author: tilman
Date: Mon Oct  6 16:39:56 2014
New Revision: 1629707

URL: http://svn.apache.org/r1629707
Log:
PDFBOX-2299: use PDFontLike instead of PDSimpleFont because PDCIDFontType0 is not extended
from PDSimpleFont

Modified:
    pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/font/DescendantFontValidator.java
    pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/font/SimpleFontValidator.java
    pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/font/TrueTypeFontValidator.java
    pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/font/Type1FontValidator.java
    pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/font/descriptor/CIDType0DescriptorHelper.java
    pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/font/descriptor/CIDType2DescriptorHelper.java
    pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/font/descriptor/FontDescriptorHelper.java
    pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/font/descriptor/TrueTypeDescriptorHelper.java

Modified: pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/font/DescendantFontValidator.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/font/DescendantFontValidator.java?rev=1629707&r1=1629706&r2=1629707&view=diff
==============================================================================
--- pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/font/DescendantFontValidator.java
(original)
+++ pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/font/DescendantFontValidator.java
Mon Oct  6 16:39:56 2014
@@ -46,7 +46,8 @@ public abstract class DescendantFontVali
 
     public DescendantFontValidator(PreflightContext context, PDCIDFont font, T fContainer)
     {
-        super(context, font.getCOSObject(), fContainer);
+        super(context, font, font.getCOSObject(), fContainer);
+        this.font = font;
         cosDocument = context.getDocument().getDocument();
     }
 

Modified: pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/font/SimpleFontValidator.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/font/SimpleFontValidator.java?rev=1629707&r1=1629706&r2=1629707&view=diff
==============================================================================
--- pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/font/SimpleFontValidator.java
(original)
+++ pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/font/SimpleFontValidator.java
Mon Oct  6 16:39:56 2014
@@ -25,7 +25,7 @@ import static org.apache.pdfbox.prefligh
 
 import org.apache.pdfbox.cos.COSDictionary;
 import org.apache.pdfbox.cos.COSName;
-import org.apache.pdfbox.pdmodel.font.PDSimpleFont;
+import org.apache.pdfbox.pdmodel.font.PDFontLike;
 import org.apache.pdfbox.preflight.PreflightContext;
 import org.apache.pdfbox.preflight.ValidationResult.ValidationError;
 import org.apache.pdfbox.preflight.exception.ValidationException;
@@ -33,20 +33,14 @@ import org.apache.pdfbox.preflight.font.
 
 public abstract class SimpleFontValidator<T extends FontContainer> extends FontValidator<T>
 {
-    protected PDSimpleFont font;
+    protected PDFontLike font;
     protected COSDictionary fontDictionary;
 
-    public SimpleFontValidator(PreflightContext context, PDSimpleFont font, T fContainer)
-    {
-        super(context, font.getCOSObject(), fContainer);
-        this.fontDictionary = font.getCOSObject();
-        this.font = font;
-    }
-
-    public SimpleFontValidator(PreflightContext context, COSDictionary fontDictionary, T
fContainer)
+    public SimpleFontValidator(PreflightContext context, PDFontLike font, COSDictionary fontDictionary,
T fContainer)
     {
         super(context, fontDictionary, fContainer);
         this.fontDictionary = fontDictionary;
+        this.font = font;
     }
 
     /**

Modified: pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/font/TrueTypeFontValidator.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/font/TrueTypeFontValidator.java?rev=1629707&r1=1629706&r2=1629707&view=diff
==============================================================================
--- pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/font/TrueTypeFontValidator.java
(original)
+++ pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/font/TrueTypeFontValidator.java
Mon Oct  6 16:39:56 2014
@@ -39,17 +39,21 @@ public class TrueTypeFontValidator exten
 {
     public TrueTypeFontValidator(PreflightContext context, PDTrueTypeFont font)
     {
-        super(context, font, new TrueTypeContainer(font));
+        super(context, font, font.getCOSObject(), new TrueTypeContainer(font));
     }
 
+    @Override
     protected void createFontDescriptorHelper()
     {
-        this.descriptorHelper = new TrueTypeDescriptorHelper(context, font, fontContainer);
+        this.descriptorHelper = new TrueTypeDescriptorHelper(context, (PDTrueTypeFont) font,
fontContainer);
     }
 
+    @Override
     protected void checkEncoding()
     {
-        PDFontDescriptor fd = this.font.getFontDescriptor();
+        PDTrueTypeFont ttFont = (PDTrueTypeFont) font;
+                
+        PDFontDescriptor fd = ttFont.getFontDescriptor();
         if (fd != null)
         {
             /*
@@ -57,7 +61,7 @@ public class TrueTypeFontValidator exten
              */
             if (fd.isNonSymbolic())
             {
-                Encoding encodingValue = this.font.getEncoding();
+                Encoding encodingValue = ttFont.getEncoding();
                 if (encodingValue == null
                         || !(encodingValue instanceof MacRomanEncoding || encodingValue instanceof
WinAnsiEncoding))
                 {
@@ -70,7 +74,7 @@ public class TrueTypeFontValidator exten
              * For symbolic font, no encoding entry is allowed and only one encoding entry
is expected into the FontFile
              * CMap (Check latter when the FontFile stream will be checked)
              */
-            if (fd.isSymbolic() && ((COSDictionary) this.font.getCOSObject()).getItem(COSName.ENCODING)
!= null)
+            if (fd.isSymbolic() && ((COSDictionary) fontDictionary).getItem(COSName.ENCODING)
!= null)
             {
                 this.fontContainer.push(new ValidationError(ERROR_FONTS_ENCODING,
                         "The Encoding should be missing for the Symbolic TTF"));

Modified: pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/font/Type1FontValidator.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/font/Type1FontValidator.java?rev=1629707&r1=1629706&r2=1629707&view=diff
==============================================================================
--- pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/font/Type1FontValidator.java
(original)
+++ pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/font/Type1FontValidator.java
Mon Oct  6 16:39:56 2014
@@ -44,18 +44,19 @@ public class Type1FontValidator extends 
 
     public Type1FontValidator(PreflightContext context, PDSimpleFont font)
     {
-        super(context, font, new Type1Container(font));
+        super(context, font, font.getCOSObject(), new Type1Container(font));
     }
 
     @Override
     protected void createFontDescriptorHelper()
     {
-        this.descriptorHelper = new Type1DescriptorHelper(context, font, fontContainer);
+        this.descriptorHelper = new Type1DescriptorHelper(context, (PDSimpleFont) font, fontContainer);
     }
 
+    @Override
     protected void checkEncoding()
     {
-        COSBase encoding = ((COSDictionary) font.getCOSObject()).getItem(COSName.ENCODING);
+        COSBase encoding = ((COSDictionary) fontDictionary).getItem(COSName.ENCODING);
         if (encoding != null)
         {
             COSDocument cosDocument = context.getDocument().getDocument();

Modified: pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/font/descriptor/CIDType0DescriptorHelper.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/font/descriptor/CIDType0DescriptorHelper.java?rev=1629707&r1=1629706&r2=1629707&view=diff
==============================================================================
--- pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/font/descriptor/CIDType0DescriptorHelper.java
(original)
+++ pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/font/descriptor/CIDType0DescriptorHelper.java
Mon Oct  6 16:39:56 2014
@@ -38,8 +38,8 @@ import org.apache.pdfbox.cos.COSDocument
 import org.apache.pdfbox.cos.COSName;
 import org.apache.pdfbox.cos.COSStream;
 import org.apache.pdfbox.pdmodel.common.PDStream;
-import org.apache.pdfbox.pdmodel.font.PDFont;
 import org.apache.pdfbox.pdmodel.font.PDFontDescriptor;
+import org.apache.pdfbox.pdmodel.font.PDFontLike;
 import org.apache.pdfbox.preflight.PreflightContext;
 import org.apache.pdfbox.preflight.ValidationResult;
 import org.apache.pdfbox.preflight.ValidationResult.ValidationError;
@@ -50,7 +50,7 @@ import org.apache.pdfbox.preflight.utils
 public class CIDType0DescriptorHelper extends FontDescriptorHelper<CIDType0Container>
 {
 
-    public CIDType0DescriptorHelper(PreflightContext context, PDFont font, CIDType0Container
fontContainer)
+    public CIDType0DescriptorHelper(PreflightContext context, PDFontLike font, CIDType0Container
fontContainer)
     {
         super(context, font, fontContainer);
     }

Modified: pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/font/descriptor/CIDType2DescriptorHelper.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/font/descriptor/CIDType2DescriptorHelper.java?rev=1629707&r1=1629706&r2=1629707&view=diff
==============================================================================
--- pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/font/descriptor/CIDType2DescriptorHelper.java
(original)
+++ pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/font/descriptor/CIDType2DescriptorHelper.java
Mon Oct  6 16:39:56 2014
@@ -35,8 +35,8 @@ import org.apache.pdfbox.cos.COSDocument
 import org.apache.pdfbox.cos.COSName;
 import org.apache.pdfbox.cos.COSStream;
 import org.apache.pdfbox.pdmodel.common.PDStream;
-import org.apache.pdfbox.pdmodel.font.PDFont;
 import org.apache.pdfbox.pdmodel.font.PDFontDescriptor;
+import org.apache.pdfbox.pdmodel.font.PDFontLike;
 import org.apache.pdfbox.preflight.PreflightContext;
 import org.apache.pdfbox.preflight.ValidationResult;
 import org.apache.pdfbox.preflight.ValidationResult.ValidationError;
@@ -47,7 +47,7 @@ import org.apache.pdfbox.preflight.utils
 public class CIDType2DescriptorHelper extends FontDescriptorHelper<CIDType2Container>
 {
 
-    public CIDType2DescriptorHelper(PreflightContext context, PDFont font, CIDType2Container
fontContainer)
+    public CIDType2DescriptorHelper(PreflightContext context, PDFontLike font, CIDType2Container
fontContainer)
     {
         super(context, font, fontContainer);
     }

Modified: pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/font/descriptor/FontDescriptorHelper.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/font/descriptor/FontDescriptorHelper.java?rev=1629707&r1=1629706&r2=1629707&view=diff
==============================================================================
--- pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/font/descriptor/FontDescriptorHelper.java
(original)
+++ pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/font/descriptor/FontDescriptorHelper.java
Mon Oct  6 16:39:56 2014
@@ -49,8 +49,8 @@ import org.apache.pdfbox.cos.COSDictiona
 import org.apache.pdfbox.cos.COSName;
 import org.apache.pdfbox.pdmodel.common.PDMetadata;
 import org.apache.pdfbox.pdmodel.common.PDStream;
-import org.apache.pdfbox.pdmodel.font.PDFont;
 import org.apache.pdfbox.pdmodel.font.PDFontDescriptor;
+import org.apache.pdfbox.pdmodel.font.PDFontLike;
 import org.apache.pdfbox.preflight.PreflightContext;
 import org.apache.pdfbox.preflight.ValidationResult.ValidationError;
 import org.apache.pdfbox.preflight.font.container.FontContainer;
@@ -66,11 +66,11 @@ public abstract class FontDescriptorHelp
     protected T fContainer;
 
     protected PreflightContext context;
-    protected PDFont font;
+    protected PDFontLike font;
 
     protected PDFontDescriptor fontDescriptor;
 
-    public FontDescriptorHelper(PreflightContext context, PDFont font, T fontContainer)
+    public FontDescriptorHelper(PreflightContext context, PDFontLike font, T fontContainer)
     {
         super();
         this.fContainer = fontContainer;

Modified: pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/font/descriptor/TrueTypeDescriptorHelper.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/font/descriptor/TrueTypeDescriptorHelper.java?rev=1629707&r1=1629706&r2=1629707&view=diff
==============================================================================
--- pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/font/descriptor/TrueTypeDescriptorHelper.java
(original)
+++ pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/font/descriptor/TrueTypeDescriptorHelper.java
Mon Oct  6 16:39:56 2014
@@ -48,6 +48,7 @@ public class TrueTypeDescriptorHelper ex
         super(context, font, fontContainer);
     }
 
+    @Override
     public PDStream extractFontFile(PDFontDescriptor fontDescriptor)
     {
         PDStream fontFile = fontDescriptor.getFontFile2();
@@ -70,6 +71,7 @@ public class TrueTypeDescriptorHelper ex
         return fontFile;
     }
 
+    @Override
     protected void processFontFile(PDFontDescriptor fontDescriptor, PDStream fontFile)
     {
         /*



Mime
View raw message