[latex3-commits] [git/LaTeX3-latex3-pdfresources] testlink: correct dvips route for pdf names (eee5fbf)

Ulrike Fischer fischer at troubleshooting-tex.de
Wed Mar 17 10:36:37 CET 2021


Repository : https://github.com/latex3/pdfresources
On branch  : testlink
Link       : https://github.com/latex3/pdfresources/commit/eee5fbfcd2f4f5e8e96bcc942c9e0e0b9539fe29

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

commit eee5fbfcd2f4f5e8e96bcc942c9e0e0b9539fe29
Author: Ulrike Fischer <fischer at troubleshooting-tex.de>
Date:   Wed Mar 17 10:36:37 2021 +0100

    correct dvips route for pdf names


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

eee5fbfcd2f4f5e8e96bcc942c9e0e0b9539fe29
 CHANGELOG.md            | 11 +++++++++++
 l3backend-testphase.dtx | 16 ++++++++++++++++
 l3pdftools.dtx          | 11 +++++++++--
 3 files changed, 36 insertions(+), 2 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index b944062..534a44f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -10,6 +10,17 @@ this project uses date-based 'snapshot' version identifiers.
 ### Fixed
 - \pdffield-setup:nn
 
+### Changed
+- \pdf_name_from_unicode_e:n: use cvn operator with dvips
+- \url: it has an optional argument and protocol, formatting command and encoding
+  can be changed.
+- \hyper at linkfile (GoToR links) now use a filespec dictionary. This improves the
+  support for non-ascii files names.   
+
+### Added
+- \hrefurl, \hrefrun, \hrefpdf for better support of non-ascii input and 
+  default options, see the hyperref-generic documentation. 
+
 ## [2021-03-07]
 
 ### Added
diff --git a/l3backend-testphase.dtx b/l3backend-testphase.dtx
index 796ba7f..3c2d4ab 100644
--- a/l3backend-testphase.dtx
+++ b/l3backend-testphase.dtx
@@ -144,6 +144,22 @@
     \directlua { require("l3backend-testphase.lua") }
 %</luatex>
 %    \end{macrocode}
+% \subsection{Converting unicode strings to a pdfname}
+% dvips needs a special function here, so we add this as backend function.
+%    \begin{macrocode}
+%<*pdftex|luatex|dvipdfmx|xdvipdfmx|dvisvgm>
+\cs_new:Npn \__kernel_pdf_name_from_unicode_e:n #1
+  {
+    / \str_convert_pdfname:e { \text_expand:n { #1 } }
+  }
+%</pdftex|luatex|dvipdfmx|xdvipdfmx|dvisvgm>
+%<*dvips>
+\cs_new:Npn \__kernel_pdf_name_from_unicode_e:n #1
+  {
+    ~ ( \text_expand:n { #1 } ) ~ cvn
+  }
+%</dvips>
+%    \end{macrocode}
 % \subsection{Hooks}
 % \subsubsection{Add the \enquote{end run} hooks}
 % Here we add the end run hook to suitable
diff --git a/l3pdftools.dtx b/l3pdftools.dtx
index d1ded16..477802f 100644
--- a/l3pdftools.dtx
+++ b/l3pdftools.dtx
@@ -68,13 +68,20 @@
 %   \cs{pdf_name_from_unicode_e:n}  \Arg{content}
 %  \end{syntax}
 %  This converts \meta{content} to a format suitable for a PDF Name.
-%  It will first expand the content with \cs{text_expand:n} and
+%  The output depends on the backend: For almost all backends
+%  it will first expand the content with \cs{text_expand:n} and
 %  then escape it in the way needed in a PDF Name with
 %  \cs{str_convert_pdfname:e}, and at last prepend a slash before.
 %  Typically such names use only ascii,
 %  but non-ascii is supported, but should be utf8 encoded. For example\\
 %  |\pdf_name_from_unicode_e:n {A~B\c_percent_str C\c_hash_str D€}}|\\
 %   will    output |/A#20B#25C#23D#E2#82#AC|.
+%
+%  With dvips it will expand the content with \cs{text_expand:n} and then wrap it
+%  in a |cvn| operation (\enquote{convert to name}).
+%  So the example above will output |(A B%C#D€) cvn| to
+%  the postscript. The content should not contain unbalanced parentheses with dvips.
+%
 % \end{function}
 % \begin{function}[added=2020-07-04]
 %   {\pdf_string_from_unicode:nnN}
@@ -224,7 +231,7 @@
 
 \cs_new:Npn \pdf_name_from_unicode_e:n #1
   {
-    / \str_convert_pdfname:e { \text_expand:n { #1 } }
+    \__kernel_pdf_name_from_unicode_e:n { #1 }
   }
 
 \cs_generate_variant:Nn \pdf_name_from_unicode_e:n {V}





More information about the latex3-commits mailing list.