Author: tilman
Date: Mon Oct 13 18:51:26 2025
New Revision: 1929130

Log:
PDFBOX-6084: remove dead code, as suggested by Valery Bokov

Modified:
   
pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/text/PDFMarkedContentExtractor.java

Modified: 
pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/text/PDFMarkedContentExtractor.java
==============================================================================
--- 
pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/text/PDFMarkedContentExtractor.java
     Mon Oct 13 18:51:21 2025        (r1929129)
+++ 
pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/text/PDFMarkedContentExtractor.java
     Mon Oct 13 18:51:26 2025        (r1929130)
@@ -203,48 +203,9 @@ public class PDFMarkedContentExtractor e
             }
         }
 
-        if( showCharacter )
+        if (showCharacter && !this.currentMarkedContents.isEmpty())
         {
-            List<TextPosition> textList = new ArrayList<>();
-
-            /* In the wild, some PDF encoded documents put diacritics (accents 
on
-             * top of characters) into a separate Tj element.  When displaying 
them
-             * graphically, the two chunks get overlaid.  With text output 
though,
-             * we need to do the overlay. This code recombines the diacritic 
with
-             * its associated character if the two are consecutive.
-             */ 
-            if(textList.isEmpty())
-            {
-                textList.add(text);
-            }
-            else
-            {
-                /* test if we overlap the previous entry.  
-                 * Note that we are making an assumption that we need to only 
look back
-                 * one TextPosition to find what we are overlapping.  
-                 * This may not always be true. */
-                TextPosition previousTextPosition = 
textList.get(textList.size()-1);
-                if(text.isDiacritic() && previousTextPosition.contains(text))
-                {
-                    previousTextPosition.mergeDiacritic(text);
-                }
-                /* If the previous TextPosition was the diacritic, merge it 
into this
-                 * one and remove it from the list. */
-                else if(previousTextPosition.isDiacritic() && 
text.contains(previousTextPosition))
-                {
-                    text.mergeDiacritic(previousTextPosition);
-                    textList.remove(textList.size()-1);
-                    textList.add(text);
-                }
-                else
-                {
-                    textList.add(text);
-                }
-            }
-            if (!this.currentMarkedContents.isEmpty())
-            {
-                this.currentMarkedContents.peek().addText(text);
-            }
+            this.currentMarkedContents.peek().addText(text);
         }
     }
 

Reply via email to