[latex3-commits] [git/LaTeX3-latex3-pdfresources] testlinkstuff: pdfxform (872b762)

Ulrike Fischer fischer at troubleshooting-tex.de
Sat May 11 18:45:57 CEST 2019


Repository : https://github.com/latex3/pdfresources
On branch  : testlinkstuff
Link       : https://github.com/latex3/pdfresources/commit/872b7628f3cf9fbc5e3bae45eb0b117538850b6a

>---------------------------------------------------------------

commit 872b7628f3cf9fbc5e3bae45eb0b117538850b6a
Author: Ulrike Fischer <fischer at troubleshooting-tex.de>
Date:   Sat May 11 18:45:57 2019 +0200

    pdfxform


>---------------------------------------------------------------

872b7628f3cf9fbc5e3bae45eb0b117538850b6a
 hluatex-experimental.def   |    7 ++-
 pdfresources.dtx           |   65 ++++++++++++++++++-
 testfiles/xform.luatex.tpf |  144 ++++++++++++++++++++++++++++++++++++++++++
 testfiles/xform.pvt        |   19 ++++++
 testfiles/xform.tpf        |  149 ++++++++++++++++++++++++++++++++++++++++++++
 5 files changed, 380 insertions(+), 4 deletions(-)

diff --git a/hluatex-experimental.def b/hluatex-experimental.def
index c704df9..0806c8b 100644
--- a/hluatex-experimental.def
+++ b/hluatex-experimental.def
@@ -862,9 +862,10 @@
 \ExplSyntaxOff
 %%% UF removed old atbegshi fix
 
-\def\@Gauge[#1]#2#3#4{% parameters, label, minimum, maximum
-  \Hy at Message{Sorry, pdftex does not support FORM gauges}%
-}
+%\def\@Gauge[#1]#2#3#4{% parameters, label, minimum, maximum
+%  \Hy at Message{Sorry, pdftex does not support FORM gauges}%
+%}
+
 \def\MakeFieldObject#1#2{\sbox0{#1}%
   \immediate\saveboxresource0 %
   \expandafter\edef\csname #2Object\endcsname{%
diff --git a/pdfresources.dtx b/pdfresources.dtx
index d479336..f7b9797 100644
--- a/pdfresources.dtx
+++ b/pdfresources.dtx
@@ -124,6 +124,11 @@
 % Variants which allow also to set the rule spec are perhaps needed too.
 % Currently only pdftex, luatex and xetex are setup. Some commands can probably not be
 % implemented in all drivers.
+% % still needed:
+% % \saveboxresource/ \pdfxform
+% % \lastsavedboxresourceindex / \pdflastxform
+% % \pdf at strcmp??
+% % \pdf at escapestring?? \pdfescapestring
 %    \begin{macrocode}
 %<*package>
 %some variants
@@ -134,7 +139,65 @@
 \cs_new:Npn \driver_pdf_dict_item:nn #1 #2 {/#1~#2~}
 %</package>
 %    \end{macrocode}
