[latex3-commits] [git/LaTeX3-latex3-pdfresources] backendtest: info dictionary (bc98477)

Ulrike Fischer fischer at troubleshooting-tex.de
Sat Jun 22 17:05:55 CEST 2019


Repository : https://github.com/latex3/pdfresources
On branch  : backendtest
Link       : https://github.com/latex3/pdfresources/commit/bc984775d1792c990a0ebe94ab329d1fa74107d3

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

commit bc984775d1792c990a0ebe94ab329d1fa74107d3
Author: Ulrike Fischer <fischer at troubleshooting-tex.de>
Date:   Sat Jun 22 17:05:55 2019 +0200

    info dictionary


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

bc984775d1792c990a0ebe94ab329d1fa74107d3
 pdfresources.dtx              | 51 ++++++++++++++++++++++++++++-------------
 testfiles/infodict.luatex.tpf | 53 ++++++++++++++++---------------------------
 testfiles/infodict.pvt        |  9 +++++++-
 testfiles/infodict.tpf        | 46 ++++++++++++-------------------------
 testfiles/infodict.xetex.tpf  | 20 ++++++++--------
 5 files changed, 87 insertions(+), 92 deletions(-)

diff --git a/pdfresources.dtx b/pdfresources.dtx
index d45b81e..a9a1bae 100644
--- a/pdfresources.dtx
+++ b/pdfresources.dtx
@@ -671,7 +671,6 @@
 
 %</package>
 %    \end{macrocode}
-% ===================================
 % \subsection{The info dictionary}
 % \begin{NOTE}{UF}
 % path: Info
@@ -689,10 +688,11 @@
 % We are outputting at the last page -- this needs a second compilation but
 % this is needed anyway.
 % \end{NOTE}
-% \subsubsection{Info /backend}
-% backend code is already in expl3
+% \subsubsection{Info / backend}
+% The backend code is already in expl3. \verb+\__pdf_backend_info_gput:nn+
+% inserts one name/value pair.
 % \subsubsection{Info / management}
-% % \begin{function}[added = 2019-06-22]
+%  \begin{function}[added = 2019-06-22]
 %   {
 %    \pdf_info_gput:nn
 %   }
@@ -702,7 +702,35 @@
 %   Adds |/|\meta{name} and the \meta{value} to the info dictionary.
 %   \meta{name} should be a valid pdf name without the leading slash,
 %   \meta{value} should be a valid pdf value. Any escaping or (re)encoding must be
-%   done explictly. If a \meta{name} is used twice, only the last \meta{value}
+%   done explictly.
+%   The info dictionary expects utf8 in the strings, so a conversion like this is
+%   normally sensible:
+%   \begin{verbatim}
+%   \str_set_convert:Nnnn \l_tmpa_str { Grüße }{ utf8 } {utf8/string}
+%   \pdf_info_string_gput:nn {Title}{\l_tmpa_str}
+%   \end{verbatim}
+%   If a \meta{name} is used twice, only the last \meta{value}
+%   set will be used. The info dictionary is written at the end of the compilation,
+%   so values can be set at any time.
+% \end{function}
+% \begin{function}[added = 2019-06-22]
+%   {
+%    \pdf_info_string_gput:nn
+%   }
+%   \begin{syntax}
+%     \pdf_info_string_gput:nn \Arg{name} \Arg{value}
+%   \end{syntax}
+%   Adds |/|\meta{name} and the \meta{value} surrounded by parentheses to the info dictionary.
+%   \meta{name} should be a valid pdf name without the leading slash,
+%   \meta{value} should be a valid content of pdf string. Any escaping or (re)encoding must be
+%   done explictly.
+%   The info dictionary expects utf8 in the strings, so a conversion like this is
+%   normally sensible:
+%   \begin{verbatim}
+%   \str_set_convert:Nnnn \l_tmpa_str { Grüße }{ utf8 } {utf8/string}
+%   \pdf_info_string_gput:no {Title}{\l_tmpa_str}
+%   \end{verbatim}
+%   If a \meta{name} is used twice, only the last \meta{value}
 %   set will be used. The info dictionary is written at the end of the compilation,
 %   so values can be set at any time.
 % \end{function}
@@ -710,7 +738,6 @@
 %<*package>
 \@@_tree_new:n {Info}
 
