<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, 1 Mar 2020 at 18:03, Shunsaku Hirata <<a href="mailto:shunsaku.hirata74@gmail.com">shunsaku.hirata74@gmail.com</a>> wrote:</div><div dir="ltr" class="gmail_attr"><br></div><div class="gmail_attr">nice explanation, thanks:-)</div><div class="gmail_attr"><br></div><div class="gmail_attr">Would it work if instead of relying on literal pdf \special</div><div class="gmail_attr"><br></div><div class="gmail_attr">
<span class="gmail-im">\special{pdf:code q 7 Tr}</span> <br></div><div class="gmail_attr"><br></div><div class="gmail_attr">dvipdfmx has a specific</div><div class="gmail_attr"><br></div><div class="gmail_attr">\special{pdf:startclippingsomething}</div><div class="gmail_attr">TEXT<br>\special{pdf:code -88888 -88888 99999 99999 re}</div><div class="gmail_attr">\special{pdf:endclippingsomething} <br></div><div class="gmail_attr"><br></div><div class="gmail_attr">that way the driver would ""know"  about the clip path and be responsible for adding the q .... f Q so could then not add the inner q ... Q around text in that case, perhaps....</div><div class="gmail_attr"><br></div><div class="gmail_attr"><br></div><div class="gmail_attr">David</div><div class="gmail_attr"><br></div><div class="gmail_attr"><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Dear Zdenek,<br>
<br>
> > Adding an extra "Q..q" (I assume it is not a typo) does not help. (rather it<br>
> > makes generated PDFs corrupt)<br>
> > Let me explain the original problem: My version of fake-bold patch adds a<br>
> > q-Q block around the text section BT-ET, but as this q-Q block recovers the<br>
> > graphics state saved by "q" at the execution of "Q" operator, clipping path<br>
> > added in the BT-ET section is discarded. This is why my patch broke the<br>
> > ocgx2 package.<br>
><br>
> It should work. You start by Q which pops out the state pushed by q.<br>
> You know that after your code Q will be added, hence your code must<br>
> end with q so that the added Q can pop anything. It is necessary to<br>
> pair correctly q a Q in order not to corrupt the graphic stack.<br>
<br>
Maybe you are talking about the trick to cancel out the effect of q-Q bracket<br>
which is automatically inserted for "pdf:put" command?<br>
<br>
I guess the change I made for fixing the fake-bold bug is misunderstood.<br>
<br>
Let me explain the problem reported by Alexander and the change I made<br>
for fixing the fake-bold bug which is the cause of the problem.<br>
Note that the behavior of "pdf:code" has not been changed at all.<br>
<br>
Input:<br>
  \special{pdf:code q 7 Tr}<br>
 TEXT<br>
  \special{pdf:code -88888 -88888 99999 99999 re f Q}<br>
<br>
The old behavior (before the fake-bold bug fix) is to convert them to<br>
    q 7 Tr<br>
    BT --PDF code for drawing "TEXT"-- ET<br>
   -88888 -88888 99999 99999 re f Q<br>
<br>
But after the fake-bold fix it became<br>
   q 7 Tr<br>
   q BT --PDF code for drawing "TEXT"-- ET Q<br>
  -88888 -88888 99999 99999 re f Q<br>
<br>
The only change here is q-Q bracket inserted around BT-ET but the<br>
behavior of "pdf:code" has never changed.<br>
<br>
The change of "text rendering mode" via "7 Tr" should be there as before<br>
but the problem here is that the change of "clipping path" done in the block<br>
enclosed by BT and ET is lost due to q-Q bracket recently added.<br>
<br>
This addition of q-Q bracket around text block BT-ET does not affect<br>
graphics state chages such as color change which come into effect<br>
immediately when a graphics drawing operator is invokded but it affects<br>
clipping path construction. At the time when the fill operator "f" is executed,<br>
the clipping path should be that of "TEXT". But due to the "Q" operator<br>
added immediately after "ET" (after the fake-bold fix), it is lost.<br>
Due to which the whole page is filled with the current color. (for the original<br>
example it is explicitly blue)<br>
<br>
<br>
Thanks,<br>
Shunsaku Hirata<br>
</blockquote></div></div>