@@ -203,48 +203,9 @@ protected void processTextPosition( TextPosition text )
203203 }
204204 }
205205
206- if ( showCharacter )
206+ if ( showCharacter && ! this . currentMarkedContents . isEmpty () )
207207 {
208- List <TextPosition > textList = new ArrayList <>();
209-
210- /* In the wild, some PDF encoded documents put diacritics (accents on
211- * top of characters) into a separate Tj element. When displaying them
212- * graphically, the two chunks get overlaid. With text output though,
213- * we need to do the overlay. This code recombines the diacritic with
214- * its associated character if the two are consecutive.
215- */
216- if (textList .isEmpty ())
217- {
218- textList .add (text );
219- }
220- else
221- {
222- /* test if we overlap the previous entry.
223- * Note that we are making an assumption that we need to only look back
224- * one TextPosition to find what we are overlapping.
225- * This may not always be true. */
226- TextPosition previousTextPosition = textList .get (textList .size ()-1 );
227- if (text .isDiacritic () && previousTextPosition .contains (text ))
228- {
229- previousTextPosition .mergeDiacritic (text );
230- }
231- /* If the previous TextPosition was the diacritic, merge it into this
232- * one and remove it from the list. */
233- else if (previousTextPosition .isDiacritic () && text .contains (previousTextPosition ))
234- {
235- text .mergeDiacritic (previousTextPosition );
236- textList .remove (textList .size ()-1 );
237- textList .add (text );
238- }
239- else
240- {
241- textList .add (text );
242- }
243- }
244- if (!this .currentMarkedContents .isEmpty ())
245- {
246- this .currentMarkedContents .peek ().addText (text );
247- }
208+ this .currentMarkedContents .peek ().addText (text );
248209 }
249210 }
250211
0 commit comments