[latex3-commits] [git/LaTeX3-latex3-hyperref] newpdfstringdef: handle unichar (3d4e65c)

Ulrike Fischer fischer at troubleshooting-tex.de
Thu Aug 11 18:44:11 CEST 2022


Repository : https://github.com/latex3/hyperref
On branch  : newpdfstringdef
Link       : https://github.com/latex3/hyperref/commit/3d4e65cec1756247fb0992958b5e427cd8de094c

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

commit 3d4e65cec1756247fb0992958b5e427cd8de094c
Author: Ulrike Fischer <fischer at troubleshooting-tex.de>
Date:   Thu Aug 11 18:44:11 2022 +0200

    handle unichar


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

3d4e65cec1756247fb0992958b5e427cd8de094c
 new-pdfstring.sty | 45 +++++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 43 insertions(+), 2 deletions(-)

diff --git a/new-pdfstring.sty b/new-pdfstring.sty
index fb40e2d..11ec2b3 100644
--- a/new-pdfstring.sty
+++ b/new-pdfstring.sty
@@ -18,7 +18,7 @@
     \edef\8{\string\8}%
     \edef\9{\string\9}%
     \fontencoding{PUTF}%
-    \HyPsd at UTFviii% ??????? only unichar
+    \let\unichar\HyPsd at unichar
     \let\utf at viii@undeferr\HyPsd at utf@viii at undeferr % needed?
     \enc at update
     \@inmathwarn\pdfstringdef
@@ -247,7 +247,7 @@
 
 \ExplSyntaxOff
 \def\HyPsd at expand@utfvii{\ERROR}
-\def\HyPsd at UTFviii{\let\unichar\HyPsd at unichar} %?
+\def\HyPsd at UTFviii{} %?
 
 \def\HyPsd at DieFace#1{%
   \ifnum#1<1 %
@@ -304,6 +304,47 @@
     \fi
 }
 
+\ExplSyntaxOn
+\providecommand\HyPsd at unichar{}
+\bool_lazy_or:nnTF
+  { \sys_if_engine_luatex_p: }
+  { \sys_if_engine_xetex_p: }
+  {
+    \cs_set:Npn \HyPsd at unichar #1 { \char_generate:nn {#1} { 12 } }
+  }
+  {
+    \cs_set:Npn \HyPsd at unichar #1
+      {
+        \use:e
+          {
+            \exp_not:N \HyPsd at unichar@aux
+            \char_to_utfviii_bytes:n {#1}
+          }
+      }
+    \cs_new:Npn \HyPsd at unichar@aux #1#2#3#4
+      {
+        \tl_if_blank:nTF {#2}
+          { \char_generate:nn {#1} { 12 } }
+          {
+            \exp_after:wN \exp_after:wN \exp_after:wN
+              \exp_not:N \char_generate:nn {#1} { 13 }
+            \exp_after:wN \exp_after:wN \exp_after:wN
+              \exp_not:N \char_generate:nn {#2} { 13 }
+            \tl_if_blank:nF {#3}
+              {
+                \exp_after:wN \exp_after:wN \exp_after:wN
+                  \exp_not:N \char_generate:nn {#3} { 13 }
+              }
+            \tl_if_blank:nF {#4}
+              {
+                \exp_after:wN \exp_after:wN \exp_after:wN
+                  \exp_not:N \char_generate:nn {#4} { 13 }
+              }
+          }
+      }
+  }
+\ExplSyntaxOff
+
 \def\HyPsd at UnicodeReplacementCharacter{�}
 
 \def\HyPsd at DieFaceLarge{\ERROR}





More information about the latex3-commits mailing list.