[luatex] Bug: When nesting Form XObject reference in <box>, \pdfxform resources {<resources>} <box> -> missing user-provided <resources>

Alexander Grahn A.Grahn at hzdr.de
Mon Mar 19 12:58:51 CET 2018


On 3/19/2018 11:52 AM, Hans Hagen wrote:
> On 3/19/2018 11:20 AM, Alexander Grahn wrote:
> > Dear all,
> >
> > it seems that I discovered a bug in connection with nested Form XObjects
> > (pdftex built-in \pdfxform) that occurs in pdfTeX as well as in LuaTeX.
> >
> > The \pdfxform built-in provides the optional `resources {<resources>}'
> > argument, as in
> >
> >    \pdfxform resources {<resources>} <box>
> >
> > , in order to allow the user to insert additional entries in the /Resources
> > dictionary of the Form XObject to be produced from box register <box>.
> >
> > This works as advertised for ordinary box content (1st \pdfxform in the code
> > below), but as soon as another Form XObject is referenced inside <box>, the
> > `resources {...}' argument is ignored and user-provided <resources> are missing
> > in the generated PDF code (2nd \pdfxform).
> >
> > Here is a minimal example for pdfTeX and LuaTeX for demonstration. The PDF
> > object numbers mentioned in the comments are different in the PDF output from
> > LuaTeX.
> >
> > %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
> > % Bug: When nesting Form XObject reference in <box>,
> > %      \pdfxform resources {<resources>} <box>
> > %      --> missing user-provided <resources>
> >
> > \input luatex85.sty
> >
> > \pdfcompresslevel=0
> > \pdfobjcompresslevel=0
> >
> > \setbox0=\hbox{World}
> > \edef\wrldwd{\the\wd0}
> >
> > \pdfxform
> > attr {}
> > resources {/Properties <</Key1 (Val1)>>} % OK
> > 0
> >
> > %nesting Form XObject reference
> > \setbox0=\hbox{Hello \hbox to \wrldwd {\pdfrefxform\pdflastxform\hss}!}
> >
> > \pdfxform
> > attr {}
> > % /Properties <<...>> missing in /Resources dict (object `8 0'), ref'ed in
> > resources {/Properties <</Key2 (Val2)>>}%       Form XObject (object `2 0')
> > 0
> >
> > \pdfrefxform\pdflastxform
> >
> > \bye
> > %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
> 
> there is no nesting stack kept there ...
> 
> \immediate\pdfxform ...
> 
> works ok
> 
> Hans

That is strange, as for `attr {...}' such a stack apparently exists.
`resources {...}' should behave in the same way.

Consider this:

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Bug: When nesting Form XObject reference in <box>,
%      \pdfxform resources {<resources>} <box>
%      --> missing user-provided <resources>

\input luatex85.sty

\pdfcompresslevel=0
\pdfobjcompresslevel=0

\setbox0=\hbox{World}
\edef\wrldwd{\the\wd0}

\pdfxform
attr {/UserDict <</K1 (V1)>>} %OK
resources {/Properties <</Key1 (Val1)>>} % OK
0

%nesting Form XObject reference
\setbox0=\hbox{Hello \hbox to \wrldwd {\pdfrefxform\pdflastxform\hss}!}

\pdfxform
attr {/UserDict <</K2 (V2)>>} %OK
% /Properties <<...>> missing in /Resources dict (object `8 0'), ref'ed in
resources {/Properties <</Key2 (Val2)>>}%       Form XObject (object `2 0')
0

\pdfrefxform\pdflastxform

\bye
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Alexander


More information about the luatex mailing list