diff options
author | Karl Berry <karl@freefriends.org> | 2018-04-07 20:59:35 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2018-04-07 20:59:35 +0000 |
commit | 514373c000dc69882cdcb746f8a6700a2c4cb5ac (patch) | |
tree | c29d152313383fd77278d1ee678303f7a9e1f242 /Master/texmf-dist/tex/xelatex/xecjk/xunicode-addon.sty | |
parent | eaf6e90613528efb931f436be65eec6b247c7062 (diff) |
xecjk (7apr18)
git-svn-id: svn://tug.org/texlive/trunk@47362 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/xelatex/xecjk/xunicode-addon.sty')
-rw-r--r-- | Master/texmf-dist/tex/xelatex/xecjk/xunicode-addon.sty | 84 |
1 files changed, 48 insertions, 36 deletions
diff --git a/Master/texmf-dist/tex/xelatex/xecjk/xunicode-addon.sty b/Master/texmf-dist/tex/xelatex/xecjk/xunicode-addon.sty index e0c95aaa605..44f922d7dbd 100644 --- a/Master/texmf-dist/tex/xelatex/xecjk/xunicode-addon.sty +++ b/Master/texmf-dist/tex/xelatex/xecjk/xunicode-addon.sty @@ -29,10 +29,10 @@ %% \NeedsTeXFormat{LaTeX2e} \RequirePackage{expl3} -\GetIdInfo$Id: xeCJK.dtx 25e85c2 2018-02-27 02:44:39 +0800 Qing Lee <sobenlee@gmail.com> $ +\GetIdInfo$Id: xeCJK.dtx 2041e49 2018-04-07 17:31:56 +0800 Qing Lee <sobenlee@gmail.com> $ {addon file for xunicode} \ProvidesExplPackage{xunicode-addon} - {\ExplFileDate}{3.6.1}{\ExplFileDescription} + {\ExplFileDate}{3.7.0}{\ExplFileDescription} \bool_lazy_or:nnF { \sys_if_engine_xetex_p: } { \sys_if_engine_luatex_p: } @@ -56,8 +56,8 @@ { \clist_get:NNF \g__xunadd_encname_clist \UTFencname { - \file_if_exist:nTF { tuenc.def } - { \tl_set:Nn \UTFencname { TU } } + \cs_if_exist:NTF \UnicodeEncodingName + { \tl_set:Nx \UTFencname { \UnicodeEncodingName } } { \sys_if_engine_xetex:TF { \tl_set:Nn \UTFencname { EU1 } } @@ -198,8 +198,8 @@ } \RenewDocumentCommand \DeclareUTFcharacter { O { \UTFencname } m m } { - \str_if_eq:nnTF {#3} { \hbar } - { \__xunadd_restore_hbar: } + \cs_if_exist_use:cF + { __xunadd_restore_ \tl_to_str:n {#3} : } { \__xunadd_if_csname:nTF {#3} { \__xunadd_declare_character:Nnn #3 } @@ -207,27 +207,31 @@ {#1} {#2} } } -\cs_new_protected_nopar:Npn \__xunadd_restore_hbar: +\cs_new_protected_nopar:cpn + { __xunadd_restore_ \tl_to_str:n { \hbar } : } + { \__xunadd_restore_cmd:N \hbar } +\cs_new_protected_nopar:cpn + { __xunadd_restore_ \tl_to_str:n { \nobreakspace } : } + { \__xunadd_restore_cmd:N \nobreakspace } +\cs_new_protected_nopar:Npn \__xunadd_restore_cmd:N #1 + { \__xunadd_restore_cmd:Nx #1 { ? - \token_to_str:N #1 } } +\cs_new_protected_nopar:Npn \__xunadd_restore_cmd:Nn #1#2 { - \cs_if_free:cF { ? - \token_to_str:N \hbar } - { \__xunadd_restore_hbar:c { ? - \token_to_str:N \hbar } } + \cs_if_free:cF {#2} + { \__xunadd_restore_cmd:Nc #1 {#2} } } -\cs_new_protected_nopar:Npn \__xunadd_restore_hbar:N #1 +\cs_new_protected_nopar:Npn \__xunadd_restore_cmd:NN #1#2 { - \cs_gset_eq:NN \hbar #1 - \cs_undefine:N #1 + \cs_gset_eq:NN #1 #2 + \cs_undefine:N #2 } -\cs_generate_variant:Nn \__xunadd_restore_hbar:N { c } +\cs_generate_variant:Nn \__xunadd_restore_cmd:Nn { Nx } +\cs_generate_variant:Nn \__xunadd_restore_cmd:NN { Nc } \cs_new_protected:Npn \__xunadd_declare_character:Nnn #1#2#3 { \__xunadd_provide_text_command_default:N #1 - \group_begin: - \char_set_lccode:nn { `0 } { \__xunadd_check_slot:n {#3} } - \tex_lowercase:D - { - \group_end: - \__xunadd_declare_character:NNxn 0 - } + \exp_after:wN \__xunadd_declare_character:NNxn + \utex_char:D \__xunadd_check_slot:n {#3} \exp_stop_f: #1 { \token_to_str:N #1 } {#2} } \cs_generate_variant:Nn \__xunadd_declare_character:Nnn { c } @@ -341,14 +345,9 @@ \cs_generate_variant:Nn \__xunadd_text_composite:Nnn { c } \cs_new_protected:Npn \__xunadd_declare_encoded:NNnnn #1#2#3#4#5 { - \group_begin: - \char_set_lccode:nn { `4 } { \__xunadd_check_slot:n {#4} } - \char_set_lccode:nn { `5 } { \__xunadd_check_slot:n {#5} } - \tex_lowercase:D - { - \group_end: - \__xunadd_declare_encoded:NNNNxx 4 5 - } + \exp_after:wN \__xunadd_declare_encoded:NNNNxx + \utex_char:D \__xunadd_check_slot:n {#4} \exp_after:wN \exp_stop_f: + \utex_char:D \__xunadd_check_slot:n {#5} \exp_stop_f: #1 #2 { \token_to_str:N #2 } {#3} } \cs_new_protected:Npn \__xunadd_declare_encoded:NNNNnn #1#2#3#4#5#6 @@ -529,23 +528,34 @@ \tl_if_blank:nTF {#2} { \IfBooleanTF {#1} - { \tl_set:Nn \l__xunadd_begin_hook_tl {#3} } - { \tl_put_right:Nn \l__xunadd_begin_hook_tl {#3} } + { \xunadd_set_begin_hook:n } + { \xunadd_append_begin_hook:n } } - { \__xunadd_set_cmd_hook:nnn { begin } {#2} {#3} } + { \xunadd_set_begin_hook:nn {#2} } } \NewDocumentCommand \AtEndUTFCommand { s O { } +m } { \tl_if_blank:nTF {#2} { \IfBooleanTF {#1} - { \tl_set:Nn \l__xunadd_end_hook_tl {#3} } - { \tl_put_right:Nn \l__xunadd_end_hook_tl {#3} } + { \xunadd_set_end_hook:n } + { \xunadd_append_end_hook:n } } - { \__xunadd_set_cmd_hook:nnn { end } {#2} {#3} } + { \xunadd_set_begin_hook:nn {#2} } + {#3} } -\tl_new:N \l__xunadd_begin_hook_tl -\tl_new:N \l__xunadd_end_hook_tl +\cs_new_protected_nopar:Npn \xunadd_set_begin_hook:n + { \tl_set:Nn \l__xunadd_begin_hook_tl } +\cs_new_protected_nopar:Npn \xunadd_append_begin_hook:n + { \tl_put_right:Nn \l__xunadd_begin_hook_tl } +\cs_new_protected_nopar:Npn \xunadd_set_end_hook:n + { \tl_set:Nn \l__xunadd_end_hook_tl } +\cs_new_protected_nopar:Npn \xunadd_append_end_hook:n + { \tl_put_right:Nn \l__xunadd_end_hook_tl } +\cs_new_protected_nopar:Npn \xunadd_set_begin_hook:nn + { \__xunadd_set_cmd_hook:nnn { begin } } +\cs_new_protected_nopar:Npn \xunadd_set_end_hook:nn + { \__xunadd_set_cmd_hook:nnn { end } } \cs_new_protected:Npn \__xunadd_set_cmd_hook:nnn #1#2#3 { \cs_set_protected:cpn @@ -560,6 +570,8 @@ { \use:c { __xunadd_#3_csname:n } { \token_to_str:N #1 - \tl_to_str:n {#2} } } \cs_new_nopar:Npn \__xunadd_begin_csname:n #1 { __xunadd_begin_#1_hook:n } \cs_new_nopar:Npn \__xunadd_end_csname:n #1 { __xunadd_end_#1_hook:n } +\tl_new:N \l__xunadd_begin_hook_tl +\tl_new:N \l__xunadd_end_hook_tl \cs_new_protected:Npn \__xunadd_begin_hook:nn #1#2 { \tl_use:N \l__xunadd_begin_hook_tl |