-
 \cs_new_protected:Npn \pdf_info_gput:nn #1 #2 %#1 key without /, #2 content
   {
    \@@_tree_gput:nnn {Info}{#1}{#2}
@@ -718,7 +745,7 @@
 
 \cs_generate_variant:Nn \pdf_info_gput:nn {no}
 
-%  should #2 be inside a some escaping command?
+%  should #2 be inside a some escaping command? (no)
 %  hyperref passes them through
 %  \HyXeTeX at CheckUnicode
 %  \HyPsd at XeTeXBigCharstrue
@@ -731,23 +758,15 @@
 
 \cs_generate_variant:Nn \pdf_info_string_gput:nn {no,oo,on}
 
-
-\cs_new_protected:Npn \@@_info_push: %internal, to ensure that it is used only once
- {
-  \prop_map_function:NN  \g_@@_info_prop \@@_backend_info_gput:nn
-  \prop_gclear:N \g_@@_info_prop
- }
-
 % push to the register command / issue the special
 \cs_new_protected:Npn \@@_Info_gpush:
   {
     \prop_map_function:cN  { \@@_tree_prop_name:n {Info} } \@@_backend_info_gput:nn
     \prop_gclear:c { \@@_tree_prop_name:n {Info} }
   }
-%\AtBeginDocument{\@@_info_push:}
 %</package>
 %    \end{macrocode}
-% ================
+% ===================================
 %\subsubsection{pdfxform}
 % \begin{NOTE}{UF}
 %  As in dvi mode the xform is immediate, this is done for pdftex/luatex too. If needed
diff --git a/testfiles/infodict.luatex.tpf b/testfiles/infodict.luatex.tpf
index 87b260b..9943a63 100644
--- a/testfiles/infodict.luatex.tpf
+++ b/testfiles/infodict.luatex.tpf
@@ -14,22 +14,7 @@ endobj
 << /Type /Page /Contents 8 0 R /Resources 6 0 R /MediaBox [ 0 0 595.276 841.89 ] /Parent 10 0 R >>
 endobj
 6 0 obj
-<< /ExtGState 1 0 R /ColorSpace 2 0 R /Pattern 3 0 R /Shading 4 0 R /Properties 5 0 R  /Font << /F25 9 0 R >> /ProcSet [ /PDF /Text ] >>
-endobj
-1 0 obj
-<<  >>
-endobj
-2 0 obj
-<<  >>
-endobj
-3 0 obj
-<<  >>
-endobj
-4 0 obj
-<<  >>
-endobj
-5 0 obj
-<<  >>
+<< /Font << /F25 9 0 R >> /ProcSet [ /PDF /Text ] >>
 endobj
 11 0 obj
 [ 50 [ 444 ] 75 [ 833 ] 81 [ 500 500 ] 98 [ 394 ] 105 [ 389 ] 116 [ 528 ] ]
@@ -100,31 +85,31 @@ endobj
 << /Type /Catalog /Pages 10 0 R >>
 endobj
 18 0 obj
-<< /Producer (LuaTeX)/Title (A Title)/Author (Some Author) /Creator (TeX) /Trapped /False >>
+<< /Producer (LuaTeX)/Title (Gr\303\274\303\237e)/Author (Some Author) /Creator (TeX) /Trapped /False >>
 endobj
 xref
 0 19
-0000000000 65535 f 
-0000000477 00000 n 
-0000000499 00000 n 
-0000000521 00000 n 
-0000000543 00000 n 
-0000000565 00000 n 
+0000000001 65535 f 
+0000000002 00000 f 
+0000000003 00000 f 
+0000000004 00000 f 
+0000000005 00000 f 
+0000000000 00000 f 
 0000000325 00000 n 
 0000000211 00000 n 
 0000000020 00000 n 
-0000003323 00000 n 
-0000003676 00000 n 
-0000000587 00000 n 
-0000002251 00000 n 
-0000000679 00000 n 
-0000000754 00000 n 
-0000002487 00000 n 
-0000003476 00000 n 
-0000003737 00000 n 
-0000003788 00000 n 
+0000003129 00000 n 
+0000003482 00000 n 
+0000000393 00000 n 
+0000002057 00000 n 
+0000000485 00000 n 
+0000000560 00000 n 
+0000002293 00000 n 
+0000003282 00000 n 
+0000003543 00000 n 
+0000003594 00000 n 
 trailer
 << /Size 19 /Root 17 0 R /Info 18 0 R >>
 startxref
-3897
+3715
 %%EOF
diff --git a/testfiles/infodict.pvt b/testfiles/infodict.pvt
index 32b635d..936173b 100644
--- a/testfiles/infodict.pvt
+++ b/testfiles/infodict.pvt
@@ -3,7 +3,14 @@
 \input{regression-test}
 \documentclass{article}
 \ExplSyntaxOn
-\pdf_info_string_gput:nn {Title}{A~Title}
+\sys_if_engine_pdftex:TF
+{
+ \str_set_convert:Nnnn \l_tmpa_str { Grüße }{ utf8 } {utf8/string}
+}
+{
+ \str_set_convert:Nnnn \l_tmpa_str { Grüße }{  } {utf8/string}
+} 
+\pdf_info_string_gput:no {Title}{\l_tmpa_str}
 \pdf_info_string_gput:nn {Author}{Some~Author}
 \ExplSyntaxOff
 \begin{document}
diff --git a/testfiles/infodict.tpf b/testfiles/infodict.tpf
index b54149b..d78107e 100644
--- a/testfiles/infodict.tpf
+++ b/testfiles/infodict.tpf
@@ -21,26 +21,10 @@ endobj
 endobj
 6 0 obj
 <<
-/ExtGState 1 0 R /ColorSpace 2 0 R /Pattern 3 0 R /Shading 4 0 R /Properties 5 0 R 
 /Font << /F8 9 0 R >>
 /ProcSet [ /PDF /Text ]
 >>
 endobj
-1 0 obj
-<<  >>
-endobj
-2 0 obj
-<<  >>
-endobj
-3 0 obj
-<<  >>
-endobj
-4 0 obj
-<<  >>
-endobj
-5 0 obj
-<<  >>
-endobj
 11 0 obj
 [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
@@ -95,34 +79,34 @@ endobj
 endobj
 15 0 obj
 <<
-/Producer (pdfTeX)/Title (A Title)/Author (Some Author)
+/Producer (pdfTeX)/Title (Gr\303\274\303\237e)/Author (Some Author)
 /Creator (TeX)
 /Trapped /False
 >>
 endobj
 xref
 0 16
-0000000000 65535 f 
-0000000427 00000 n 
-0000000449 00000 n 
-0000000471 00000 n 
-0000000493 00000 n 
-0000000515 00000 n 
+0000000001 65535 f 
+0000000002 00000 f 
+0000000003 00000 f 
+0000000004 00000 f 
+0000000005 00000 f 
+0000000000 00000 f 
 0000000276 00000 n 
 0000000164 00000 n 
 0000000015 00000 n 
-0000012014 00000 n 
-0000012153 00000 n 
-0000000537 00000 n 
-0000000944 00000 n 
-0000011783 00000 n 
-0000012211 00000 n 
-0000012262 00000 n 
+0000011820 00000 n 
+0000011959 00000 n 
+0000000343 00000 n 
+0000000750 00000 n 
+0000011589 00000 n 
+0000012017 00000 n 
+0000012068 00000 n 
 trailer
 << /Size 16
 /Root 14 0 R
 /Info 15 0 R
  >>
 startxref
-12371
+12189
 %%EOF
diff --git a/testfiles/infodict.xetex.tpf b/testfiles/infodict.xetex.tpf
index 24dba61..ed0aa7b 100644
--- a/testfiles/infodict.xetex.tpf
+++ b/testfiles/infodict.xetex.tpf
@@ -16,7 +16,7 @@ endobj
 <</Type/Pages/Count 1/Kids[3 0 R]/MediaBox[0 0 595.28 841.89]>>
 endobj
 2 0 obj
-<</Creator(TeX)/Producer(xdvipdfmx)/Title(A Title)/Author(Some Author)/CreationDate(D:20160520090000-00'00')>>
+<</Creator(TeX)/Title<feff0047007200fc00df0065>/Author(Some Author)/Producer(xdvipdfmx)/CreationDate(D:20160520090000-00'00')>>
 endobj
 1 0 obj
 <</Pages 8 0 R/Type/Catalog>>
@@ -79,22 +79,22 @@ endobj
 xref
 0 14
 0000000000 65535 f 
-0000000559 00000 n 
+0000000576 00000 n 
 0000000433 00000 n 
 0000000279 00000 n 
-0000002684 00000 n 
-0000003134 00000 n 
+0000002701 00000 n 
+0000003151 00000 n 
 0000000015 00000 n 
 0000000201 00000 n 
 0000000354 00000 n 
-0000000604 00000 n 
-0000002873 00000 n 
-0000001093 00000 n 
-0000002553 00000 n 
-0000002620 00000 n 
+0000000621 00000 n 
+0000002890 00000 n 
+0000001110 00000 n 
+0000002570 00000 n 
+0000002637 00000 n 
 trailer
 <</Root 1 0 R/Info 2 0 R/ID[<736b672455ecf863cca2980d059cc169><736b672455ecf863cca2980d059cc169>]/Size
 14>>
 startxref
-3282
+3299
 %%EOF





More information about the latex3-commits mailing list