Details
-
Type: Bug
-
Status: Closed
-
Priority: Major
-
Resolution: Fixed
-
Affects Version/s: 6.1.2
-
Fix Version/s: 6.1.3
-
Component/s: Font Engine
-
Labels:None
-
Environment:ICEpdf 6.1.2 Pro
Java SE 8u92 x64
Windows 10 x64
Description
h4. Summary
When FontEngine is ON, GlyphText.toUnicode() does not correctly apply custom encoding specified by an embedded font-subset, which manifests itself when trying to work with LineText/WordText in the document, or when trying to copy text from the RI Viewer.
h4. Steps to reproduce
# Launch ICEpdf Pro RI Viewer
# Open the attached PDF file
# Make a text selection (e.g. in the "Briefing Strip" section of the document)
# Copy selected text from RI Viewer, and paste it to a text editor
h4. Expected behavior
Selected text should contain the same character as the displayed PDF.
h4. Actual behavior:
* With FontEngine OFF, correct decoding is observed: http://i.imgur.com/cVgmdNI.png
* With FontEngine ON, copied text is garbled (i.e. custom encoding is not translated to Unicode correctly): http://i.imgur.com/Njbbid6.png
When FontEngine is ON, GlyphText.toUnicode() does not correctly apply custom encoding specified by an embedded font-subset, which manifests itself when trying to work with LineText/WordText in the document, or when trying to copy text from the RI Viewer.
h4. Steps to reproduce
# Launch ICEpdf Pro RI Viewer
# Open the attached PDF file
# Make a text selection (e.g. in the "Briefing Strip" section of the document)
# Copy selected text from RI Viewer, and paste it to a text editor
h4. Expected behavior
Selected text should contain the same character as the displayed PDF.
h4. Actual behavior:
* With FontEngine OFF, correct decoding is observed: http://i.imgur.com/cVgmdNI.png
* With FontEngine ON, copied text is garbled (i.e. custom encoding is not translated to Unicode correctly): http://i.imgur.com/Njbbid6.png
I don't know how FontEngine works under-the-hood, but stepping through AbstractContentParser.drawString(...) in a debugger shows that all the necessary information is present at the time GlyphText objects are constructed. For example, the first embedded font in the attached PDF is used for the blue text ("Front Range") on the middle-right side of the page:
...so the CIDs can be mapped to: ["F", "r", "o", "n", "t", "space", "R", "a", "n", "g", "e"]
So, given that all this information is already available to the code, it seems that FontEngine should be able to work with the custom encoding without too much trouble.