Author: tilman
Date: Tue Jun 11 09:05:19 2024
New Revision: 1918250

URL: http://svn.apache.org/viewvc?rev=1918250&view=rev
Log:
PDFBOX-2941: add workaround from LegacyPDFStreamEngine

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=1918250&r1=1918249&r2=1918250&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
 Tue Jun 11 09:05:19 2024
@@ -68,11 +68,17 @@ class SimpleFont extends FontPane
         for (int index = 0; index <= 255; index++)
         {
             glyphs[index][0] = index;
-            if (font.getEncoding().contains(index) || font.toUnicode(index) != 
null)
+            String unicode = font.toUnicode(index);
+            if (unicode == null)
+            {
+                // this mirrors the workaround for PDSimpleFont in 
LegacyPDFStreamEngine
+                unicode = String.valueOf((char) index);
+            }
+            if (font.getEncoding().contains(index) || unicode != null)
             {
                 String glyphName = font.getEncoding().getName(index);
                 glyphs[index][1] = glyphName;
-                glyphs[index][2] = font.toUnicode(index);
+                glyphs[index][2] = unicode;
                 try
                 {
                     if (font instanceof PDVectorFont)


Reply via email to