You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pdfbox.apache.org by ti...@apache.org on 2017/04/06 17:04:05 UTC

svn commit: r1790428 - in /pdfbox/trunk/pdfbox/src: main/java/org/apache/pdfbox/pdmodel/font/PDFont.java test/resources/input/cweb.pdf-sorted.txt test/resources/input/cweb.pdf.txt

Author: tilman
Date: Thu Apr  6 17:04:04 2017
New Revision: 1790428

URL: http://svn.apache.org/viewvc?rev=1790428&view=rev
Log:
PDFBOX-3745: use 0 default of /MissingWidth, take space width from font if 0, update test result files

Modified:
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDFont.java
    pdfbox/trunk/pdfbox/src/test/resources/input/cweb.pdf-sorted.txt
    pdfbox/trunk/pdfbox/src/test/resources/input/cweb.pdf.txt

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDFont.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDFont.java?rev=1790428&r1=1790427&r2=1790428&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDFont.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDFont.java Thu Apr  6 17:04:04 2017
@@ -258,7 +258,7 @@ public abstract class PDFont implements
             }
 
             PDFontDescriptor fd = getFontDescriptor();
-            if (fd != null && fd.hasMissingWidth())
+            if (fd != null)
             {
                 // get entry from /MissingWidth entry
                 width = fd.getMissingWidth();
@@ -529,6 +529,12 @@ public abstract class PDFont implements
                 {
                     fontWidthOfSpace = getWidth(32);
                 }
+                
+                // try to get it from the font itself
+                if (fontWidthOfSpace <= 0)
+                {
+                    fontWidthOfSpace = getWidthFromFont(32);
+                }
                 // use the average font width as fall back
                 if (fontWidthOfSpace <= 0)
                 {

Modified: pdfbox/trunk/pdfbox/src/test/resources/input/cweb.pdf-sorted.txt
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/test/resources/input/cweb.pdf-sorted.txt?rev=1790428&r1=1790427&r2=1790428&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/test/resources/input/cweb.pdf-sorted.txt (original)
+++ pdfbox/trunk/pdfbox/src/test/resources/input/cweb.pdf-sorted.txt Thu Apr  6 17:04:04 2017
@@ -801,7 +801,7 @@ change limit = change buffer ; /∗ t
 long as they don’t begin with @y, @z, or @i (which would probably mean that the change file is fouled up).
 〈Skip over comment lines in the change file; return if end of file 13 〉 ≡
 while (1) {
-change line++;
+change line ++;
 if (¬input ln (change file )) return;
 if (limit < buffer + 2) continue;
 if (buffer [0] 6= ’@’) continue;
@@ -816,7 +816,7 @@ This code is used in section 12.
 14. Here we are looking at lines following the @x.
 〈Skip to the next nonblank line; return if end of file 14 〉 ≡
 do {
-change line++;
+change line ++;
 if (¬input ln (change file )) {
 err print ("! Change file ended after @x");
 return;

Modified: pdfbox/trunk/pdfbox/src/test/resources/input/cweb.pdf.txt
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/test/resources/input/cweb.pdf.txt?rev=1790428&r1=1790427&r2=1790428&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/test/resources/input/cweb.pdf.txt (original)
+++ pdfbox/trunk/pdfbox/src/test/resources/input/cweb.pdf.txt Thu Apr  6 17:04:04 2017
@@ -801,7 +801,7 @@ change limit = change buffer ; /∗ t
 long as they don’t begin with @y, @z, or @i (which would probably mean that the change file is fouled up).
 〈Skip over comment lines in the change file; return if end of file 13 〉 ≡
 while (1) {
-change line++;
+change line ++;
 if (¬input ln (change file )) return;
 if (limit < buffer + 2) continue;
 if (buffer [0] 6= ’@’) continue;
@@ -816,7 +816,7 @@ This code is used in section 12.
 14. Here we are looking at lines following the @x.
 〈Skip to the next nonblank line; return if end of file 14 〉 ≡
 do {
-change line++;
+change line ++;
 if (¬input ln (change file )) {
 err print ("! Change file ended after @x");
 return;