diff options
Diffstat (limited to 'Master/texmf-dist/tex/xelatex/xecjk/xunicode-addon.sty')
-rw-r--r-- | Master/texmf-dist/tex/xelatex/xecjk/xunicode-addon.sty | 118 |
1 files changed, 90 insertions, 28 deletions
diff --git a/Master/texmf-dist/tex/xelatex/xecjk/xunicode-addon.sty b/Master/texmf-dist/tex/xelatex/xecjk/xunicode-addon.sty index d013fea26d2..66817b79bf6 100644 --- a/Master/texmf-dist/tex/xelatex/xecjk/xunicode-addon.sty +++ b/Master/texmf-dist/tex/xelatex/xecjk/xunicode-addon.sty @@ -6,7 +6,7 @@ %% %% xeCJK.dtx (with options: `xunicode') %% -%% $Id: xeCJK.dtx 477 2013-07-25 22:15:20Z sobenlee $ +%% $Id: xeCJK.dtx 510 2013-08-15 23:20:17Z sobenlee $ %% $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ %% ----------------------------------------------------------------- %% Author: @@ -33,11 +33,11 @@ %% \NeedsTeXFormat{LaTeX2e} \RequirePackage{expl3} -\GetIdInfo$Id: xeCJK.dtx 477 2013-07-25 22:15:20Z sobenlee $ +\GetIdInfo$Id: xeCJK.dtx 510 2013-08-15 23:20:17Z sobenlee $ {addon file for xunicode} \ProvidesExplPackage {xunicode-addon} - {\ExplFileDate}{3.2.5}{\ExplFileDescription} + {\ExplFileDate}{3.2.6}{\ExplFileDescription} \pdftex_if_engine:T { \msg_new:nnnn { xunicode-addon } { cannot-use-pdftex } @@ -147,7 +147,7 @@ { \__xunadd_if_csname:nTF {#3} { \__xunadd_declare_character:Nnn #3 } - { \exp_args:Nc \__xunadd_declare_character:Nnn { \tl_to_str:n {#3} } } + { \__xunadd_declare_character:cnn { \tl_to_str:n {#3} } } {#1} {#2} } \cs_new_protected:Npn \__xunadd_declare_character:Nnn #1#2#3 @@ -162,6 +162,7 @@ } #1 { \token_to_str:N #1 } {#2} } +\cs_generate_variant:Nn \__xunadd_declare_character:Nnn { c } \cs_new_protected:Npn \__xunadd_provide_text_command_default:N #1 { \bool_if:nF @@ -175,10 +176,10 @@ { \DeclareTextCommand #2 {#4} { \__xunadd_text_character:nN {#3} {#1} } } \cs_new_protected:Npn \__xunadd_text_character:nN #1#2 { - \tl_use:N \l__xunadd_begin_hook_tl + \__xunadd_begin_hook:nn {#1} {#2} \__xunadd_glyph_if_exist:nTF { `#2 } {#2} { \cs_if_exist_use:cF { ? #1 } {#2} } - \tl_use:N \l__xunadd_end_hook_tl + \__xunadd_end_hook:nn {#1} {#2} } \cs_generate_variant:Nn \__xunadd_declare_character:NNnn { NNx } \cs_new_nopar:Npn \__xunadd_check_slot:n #1 @@ -193,7 +194,7 @@ { \__xunadd_if_csname:nTF {#3} { \__xunadd_declare_composite:Nnnn #3 } - { \exp_args:Nc \__xunadd_declare_composite:Nnnn { \tl_to_str:n {#3} } } + { \__xunadd_declare_composite:cnnn { \tl_to_str:n {#3} } } {#1} {#4} {#2} } \cs_new_protected:Npn \__xunadd_declare_composite:Nnnn #1#2#3#4 @@ -207,18 +208,38 @@ \cs_new_protected:Npn \__xunadd_chardef:Nn #1#2 { \tex_chardef:D #1 = \etex_numexpr:D #2 \scan_stop: } \cs_generate_variant:Nn \__xunadd_chardef:Nn { c } +\cs_generate_variant:Nn \__xunadd_declare_composite:Nnnn { c } +\AtEndOfPackage + { + \DeclareUTFCompositeCommand \tonebar { 25 } { \tonebar { 2 } \tonebar { 5 } } + \DeclareUTFCompositeCommand \tonebar { 52 } { \tonebar { 5 } \tonebar { 2 } } + } +\NewDocumentCommand \DeclareUTFCompositeCommand { O { \UTFencname } m m m } + { + \__xunadd_if_csname:nTF {#2} + { \__xunadd_declare_composite_command:Nnnn #2 } + { \__xunadd_declare_composite_command:cnnn { \tl_to_str:n {#2} } } + {#1} {#3} {#4} + } +\cs_new_protected:Npn \__xunadd_declare_composite_command:Nnnn #1#2#3#4 + { + \cs_set_protected:cpn + { \token_to_str:c {#2} \token_to_str:N #1 - \tl_to_str:n {#3} } + {#4} + } +\cs_generate_variant:Nn \__xunadd_declare_composite_command:Nnnn { c } \RenewDocumentCommand \DeclareEncodedCompositeCharacter { m m m m } { \__xunadd_if_csname:nTF {#2} { \__xunadd_declare_accent:Nnnn #2 } - { \exp_args:Nc \__xunadd_declare_accent:Nnnn { \tl_to_str:n {#2} } } + { \__xunadd_declare_accent:cnnn { \tl_to_str:n {#2} } } {#1} {#3} {#4} } \RenewDocumentCommand \DeclareEncodedCompositeAccents { m m m m } { \__xunadd_if_csname:nTF {#2} { \__xunadd_declare_accent:Nnnn #2 } - { \exp_args:Nc \__xunadd_declare_accent:Nnnn { \tl_to_str:n {#2} } } + { \__xunadd_declare_accent:cnnn { \tl_to_str:n {#2} } } {#1} {#4} {#3} } \cs_new_protected:Npn \__xunadd_declare_accent:Nnnn #1#2#3#4 @@ -238,24 +259,29 @@ \DeclareTextCommand #3 {#6} { \__xunadd_text_composite:nnNNn {#4} {#5} {#1} {#2} } } +\cs_generate_variant:Nn \__xunadd_declare_accent:Nnnn { c } \cs_generate_variant:Nn \__xunadd_declare_accent:NNNnnn { NNNxx } \cs_new_protected:Npn \__xunadd_text_composite:nnNNn #1#2#3#4#5 { - \tl_use:N \l__xunadd_begin_hook_tl + \__xunadd_begin_hook:nn {#2} {#5} \cs_if_exist:cTF { #1#2 - \tl_to_str:n {#5} } { - \token_if_chardef:cTF { #1#2 - \tl_to_str:n {#5} } - { - \__xunadd_glyph_if_exist:nTF { \use:c { #1#2 - \tl_to_str:n {#5} } } - { \use:c { #1#2 - \tl_to_str:n {#5} } } - { \__xunadd_add_accent:nnNN {#5} {#2} #3#4 } - } - { \use:c { #1#2 - \tl_to_str:n {#5} } } + \__xunadd_text_composite_aux:cnNNn + { #1#2 - \tl_to_str:n {#5} } {#2} {#3} {#4} {#5} } - { \__xunadd_add_accent:nnNN {#5} {#2} #3#4 } - \tl_use:N \l__xunadd_end_hook_tl + { \__xunadd_add_accent:nnNN {#5} {#2} {#3} {#4} } + \__xunadd_end_hook:nn {#2} {#5} } -\cs_generate_variant:Nn \token_if_chardef:NTF { c } +\cs_new_protected:Npn \__xunadd_text_composite_aux:NnNNn #1#2#3#4#5 + { + \token_if_chardef:NTF #1 + { + \__xunadd_glyph_if_exist:nTF {#1} + {#1} { \__xunadd_add_accent:nnNN {#5} {#2} {#3} {#4} } + } + {#1} + } +\cs_generate_variant:Nn \__xunadd_text_composite_aux:NnNNn { c } \cs_new_protected:Npn \__xunadd_add_accent:nnNN #1#2#3#4 { \tl_if_blank:nTF {#1} @@ -280,20 +306,56 @@ } } } -\NewDocumentCommand \AtBeginUTFCommand { s +m } +\NewDocumentCommand \AtBeginUTFCommand { s O { } +m } { - \IfBooleanTF {#1} - { \tl_set:Nn \l__xunadd_begin_hook_tl {#2} } - { \tl_put_right:Nn \l__xunadd_begin_hook_tl {#2} } + \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_cmd_hook:nnn { begin } {#2} {#3} } } -\NewDocumentCommand \AtEndUTFCommand { s +m } +\NewDocumentCommand \AtEndUTFCommand { s O { } +m } { - \IfBooleanTF {#1} - { \tl_set:Nn \l__xunadd_end_hook_tl {#2} } - { \tl_put_right:Nn \l__xunadd_end_hook_tl {#2} } + \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_cmd_hook:nnn { end } {#2} {#3} } } \tl_new:N \l__xunadd_begin_hook_tl \tl_new:N \l__xunadd_end_hook_tl +\cs_new_protected:Npn \__xunadd_set_cmd_hook:nnn #1#2#3 + { + \cs_set_protected:cpn + { + \tl_if_single:nTF {#2} + { \use:c { __xunadd_#1_csname:n } { \token_to_str:N #2 } } + { \__xunadd_set_cmd_hook_aux:Nnwn #2 \q_stop {#1} } + } ##1 + {#3} + } +\cs_new:Npn \__xunadd_set_cmd_hook_aux:Nnwn #1#2 \q_stop #3 + { \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 } +\cs_new_protected:Npn \__xunadd_begin_hook:nn #1#2 + { + \tl_use:N \l__xunadd_begin_hook_tl + \cs_if_exist_use:cF { \__xunadd_begin_csname:n { #1 - \tl_to_str:n {#2} } } + { \cs_if_exist_use:cF { \__xunadd_begin_csname:n {#1} } { \use_none:n } } + {#2} + } +\cs_new_protected:Npn \__xunadd_end_hook:nn #1#2 + { + \cs_if_exist_use:cF { \__xunadd_end_csname:n { #1 - \tl_to_str:n {#2} } } + { \cs_if_exist_use:cF { \__xunadd_end_csname:n {#1} } { \use_none:n } } + {#2} + \tl_use:N \l__xunadd_end_hook_tl + } %% %% This package consists of the file xeCJK.dtx, %% full-stop.map, |