[latex3-commits] [git/LaTeX3-latex3-pdfresources] backendtest: xform for xetex (f112435)
Ulrike Fischer
fischer at troubleshooting-tex.de
Mon Aug 5 17:05:00 CEST 2019
Repository : https://github.com/latex3/pdfresources
On branch : backendtest
Link : https://github.com/latex3/pdfresources/commit/f11243511a377c3bec841401d6f61864c2536f44
>---------------------------------------------------------------
commit f11243511a377c3bec841401d6f61864c2536f44
Author: Ulrike Fischer <fischer at troubleshooting-tex.de>
Date: Mon Aug 5 17:05:00 2019 +0200
xform for xetex
>---------------------------------------------------------------
f11243511a377c3bec841401d6f61864c2536f44
experiments/xform-tests.tex | 68 ++++++++++++++++++++++++++++++---------------
pdfresources.dtx | 1 +
2 files changed, 46 insertions(+), 23 deletions(-)
diff --git a/experiments/xform-tests.tex b/experiments/xform-tests.tex
index 837d68a..fbef006 100644
--- a/experiments/xform-tests.tex
+++ b/experiments/xform-tests.tex
@@ -102,27 +102,22 @@
% hm ...
\cs_new:Npn \pdf_xform_wd:n #1
{
- \__dim_eval:w
\tl_use:c { c__pdf_backend_xform_wd_ \tl_to_str:n {#1} _tl }
- \__dim_eval_end:
}
\cs_new:Npn \pdf_xform_ht:n #1
{
- \dim_eval:n
- {
\tl_use:c { c__pdf_backend_xform_ht_ \tl_to_str:n {#1} _tl }
- }
}
\cs_new:Npn \pdf_xform_dp:n #1
{
- \dim_eval:n
- {
\tl_use:c { c__pdf_backend_xform_dp_ \tl_to_str:n {#1} _tl }
- }
}
\sys_if_engine_xetex:T
{
+% it needs a bit testing if it really works to set the box to 0 before the special ...
+% does it disturb viewing the xobject?
+% what happens with the resources (bdc)? (should work as they are specials too)
\cs_new:Npn \__pdf_backend_xform_new:nnnn #1 #2 #3 #4
% #1 name
% #2 attributes
@@ -150,25 +145,30 @@
\box_set_dp:Nn \l__pdf_backend_tmpa_box { \c_zero_dim }
\box_set_ht:Nn \l__pdf_backend_tmpa_box { \c_zero_dim }
\box_set_wd:Nn \l__pdf_backend_tmpa_box { \c_zero_dim }
- \__pdf_backend:n
- { bxobj~\__pdf_backend_xform_ref:n { #1 }
- ~ width ~ \pdf_xform_wd:n { #1 }
- ~ height ~ \pdf_xform_ht:n { #1 }
- ~ depth ~ \pdf_xform_dp:n { #1 }
+ \exp_args:Nx
+ \__pdf_backend:n
+ {
+ bxobj ~ \__pdf_backend_xform_ref:n { #1 }
+ \c_space_tl width ~ \pdf_xform_wd:n { #1 }
+ \c_space_tl height ~ \pdf_xform_ht:n { #1 }
+ \c_space_tl depth ~ \pdf_xform_dp:n { #1 }
}
\box_use_drop:N \l__pdf_backend_tmpa_box
- \__pdf_backend:n {put ~ @resources ~<<#3>> }
- \__pdf_backend:n{exobj ~ <<#2>>}
+ \exp_args:Nx\__pdf_backend:n {put ~ @resources ~<<#3>> }
+ \exp_args:Nx\__pdf_backend:n{exobj ~<<#2>>}
}
+
\cs_new:Npn \__pdf_backend_xform_ref:n #1
- { @pdf.xform \int_use:c { g__pdf_backend_xform_ \tl_to_str:n {#1} _int } }
+ { @pdf.xform \int_use:c { c__pdf_backend_xform_ \tl_to_str:n {#1} _int } }
+
\cs_new:Npn \__pdf_backend_xform_use:n #1
{
\hbox_set:Nn \l__pdf_backend_tmpa_box
{
+ \exp_args:Nx
\__pdf_backend:n
{
- uxobj~\__pdf_backend_xform_ref:n { #1 }
+ uxobj~ \__pdf_backend_xform_ref:n { #1 }
}
}
\box_set_wd:Nn \l__pdf_backend_tmpa_box { \pdf_xform_wd:n { #1 } }
@@ -176,6 +176,7 @@
\box_set_dp:Nn \l__pdf_backend_tmpa_box { \pdf_xform_dp:n { #1 } }
\box_use_drop:N \l__pdf_backend_tmpa_box
}
+\cs_new:Npn \xxx_pdfresources: {/ExtGState~@pgfextgs}
}
\ExplSyntaxOff
\begin{document}
@@ -191,7 +192,27 @@
\pdf_object_new:nn {objA}{dict}
\pdf_object_write:nn {objA}{/Type/Artifact}
+A\pdf_xform_new:nnnn{FormA}{/ABC /CDE}{}{ZZZZZZZZZZZZZZ}B\par
+
+C\pdf_xform_use:n{FormA}D \par
+
+
+E\pdf_xform_new:nnnn {FormB}{}{\xxx_pdfresources: /ABC /XYZ}
+ {
+ \csname pdf_bdc:nn\endcsname {Span}{objA}
+ Some Text
+ \csname pdf_emc:\endcsname
+ \quad \tikz\fill[opacity=0.5,red](0,0)rectangle(1,1);
+ \tikz\fill[opacity=1,red](0,0)rectangle(1,1);
+ }F
+
+\par
+
+G\pdf_xform_use:n{FormB}H
\ExplSyntaxOff
+
+
+\end{document}
% \pbs_pdfxform:nnnnn
% #1: add pgf/tikz resources (transparency, shading)? (1|0) %dvipdfmx/xetex
% #2: used as PDF annotation appearance? (1|0) %dvips/pdftex
@@ -199,10 +220,10 @@
% #4: additional dictionary entries
% #5: savebox number
-% xform: immediate or not?
-% argument: a box.
+% xform: immediate or not? -> immediate for now
+% argument: a box / content -> \pdf will use content and put in a hbox
% with dvipdfmx, xform should be in a 0-box.
-% xform attr
+% xform attr:
% pdflatex: attr keyword
% xform resources
% pdflatex: resources keyword
@@ -224,7 +245,7 @@ Some Text \tikz\fill[opacity=0.5,blue](0,0)rectangle(1,1);
% abc\immediate\pdfxform resources {\the\pdfpageresources}
% \testxform abc \par
- \pdf_xform_new:nnnn {test}{}{\xxx_pdfresources:}{Some~Text~ \tikz\fill[opacity=0.5,red](0,0)rectangle(1,1);}
+ \pdf_xform_new:nnnn {test}{/ABC/CDE}{\xxx_pdfresources:}{Some~Text~ \tikz\fill[opacity=0.5,red](0,0)rectangle(1,1);}
xxx\pdf_xform_use:n {test}\par
@@ -279,12 +300,13 @@ abc%
\box_set_ht:Nn \testxform { \c_zero_dim }
-A\pdf_xform_new:nnnn{MyStamp}{}{/ExtGState~@pgfextgs}
+A\pdf_xform_new:nnnn{MyStampB}{/StructParent~1}{/ExtGState~@pgfextgs}
{
\csname pdf_bdc:nn\endcsname {Span}{objA}xxxyyy Some Text \csname pdf_emc:\endcsname \tikz\fill[opacity=0.5,blue](0,0)rectangle(1,1);
}B
-A\pdf_xform_use:n{MyStamp}B
+\par
+AA\pdf_xform_use:n{MyStampB}B
\ExplSyntaxOff
diff --git a/pdfresources.dtx b/pdfresources.dtx
index a965012..92a053e 100644
--- a/pdfresources.dtx
+++ b/pdfresources.dtx
@@ -832,6 +832,7 @@
}
% xetex has so create the entries in the /Properties manually (like the other backends)
% use pdfbase special https://chat.stackexchange.com/transcript/message/50832016#50832016
+% the property is added to xform resources automatically, no need to worry about it.
\sys_if_engine_xetex:T
{
\cs_set_protected:Npn \@@_backend_bdc:nn #1 #2 % #1 eg. Span, #2: object name
More information about the latex3-commits
mailing list