Bug 697532

Summary: Text Transparency Knockout
Product: Ghostscript Reporter: Michael Vrhel <michael.vrhel>
Component: TransparencyAssignee: Robin Watts <robin.watts>
Status: CONFIRMED ---    
Severity: enhancement CC: ghostpdl-bugs, sphinx.pinastri
Priority: P1    
Version: master   
Hardware: All   
OS: All   
Customer: Word Size: ---
Attachments: fts_21_2101_edit.pdf

Description Michael Vrhel 2017-02-01 08:33:47 UTC
Created attachment 13342 [details]
fts_21_2101_edit.pdf

The text knockout code needs additional work in that we really need to know if there are any non-normal blend modes or opacity values less than 1.0 within the BT/ET pair.  Right now, we don't push the group until we encounter such a condition in pdf_text_begin.   Any text that was drawn with full opacity and a normal blend prior to that will not be within the knockout group.   The alternative of always pushing the text even if we have an opacity of 1.0 and a normal blend mode is not really a good solution.   

An approach suggested by Ray is to have the pdf14 device accumulate the commands between the BT/ET pair.  This is likely the preferred approach as it would also be possible to get the bounding box prior to the group push.  Currently we push a group the same size as the parent.  

Currently I am avoiding problems with BT/ET mismatches/nesting etc through careful filtering in the pdf14 device and its interactions with the interpreter.  Chris had mentioned that there are files out there that have images and other disallowed content between a BT/ET pair.   We would have to consider how best to handle those cases if we were to create what amounts to a simple display list for the BT/ET pair in the pdf14 device.

Attaching a simple file which is derived from FTS_21_2101.pdf as an example problem.
Comment 1 Peter Cherepanov 2020-12-29 19:53:58 UTC
The problem is reproduced in the current master branch. Acrobat knocks out the blue text, but Ghostscript still blends blue and pink text.