-%
+%\subsubsection{pdfxform}
+% as in dvi mode the xform is immediate, let's do it for pdftex/luatex too. If needed
+% a delayed version can be added later.
+%    \begin{macrocode}
+%<*package>
+\prop_new:N \g__driver_pdf_xform_prop
+\sys_if_engine_pdftex:T
+{
+ \cs_new_protected:Npn \driver_pdf_xform_new:nnnN #1 #2 #3 #4 %name, attr, resources, box
+ {
+  \tex_immediate:D \tex_pdfxform:D~attr { #2 }~resources {#3} #4
+  \int_const:cn
+   { c__driver_pdf_xform_ \tl_to_str:n {#1} _int }
+   { \tex_pdflastxform:D }
+  \prop_gput:Nnx \g__driver_pdf_xform_prop {#1}
+   {
+    \tex_pdfxformname:D \int_use:c {c__driver_pdf_xform_ \tl_to_str:n {#1} _int}
+   }
+ }
+
+\cs_new:Npn \driver_pdf_xform_use:n #1
+ {
+  \tex_pdfrefxform:D \int_use:c { c__driver_pdf_xform_ \tl_to_str:n {#1} _int } \scan_stop:
+ }
+\cs_new:Npn \driver_pdf_xform_ref:n #1
+  { \int_use:c { c__driver_pdf_xform_ \tl_to_str:n {#1} _int } ~ 0 ~ R }
+
+\cs_new:Npn \driver_pdf_xform_name_ref:n #1
+  { /Fm\prop_item:Nn \g__driver_pdf_xform_prop {#1} }
+}
+
+%nearly identical but not completly ...
+\sys_if_engine_luatex:T
+{
+ \cs_new_protected:Npn \driver_pdf_xform_new:nnnN #1 #2 #3 #4 %name, attr, resources, box
+ {
+  \tex_immediate:D \tex_pdfxform:D~attr { #2 }~resources {#3} #4
+  \int_const:cn
+   { c__driver_pdf_xform_ \tl_to_str:n {#1} _int }
+   { \tex_pdflastxform:D }
+  \prop_gput:Nnx \g__driver_pdf_xform_prop {#1}
+   {
+    \tex_pdffeedback:D~xformname  \int_use:c {c__driver_pdf_xform_ \tl_to_str:n {#1} _int}
+   }
+ }
+
+\cs_new:Npn \driver_pdf_xform_use:n #1
+ {
+  \tex_pdfrefxform:D \int_use:c { c__driver_pdf_xform_ \tl_to_str:n {#1} _int } \scan_stop:
+ }
+\cs_new:Npn \driver_pdf_xform_ref:n #1
+  { \int_use:c { c__driver_pdf_xform_ \tl_to_str:n {#1} _int } ~ 0 ~ R }
+
+\cs_new:Npn \driver_pdf_xform_name_ref:n #1
+  { /Fm\prop_item:Nn \g__driver_pdf_xform_prop {#1} }
+}
+
+%</package>
+%    \end{macrocode}
 % \subsubsection{driver / pdfpagesattr}
 % pdfpagesattr is a single token register which is output at the end of the compilation.
 % It is normally used only a few times in a document, so it is okay to update the
diff --git a/testfiles/xform.luatex.tpf b/testfiles/xform.luatex.tpf
new file mode 100644
index 0000000..28c0d02
--- /dev/null
+++ b/testfiles/xform.luatex.tpf
@@ -0,0 +1,144 @@
+%PDF-1.5
+%ÌÕÁÔÅØÐÄÆ
+1 0 obj
+<< /Type /XObject /Subtype /Form /FormType 1 /yyy (bla) /BBox [ 0 0 52.603 4.294 ] /Matrix [ 1 0 0 1 0 0 ] /Resources 2 0 R /Length 84 >>         
+stream
+BT
+/F15 9.96264 Tf
+1 0 0 1 0 0 Tm [<0074007400740074007400740074007400740074>]TJ
+ET
+endstream
+endobj
+2 0 obj
+<< /bbb (x) /Font << /F15 3 0 R >> /ProcSet [ /PDF /Text ] >>
+endobj
+6 0 obj
+<< /Length 382 >>        
+stream
+BT
+/F15 9.96264 Tf
+1 0 0 1 148.712 707.125 Tm [<0069003200740069>]TJ
+ET
+q
+1 0 0 1 169.464 707.125 cm
+/Fm1 Do
+Q
+BT
+/F15 9.96264 Tf
+1 0 0 1 225.385 707.125 Tm [<00620051004B0032>-333<0069003200740069>]TJ
+ET
+q
+1 0 0 1 271.083 707.125 cm
+/Fm1 Do
+Q
+BT
+/F15 9.96264 Tf
+1 0 0 1 323.686 707.125 Tm [<0052>-333<0079>-333<005F00660036>83<004B0052>]TJ
+1 0 0 1 303.133 139.255 Tm [<0052>]TJ
+ET
+endstream
+endobj
+5 0 obj
+<< /Type /Page /Contents 6 0 R /Resources 4 0 R /MediaBox [ 0 0 595.276 841.89 ] /Parent 7 0 R >>
+endobj
+4 0 obj
+<< /Font << /F15 3 0 R >> /XObject << /Fm1 1 0 R >> /ProcSet [ /PDF /Text ] >>
+endobj
+8 0 obj
+[ 50 [ 444 ] 54 [ 653 ] 75 [ 833 ] 81 [ 500 500 ] 95 [ 736 ] 98 [ 394 ] 102 [ 500 ] 105 [ 389 ] 116 [ 528 ] 121 [ 500 ] ]
+endobj
+10 0 obj
+<< /Length 16 >>         
+[BINARY STREAM]
+endobj
+11 0 obj
+<< /Subtype /CIDFontType0C /Length 1917 >>       
+[BINARY STREAM]
+endobj
+9 0 obj
+<< /Type /FontDescriptor /FontName /GQWYPI+LMRoman10-Regular /Flags 4 /FontBBox [ -430 -290 1417 1127 ] /Ascent 1127 /CapHeight 683 /Descent -290 /ItalicAngle 0 /StemV 93 /XHeight 431 /FontFile3 11 0 R /CIDSet 10 0 R >>
+endobj
+12 0 obj
+<< /Length 833 >>        
+stream
+%!PS-Adobe-3.0 Resource-CMap
+%%DocumentNeededResources: ProcSet (CIDInit)
+%%IncludeResource: ProcSet (CIDInit)
+%%BeginResource: CMap (TeX-GQWYPI-LMRoman10-Regular-0)
+%%Title: (TeX-GQWYPI-LMRoman10-Regular-0 TeX GQWYPI-LMRoman10-Regular 0)
+%%Version: 1.000
+%%EndComments
+/CIDInit /ProcSet findresource begin
+12 dict begin
+begincmap
+/CIDSystemInfo
+<< /Registry (TeX)
+/Ordering (GQWYPI-LMRoman10-Regular)
+/Supplement 0
+>> def
+/CMapName /TeX-Identity-GQWYPI-LMRoman10-Regular def
+/CMapType 2 def
+1 begincodespacerange
+<0000> <FFFF>
+endcodespacerange
+0 beginbfrange
+endbfrange
+11 beginbfchar
+<0032> <0065>
+<0036> <0046>
+<004B> <006D>
+<0051> <006F>
+<0052> <0031>
+<005F> <0052>
+<0062> <0073>
+<0066> <002F>
+<0069> <0074>
+<0074> <0078>
+<0079> <0030>
+endbfchar
+endcmap
+CMapName currentdict /CMap defineresource pop
+end
+end
+%%EndResource
+%%EOF
+endstream
+endobj
+3 0 obj
+<< /Type /Font /Subtype /Type0 /Encoding /Identity-H /BaseFont /GQWYPI+LMRoman10-Regular /DescendantFonts [ 13 0 R ] /ToUnicode 12 0 R >>
+endobj
+13 0 obj
+<< /Type /Font /Subtype /CIDFontType0 /BaseFont /GQWYPI+LMRoman10-Regular /FontDescriptor 9 0 R /W 8 0 R /CIDSystemInfo << /Registry (Adobe) /Ordering (Identity) /Supplement 0 >> >>
+endobj
+7 0 obj
+<< /Type /Pages  /Count 1 /Kids [ 5 0 R ] >>
+endobj
+14 0 obj
+<< /Type /Catalog /Pages 7 0 R >>
+endobj
+15 0 obj
+<< /Producer (LuaTeX) /Creator (TeX) /Trapped /False >>
+endobj
+xref
+0 16
+0000000000 65535 f 
+0000000020 00000 n 
+0000000284 00000 n 
+0000004351 00000 n 
+0000000915 00000 n 
+0000000802 00000 n 
+0000000361 00000 n 
+0000004702 00000 n 
+0000001009 00000 n 
+0000003223 00000 n 
+0000001146 00000 n 
+0000001222 00000 n 
+0000003458 00000 n 
+0000004504 00000 n 
+0000004762 00000 n 
+0000004812 00000 n 
+trailer
+<< /Size 16 /Root 14 0 R /Info 15 0 R >>
+startxref
+4884
+%%EOF
diff --git a/testfiles/xform.pvt b/testfiles/xform.pvt
new file mode 100644
index 0000000..cf86e00
--- /dev/null
+++ b/testfiles/xform.pvt
@@ -0,0 +1,19 @@
+\input{regression-test}
+\documentclass{article}
+\usepackage{pdfresources}
+\begin{document}
+\START
+text 
+\ExplSyntaxOn
+
+\hbox_set:Nn \l_tmpa_box{xxxxxxxxxx}
+\driver_pdf_xform_new:nnnN  {myxform}{/yyy~(bla)}{/bbb~(x)}\l_tmpa_box
+\driver_pdf_xform_use:n {myxform}~
+some~text~
+\driver_pdf_xform_use:n {myxform}
+~
+~\driver_pdf_xform_ref:n {myxform}
+~\driver_pdf_xform_name_ref:n {myxform}
+\prop_show:N\g__driver_pdf_xform_prop
+\ExplSyntaxOff
+\end{document}
\ No newline at end of file
diff --git a/testfiles/xform.tpf b/testfiles/xform.tpf
new file mode 100644
index 0000000..6b6bf28
--- /dev/null
+++ b/testfiles/xform.tpf
@@ -0,0 +1,149 @@
+%PDF-1.5
+%ÐÔÅØ
+1 0 obj
+<<
+/Type /XObject
+/Subtype /Form
+/yyy (bla)
+/BBox [0 0 52.581 4.289]
+/FormType 1
+/Matrix [1 0 0 1 0 0]
+/Resources 2 0 R
+/Length 68        
+>>
+stream
+1 0 0 1 0 4.289 cm
+BT
+/F8 9.9626 Tf 0 -4.289 Td [(xxxxxxxxxx)]TJ
+ET
+endstream
+endobj
+2 0 obj
+<<
+/bbb (x)
+/Font << /F8 3 0 R >>
+/ProcSet [ /PDF /Text ]
+>>
+endobj
+6 0 obj
+<<
+/Length 279       
+>>
+stream
+BT
+/F8 9.9626 Tf 148.712 707.125 Td [(text)]TJ
+ET
+q
+1 0 0 1 169.468 707.125 cm
+/Fm1 Do
+Q
+BT
+/F8 9.9626 Tf 225.37 707.125 Td [(some)-333(text)]TJ
+ET
+q
+1 0 0 1 271.087 707.125 cm
+/Fm1 Do
+Q
+BT
+/F8 9.9626 Tf 323.668 707.125 Td [(1)-333(0)-334(R/Fm1)]TJ -20.535 -567.87 Td [(1)]TJ
+ET
+endstream
+endobj
+5 0 obj
+<<
+/Type /Page
+/Contents 6 0 R
+/Resources 4 0 R
+/MediaBox [0 0 595.276 841.89]
+/Parent 7 0 R
+>>
+endobj
+4 0 obj
+<<
+/Font << /F8 3 0 R >>
+/XObject << /Fm1 1 0 R >>
+/ProcSet [ /PDF /Text ]
+>>
+endobj
+8 0 obj
+[500 500 500 500 500 500 500 500 500 500 500 277.8 277.8 277.8 777.8 472.2 472.2 777.8 750 708.3 722.2 763.9 680.6 652.8 784.7 750 361.1 513.9 777.8 625 916.7 750 777.8 680.6 777.8 736.1 555.6 722.2 750 750 1027.8 750 750 611.1 277.8 500 277.8 500 277.8 277.8 500 555.6 444.4 555.6 444.4 305.6 500 555.6 277.8 305.6 527.8 277.8 833.3 555.6 500 555.6 527.8 391.7 394.4 388.9 555.6 527.8 722.2 527.8]
+endobj
+9 0 obj
+<<
+/Length1 1518
+/Length2 9999
+/Length3 0
+/Length 11517     
+>>
+[BINARY STREAM]
+endobj
+10 0 obj
+<<
+/Type /FontDescriptor
+/FontName /QCAGBA+CMR10
+/Flags 4
+/FontBBox [-40 -250 1009 750]
+/Ascent 694
+/CapHeight 683
+/Descent -194
+/ItalicAngle 0
+/StemV 69
+/XHeight 431
+/CharSet (/F/R/e/m/o/one/s/slash/t/x/zero)
+/FontFile 9 0 R
+>>
+endobj
+3 0 obj
+<<
+/Type /Font
+/Subtype /Type1
+/BaseFont /QCAGBA+CMR10
+/FontDescriptor 10 0 R
+/FirstChar 47
+/LastChar 120
+/Widths 8 0 R
+>>
+endobj
+7 0 obj
+<<
+/Type /Pages
+/Count 1
+/Kids [5 0 R]
+>>
+endobj
+11 0 obj
+<<
+/Type /Catalog
+/Pages 7 0 R
+>>
+endobj
+12 0 obj
+<<
+/Producer (pdfTeX)
+/Creator (TeX)
+/Trapped /False
+>>
+endobj
+xref
+0 13
+0000000000 65535 f 
+0000000015 00000 n 
+0000000258 00000 n 
+0000013148 00000 n 
+0000000782 00000 n 
+0000000671 00000 n 
+0000000334 00000 n 
+0000013286 00000 n 
+0000000875 00000 n 
+0000001289 00000 n 
+0000012903 00000 n 
+0000013343 00000 n 
+0000013393 00000 n 
+trailer
+<< /Size 13
+/Root 11 0 R
+/Info 12 0 R
+ >>
+startxref
+13465
+%%EOF





More information about the latex3-commits mailing list