Author: leleueri
Date: Fri Dec  2 13:12:14 2011
New Revision: 1209454

URL: http://svn.apache.org/viewvc?rev=1209454&view=rev
Log:
https://issues.apache.org/jira/browse/PDFBOX-1178

Modified:
    
pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/font/Type3FontValidator.java

Modified: 
pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/font/Type3FontValidator.java
URL: 
http://svn.apache.org/viewvc/pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/font/Type3FontValidator.java?rev=1209454&r1=1209453&r2=1209454&view=diff
==============================================================================
--- 
pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/font/Type3FontValidator.java
 (original)
+++ 
pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/font/Type3FontValidator.java
 Fri Dec  2 13:12:14 2011
@@ -67,7 +67,7 @@ public class Type3FontValidator extends 
        protected Encoding type3Encoding = null;
 
        public Type3FontValidator(DocumentHandler handler, COSObject obj)
-       throws ValidationException {
+                       throws ValidationException {
                super(handler, obj);
                this.pdType3 = (PDType3Font) this.pFont;
        }
@@ -257,7 +257,7 @@ public class Type3FontValidator extends 
                                                // ---- Error, the Differences 
array is invalid
                                                this.fontContainer
                                                .addError(new 
ValidationError(ERROR_FONTS_TYPE3_DAMAGED,
-                                               "Differences Array should 
contain COSInt or COSName, no other type"));
+                                                               "Differences 
Array should contain COSInt or COSName, no other type"));
                                                return false;
                                        }
                                }
@@ -321,7 +321,7 @@ public class Type3FontValidator extends 
                        this.fontContainer.addError(new ValidationError(
                                        ERROR_FONTS_DICTIONARY_INVALID,
                                        "The length of Witdhs array is invalid. 
Expected : \""
-                                       + expectedLength + "\" Current : \"" + 
wArr.size() + "\""));
+                                                       + expectedLength + "\" 
Current : \"" + wArr.size() + "\""));
                        return false;
                }
 
@@ -342,10 +342,13 @@ public class Type3FontValidator extends 
 
                                COSBase item = 
charProcsDictionary.getItem(COSName.getPDFName(charName));
                                COSStream charStream = 
COSUtils.getAsStream(item, cDoc);
-                               if (charStream == null && width != 0) {
+                               if (charStream == null) {
+                                       /* There are no character description, 
we declare the Glyph as Invalid.
+                                        * If the character is used in a 
Stream, the GlyphDetail will throw an exception.
+                                        */
                                        GlyphException glyphEx = new 
GlyphException(ERROR_FONTS_METRICS, cid, 
                                                        "The CharProcs \"" + 
charName
-                                                       + "\" doesn't exist but 
the width is " + width);
+                                                       + "\" doesn't exist, 
the width defines in the Font Dictionary is " + width);
                                        GlyphDetail glyphDetail = new 
GlyphDetail(cid, glyphEx);
                                        
this.fontContainer.addKnownCidElement(glyphDetail);
                                } else {
@@ -423,7 +426,7 @@ public class Type3FontValidator extends 
                COSBase cbImg = dictionary.getItem(COSName
                                .getPDFName(DICTIONARY_KEY_XOBJECT));
                COSBase cbFont = dictionary
-               .getItem(COSName.getPDFName(DICTIONARY_KEY_FONT));
+                               
.getItem(COSName.getPDFName(DICTIONARY_KEY_FONT));
 
                if (cbImg == null && cbFont == null) {
                        this.fontContainer.addError(new ValidationError(
@@ -520,7 +523,7 @@ public class Type3FontValidator extends 
                boolean res = true;
                if (dictionary != null) {
                        COSDictionary shadings = (COSDictionary) dictionary
-                       .getDictionaryObject(PATTERN_KEY_SHADING);
+                                       
.getDictionaryObject(PATTERN_KEY_SHADING);
                        if (shadings != null) {
                                for (COSName key : shadings.keySet()) {
                                        COSDictionary aShading = 
(COSDictionary) shadings.getDictionaryObject(key);


Reply via email to