Skip to content

Commit

Permalink
correct dvips route for pdf names
Browse files Browse the repository at this point in the history
  • Loading branch information
u-fischer committed Mar 17, 2021
1 parent d5df2b2 commit eee5fbf
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 2 deletions.
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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@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
Expand Down
16 changes: 16 additions & 0 deletions l3backend-testphase.dtx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 9 additions & 2 deletions l3pdftools.dtx
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down Expand Up @@ -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}
Expand Down

0 comments on commit eee5fbf

Please sign in to comment.