[latex3-commits] [git/LaTeX3-latex3-pdfresources] reworking-annot: first step towards pdfstringdef replacement, only some space different (c3c1c11)
Ulrike Fischer
fischer at troubleshooting-tex.de
Sat Jan 9 00:21:28 CET 2021
Repository : https://github.com/latex3/pdfresources
On branch : reworking-annot
Link : https://github.com/latex3/pdfresources/commit/c3c1c11d7ec9f3852a593c2016d42c8962a9e30f
>---------------------------------------------------------------
commit c3c1c11d7ec9f3852a593c2016d42c8962a9e30f
Author: Ulrike Fischer <fischer at troubleshooting-tex.de>
Date: Sat Jan 9 00:21:28 2021 +0100
first step towards pdfstringdef replacement, only some space different
>---------------------------------------------------------------
c3c1c11d7ec9f3852a593c2016d42c8962a9e30f
hyperref-generic.dtx | 91 +++++++++++++++++++++++++++++++++++++++-------------
l3pdftools.dtx | 5 ++-
resave.bat | 8 +----
3 files changed, 74 insertions(+), 30 deletions(-)
diff --git a/hyperref-generic.dtx b/hyperref-generic.dtx
index 9f5a815..30557c3 100644
--- a/hyperref-generic.dtx
+++ b/hyperref-generic.dtx
@@ -651,6 +651,33 @@
% \end{macrocode}
% \end{variable}
%
+% It is still unclear which str convert option is the best in the various
+% places, so we use a variable to allow tests and perhaps external configuration.
+% \begin{variable}
+% {
+% \l_@@_text_enc_uri_print_tl,
+% \l_@@_text_enc_info_print_tl,
+% \l_@@_text_enc_dest_tl,
+% \l_@@_text_enc_dest_print_tl,
+% \l_@@_text_enc_file_print_tl,
+% \l_@@_text_enc_para_print_tl
+% }
+% \begin{macrocode}
+\tl_new:N \l_@@_text_enc_uri_print_tl
+\tl_new:N \l_@@_text_enc_info_print_tl
+\tl_new:N \l_@@_text_enc_dest_tl
+\tl_new:N \l_@@_text_enc_dest_print_tl
+\tl_new:N \l_@@_text_enc_file_print_tl
+\tl_new:N \l_@@_text_enc_para_print_tl
+
+\tl_set:Nn \l_@@_text_enc_uri_print_tl {string-dest-print}
+\tl_set:Nn \l_@@_text_enc_info_print_tl {string-hex-print}
+\tl_set:Nn \l_@@_text_enc_dest_tl {string-dest}
+\tl_set:Nn \l_@@_text_enc_dest_print_tl {string-dest-print}
+\tl_set:Nn \l_@@_text_enc_file_print_tl {string-dest-print}
+\tl_set:Nn \l_@@_text_enc_para_print_tl {string-dest-print}
+% \end{macrocode}
+% \end{variable}
% \begin{variable}{\l_@@_dest_pdfview_tl}
% This hold the destination instructions in a format suitable for
% \cs{pdf_destination:nn}. The special value |fitrbox| indicates a boxed destination.
@@ -732,8 +759,8 @@
% \#2 is str variable,
% \#1 should be
% \begin{tabular}{ll}
-% string-dest-print & \texttt{(lit)} (without BE marker)\\
-% string-dest & \texttt{list} (without BE marker)\\
+% string-dest-print & \texttt{(lit)} (utf8 without BE marker)\\
+% string-dest & \texttt{lit} (utf8 without BE marker)\\
% string-hex-print & \texttt{<HEX>}\\
% string-hex & \texttt{HEX}\\
% string-lit_print & \texttt{(lit)}\\
@@ -763,8 +790,10 @@
\group_end:
\str_set_eq:NN #3 \g_@@_text_tmpa_str
}
-\cs_generate_variant:Nn \@@_text_pdfstring:nnN {xnN,onN}
-
+\cs_generate_variant:Nn \@@_text_pdfstring:nnN {xnN,onN,xoN,ooN,noN}
+% \end{macrocode}
+% !!! temporary until all instances are gone
+% \begin{macrocode}
\cs_new_protected:Npn\Hy at pstringdef #1 #2
{ \@@_text_pdfstring:xnN {#2} {string-lit}#1 }
% \end{macrocode}
@@ -772,7 +801,7 @@
% \begin{macrocode}
\cs_new_protected:Npn \@@_text_pdfstring_info:nN #1 #2
{
- \@@_text_pdfstring:nnN { #1 }{ string-hex-print } #2
+ \@@_text_pdfstring:noN { #1 }{ \l_@@_text_enc_info_print_tl } #2
}
% \end{macrocode}
@@ -1114,7 +1143,10 @@
\Hy at SaveLastskip %defined in hyperref
\Hy at VerboseAnchor{#1} %defined in hyperref, for debugging
%\@@_pstringdef:Nx \l_@@_tmpa_tl { \HyperDestNameFilter{#1} } %
- \@@_text_pdfstring:xnN { \HyperDestNameFilter{#1} } {string-dest} \l_@@_tmpa_tl
+ \@@_text_pdfstring:xoN
+ { \HyperDestNameFilter{#1} }
+ { \l_@@_text_enc_dest_tl }
+ \l_@@_tmpa_tl
\tl_if_eq:NnTF \l_@@_dest_pdfview_tl {fitrbox}
{
\vbox_to_zero:n
@@ -1133,7 +1165,7 @@
}
}
{
- \exp_args:NV \pdf_destination:nf { \l_@@_tmpa_tl } { \l_@@_dest_pdfview_tl } %
+ \exp_args:NV \pdf_destination:nf { \l_@@_tmpa_tl } { \l_@@_dest_pdfview_tl }
}
\Hy at RestoreLastskip %defined in hyperref
\mode_if_horizontal:T { \spacefactor\@savsf }
@@ -1156,10 +1188,10 @@
% {
% \exp_args:No \HyperDestNameFilter { \l_@@_dest_name_tmpa_tl }
% }
- \@@_text_pdfstring:xnN
+ \@@_text_pdfstring:xoN
{ \exp_args:No \HyperDestNameFilter { \l_@@_dest_name_tmpa_tl } }
- {string-dest}
- \l_@@_dest_name_tmpa_tl
+ { \l_@@_text_enc_dest_tl }
+ \l_@@_dest_name_tmpa_tl
}
\exp_args:No
\pdfannot_link_goto_begin:nw { \l_@@_dest_name_tmpa_tl }
@@ -1221,7 +1253,10 @@
{
\group_begin:
%\__hyp_pstringdef:Nx \l_@@_uri_tmpa_tl { #2 }
- \@@_text_pdfstring:xnN { #2} {string-hex-print} \l_@@_uri_tmpa_tl
+ \@@_text_pdfstring:xoN
+ { #2}
+ { \l_@@_text_enc_uri_print_tl }
+ \l_@@_uri_tmpa_tl
%hyper at chars, unneeded as used only once
\cs_set_eq:NN \# \c_hash_str
\cs_set_eq:NN \% \c_percent_str
@@ -1236,7 +1271,7 @@
% the action dictionary has no hook!
/Type/Action~
/S/URI~
- /URI~\l_@@_uri_tmpa_tl~
+ /URI\l_@@_uri_tmpa_tl~
\ifHy at href@ismap
/IsMap~true%
\fi
@@ -1262,22 +1297,28 @@
\tl_set:Nn \l_@@_filename_tmpa_tl { #2 }
\Hy at CleanupFile \l_@@_filename_tmpa_tl
%\__hyp_pstringdef:No \l_@@_filename_tmpa_tl { \l_@@_filename_tmpa_tl }
- \@@_text_pdfstring:onN { \l_@@_filename_tmpa_tl } {string-lit-print} \l_@@_filename_tmpa_tl
+ \@@_text_pdfstring:ooN
+ { \l_@@_filename_tmpa_tl }
+ { \l_@@_text_enc_file_print_tl }
+ \l_@@_filename_tmpa_tl
%\__hyp_pstringdef:Nn \l_@@_dest_name_tmpa_tl { #3 }
- \@@_text_pdfstring:nnN { #3 } {string-dest-print} \l_@@_dest_name_tmpa_tl
+ \@@_text_pdfstring:nnN
+ { #3 }
+ { \l_@@_text_enc_dest_print_tl }
+ \l_@@_dest_name_tmpa_tl
\Hy at MakeRemoteAction
\mode_leave_vertical:
\pdfannot_link:nnn %expansion??
{ GoToR }
{
/A<<
- /F~\l_@@_filename_tmpa_tl
+ /F \l_@@_filename_tmpa_tl
/S/GoToR
\Hy at SetNewWindow
\ifx\\#3\\
/D[\Hy at href@page/\l_@@_dest_pdfremotestartview_tl]
\else
- /D~\l_@@_dest_name_tmpa_tl
+ /D \l_@@_dest_name_tmpa_tl
\fi
\Hy at href@nextactionraw
>>
@@ -1305,9 +1346,15 @@
{
\group_begin:
%\__hyp_pstringdef:Nn \l_@@_filename_tmpa_tl { #1 } %string-hex
- \@@_text_pdfstring:nnN {#1}{string-lit-print} \l_@@_filename_tmpa_tl
+ \@@_text_pdfstring:nnN
+ { #1 }
+ { \l_@@_text_enc_file_print_tl }
+ \l_@@_filename_tmpa_tl
%\__hyp_pstringdef:Nn \l_@@_para_tmpa_tl { #3 } %string-hex
- \@@_text_pdfstring:nnN {#3}{string-lit-print} \l_@@_para_tmpa_tl
+ \@@_text_pdfstring:noN
+ { #3 }
+ { \l_@@_text_enc_para_print_tl }
+ \l_@@_para_tmpa_tl
%\Hy at pstringdef\Hy at pstringF{#1}%
%\Hy at pstringdef\Hy at pstringP{#3}%
\mode_leave_vertical:
@@ -1320,12 +1367,12 @@
\Hy at SetNewWindow
\bool_if:nF
{
- \tl_if_empty_p:N \l_@@_para_tmpa_tl
+ \str_if_eq_p:Vn \l_@@_para_tmpa_tl {()}
||
\pdf_version_compare_p:Nn > {1.9}
}
{
- /Win<</P~\l_@@_para_tmpa_tl~/F~\l_@@_filename_tmpa_tl~>>
+ /Win<</P \l_@@_para_tmpa_tl /F \l_@@_filename_tmpa_tl >>
}
\Hy at href@nextactionraw
>>
@@ -1391,13 +1438,13 @@
,baseurl .code:n =
{
%\__hyp_pstringdef:No \l_@@_tmpa_tl {#1}%
- \@@_text_pdfstring:onN { #1 } {string-lit-print} \l_@@_tmpa_tl
+ \@@_text_pdfstring:ooN { #1 } {\l_@@_text_enc_uri_print_tl} \l_@@_tmpa_tl
\tl_if_empty:NTF \l_@@_tmpa_tl
{
\pdfmanagement_remove:nn {Catalog} { URI }
}
{
- \pdfmanagement_add:nnx {Catalog} { URI }{ <</Base~\l_@@_tmpa_tl>> }
+ \pdfmanagement_add:nnx {Catalog} { URI }{ <</Base \l_@@_tmpa_tl>> }
}
}
,pdfcenterwindow .choice:
diff --git a/l3pdftools.dtx b/l3pdftools.dtx
index ec20f3e..3b199e9 100644
--- a/l3pdftools.dtx
+++ b/l3pdftools.dtx
@@ -295,6 +295,8 @@
% \begin{macro}{ @@_text_convert_string-hex:nN }
% \begin{macro}{ @@_text_convert_string-hex-print:nN }
% \begin{macrocode}
+% TODO Names need a review when it is clear which converters
+% are actually needed
%% string conversions and printing
%% we assume here that the text purify step has been done. The input is
%% a list of (utf8) chars.
@@ -308,7 +310,8 @@
% bookmarks: as pdfoutline uses () currently only utf16 with BE is usable.
% check if one can use HEX too when directly writing the object
-
+% uri: utf16BE/string seems not to work, hex neither
+% utf8/string works
% "input" is utf8 for pdftex, empty (native) for unicode engine
% commands to output literal strings (...)
\sys_if_engine_pdftex:TF
diff --git a/resave.bat b/resave.bat
index 508a478..5948141 100644
--- a/resave.bat
+++ b/resave.bat
@@ -18,10 +18,6 @@ REM Must be checked for correct working or links due to changed encoding.
- ./build/test/ocgcolorlinks.luatex.pdf.fc
- ./build/test/ocgcolorlinks.pdftex.pdf.fc
- ./build/test/ocgcolorlinks.xetex.pdf.fc
- - ./build/test/pdffilelink.luatex.pdf.fc
- - ./build/test/pdffilelink.pdftex.pdf.fc
- - ./build/test/pdffilelink.xetex.pdf.fc
- - ./build/test/viewerpreferences.xetex.pdf.fc
Failed tests for configuration config-luatex:
@@ -31,6 +27,4 @@ Failed tests for configuration config-luatex:
Failed tests for configuration config-dvips:
Check failed with difference files
- - ./build/test-config-dvips/ismap.latexdvips.pdf.fc
- - ./build/test-config-dvips/linkhook.latexdvips.pdf.fc
- - ./build/test-config-dvips/pdffilelink.latexdvips.pdf.fc
+ - ./build/test-config-dvips/pdffilelink.latexdvips.pdf.fc
More information about the latex3-commits
mailing list.