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 2021/05/05 03:51:28 UTC

svn commit: r1889509 - /pdfbox/branches/2.0/debugger/src/main/java/org/apache/pdfbox/debugger/fontencodingpane/SimpleFont.java

Author: tilman
Date: Wed May  5 03:51:27 2021
New Revision: 1889509

URL: http://svn.apache.org/viewvc?rev=1889509&view=rev
Log:
PDFBOX-2941: restore code, type 1 fonts are not vector fonts in 2.0

Modified:
    pdfbox/branches/2.0/debugger/src/main/java/org/apache/pdfbox/debugger/fontencodingpane/SimpleFont.java

Modified: pdfbox/branches/2.0/debugger/src/main/java/org/apache/pdfbox/debugger/fontencodingpane/SimpleFont.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/2.0/debugger/src/main/java/org/apache/pdfbox/debugger/fontencodingpane/SimpleFont.java?rev=1889509&r1=1889508&r2=1889509&view=diff
==============================================================================
--- pdfbox/branches/2.0/debugger/src/main/java/org/apache/pdfbox/debugger/fontencodingpane/SimpleFont.java (original)
+++ pdfbox/branches/2.0/debugger/src/main/java/org/apache/pdfbox/debugger/fontencodingpane/SimpleFont.java Wed May  5 03:51:27 2021
@@ -41,7 +41,7 @@ class SimpleFont extends FontPane
 
     /**
      * Constructor.
-     * @param font PDSimpleFont instance, but not a type 3 font (must also be a PDVectorFont).
+     * @param font PDSimpleFont instance, but not a type 3 font.
      * @throws IOException If fails to parse unicode characters.
      */
     SimpleFont(PDSimpleFont font) throws IOException
@@ -74,8 +74,16 @@ class SimpleFont extends FontPane
                 glyphs[index][2] = font.toUnicode(index);
                 try
                 {
-                    // using names didn't work with the file from PDFBOX-3445
-                    glyphs[index][3] = ((PDVectorFont) font).getPath(index);
+                    if (font instanceof PDVectorFont)
+                    {
+                        // using names didn't work with the file from PDFBOX-3445
+                        glyphs[index][3] = ((PDVectorFont) font).getPath(index);
+                    }
+                    else
+                    {
+                        // type 1 font isn't a vector font in 2.0
+                        glyphs[index][3] = font.getPath(glyphName);
+                    }
                 }
                 catch (IOException ex)
                 {