From 54b3f2d277e2a2359cd249de2055ae706214c4be Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Fri, 14 Dec 2012 00:12:28 +0000 Subject: xecjk (13dec12) git-svn-id: svn://tug.org/texlive/trunk@28528 c570f23f-e606-0410-a88d-b1316a301751 --- .../texmf-dist/tex/xelatex/xecjk/config/xeCJK.cfg | 5 +- Master/texmf-dist/tex/xelatex/xecjk/xeCJK.sty | 996 ++++++++++++++------- Master/texmf-dist/tex/xelatex/xecjk/xeCJKfntef.sty | 339 +++++++ 3 files changed, 996 insertions(+), 344 deletions(-) create mode 100644 Master/texmf-dist/tex/xelatex/xecjk/xeCJKfntef.sty (limited to 'Master/texmf-dist/tex/xelatex/xecjk') diff --git a/Master/texmf-dist/tex/xelatex/xecjk/config/xeCJK.cfg b/Master/texmf-dist/tex/xelatex/xecjk/config/xeCJK.cfg index cf9c3189a7f..4c34f1a2179 100644 --- a/Master/texmf-dist/tex/xelatex/xecjk/config/xeCJK.cfg +++ b/Master/texmf-dist/tex/xelatex/xecjk/config/xeCJK.cfg @@ -6,12 +6,11 @@ %% %% xeCJK.dtx (with options: `config') %% -\NeedsTeXFormat{LaTeX2e} -\GetIdInfo$Id: xeCJK.dtx 368 2012-11-23 04:55:23Z sobenlee $ +\GetIdInfo$Id: xeCJK.dtx 382 2012-12-13 04:58:22Z sobenlee $ {Configuration file for xeCJK package} \ProvidesExplFile {\ExplFileName.cfg} - {\ExplFileDate}{3.1.0}{\ExplFileDescription} + {\ExplFileDate}{3.1.1}{\ExplFileDescription} %% %% diff --git a/Master/texmf-dist/tex/xelatex/xecjk/xeCJK.sty b/Master/texmf-dist/tex/xelatex/xecjk/xeCJK.sty index f6876df0358..6678f7cc805 100644 --- a/Master/texmf-dist/tex/xelatex/xecjk/xeCJK.sty +++ b/Master/texmf-dist/tex/xelatex/xecjk/xeCJK.sty @@ -6,7 +6,7 @@ %% %% xeCJK.dtx (with options: `package') %% -%% $Id: xeCJK.dtx 368 2012-11-23 04:55:23Z sobenlee $ +%% $Id: xeCJK.dtx 382 2012-12-13 04:58:22Z sobenlee $ %% $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ %% ----------------------------------------------------------------- %% Author: @@ -31,11 +31,11 @@ %% \NeedsTeXFormat{LaTeX2e} \RequirePackage{expl3} -\GetIdInfo$Id: xeCJK.dtx 368 2012-11-23 04:55:23Z sobenlee $ +\GetIdInfo$Id: xeCJK.dtx 382 2012-12-13 04:58:22Z sobenlee $ {Typesetting CJK scripts with XeLaTeX} \ProvidesExplPackage {\ExplFileName} - {\ExplFileDate}{3.1.0}{\ExplFileDescription} + {\ExplFileDate}{3.1.1}{\ExplFileDescription} \msg_new:nnn { xeCJK } { Require-XeTeX } { The~xeCJK~package~requires~XeTeX~to~function.\\\\ @@ -58,7 +58,6 @@ \@ifpackagelater { xtemplate } { 2012/11/10 } { } { \msg_error:nnn { xeCJK } { l3-too-old } { xtemplate } } \RequirePackage { xparse , l3keys2e } -\RequirePackage { xpatch } \tl_new:N \l__xeCJK_tmpa_tl \tl_new:N \l__xeCJK_tmpb_tl \int_new:N \l__xeCJK_tmpa_int @@ -66,7 +65,7 @@ \int_new:N \l__xeCJK_tmpc_int \box_new:N \l__xeCJK_tmp_box \dim_new:N \l__xeCJK_tmp_dim -\skip_new:N \g__xeCJK_tmp_skip +\skip_new:N \l__xeCJK_tmp_skip \prop_new:N \l__xeCJK_tmp_prop \clist_new:N \l__xeCJK_tmpa_clist \clist_new:N \l__xeCJK_tmpb_clist @@ -80,6 +79,12 @@ \cs_new_protected_nopar:Npn \__xeCJK_info:nxx { \msg_info:nnxx { xeCJK } } \cs_new_protected_nopar:Npn \xeCJK_allow_break: { \tex_penalty:D \c_zero } \cs_new_protected_nopar:Npn \xeCJK_no_break: { \tex_penalty:D \c_ten_thousand } +\prg_new_conditional:Npnn \xeCJK_if_package_loaded:n #1 { p , T , F , TF } + { + \tl_if_exist:cTF { ver@ #1 . \c__xeCJK_package_ext_tl } + { \prg_return_true: } { \prg_return_false: } + } +\tl_const:Nx \c__xeCJK_package_ext_tl { \@pkgextension } \tl_new:N \g__xeCJK_at_end_preamble_hook_tl \tl_new:N \g__xeCJK_after_preamble_hook_tl \tl_new:N \g__xeCJK_after_end_preamble_hook_tl @@ -89,9 +94,25 @@ { \tl_gput_right:Nn \g__xeCJK_after_preamble_hook_tl {#1} } \cs_new_protected:Npn \__xeCJK_after_end_preamble:n #1 { \tl_gput_right:Nn \g__xeCJK_after_end_preamble_hook_tl {#1} } -\AtEndPreamble { \g__xeCJK_at_end_preamble_hook_tl } -\AfterPreamble { \g__xeCJK_after_preamble_hook_tl } -\AfterEndPreamble { \g__xeCJK_after_end_preamble_hook_tl } +\xeCJK_if_package_loaded:nTF { etoolbox } + { + \AtEndPreamble { \g__xeCJK_at_end_preamble_hook_tl } + \AfterPreamble { \g__xeCJK_after_preamble_hook_tl } + \AfterEndPreamble { \g__xeCJK_after_end_preamble_hook_tl } + } + { + \AtBeginDocument { \g__xeCJK_after_preamble_hook_tl } + \cs_new_protected_nopar:Npn \__xeCJK_document_left_hook: + { \group_end: \g__xeCJK_at_end_preamble_hook_tl \group_begin: } + \cs_new_protected_nopar:Npn \__xeCJK_document_right_hook: + { \scan_stop: \g__xeCJK_after_end_preamble_hook_tl \tex_ignorespaces:D } + \cs_gset_nopar:Npx \document + { + \__xeCJK_document_left_hook: + \exp_not:o { \document } + \__xeCJK_document_right_hook: + } + } \cs_new_nopar:Npn \xeCJK_reverse:nnn #1#2#3 { \str_if_eq_x:nnTF {#1} {#2} {#3} {#2} } \cs_new_protected_nopar:Npn \xeCJK_tl_remove_outer_braces:N #1 @@ -104,24 +125,6 @@ { \__xeCJK_tl_remove_outer_braces:w #1 \q_stop } { \tl_trim_spaces:n {#1} } } -\cs_new_protected:Npn \xeCJK_cs_add:Nnn #1#2#3 - { - \tl_if_empty:nTF {#3} - { \tl_if_empty:nTF {#2} { \use_ii:nn } { \xpretocmd {#1} {#2} } } - { - \tl_if_empty:nTF {#2} { \xapptocmd {#1} {#3} } - { \xpretocmd {#1} {#2} { \xapptocmd {#1} {#3} } { \use_ii:nn } } - } - { \__xeCJK_info:nxx { patch-cmd } { \token_to_str:N #1 } { succeeded } } - { \__xeCJK_warning:nxx { patch-cmd } { \token_to_str:N #1 } { failed } } - } -\cs_new_protected:Npn \xeCJK_cs_patch:Nnn #1#2#3 - { - \xpatchcmd {#1} {#2} {#3} - { \__xeCJK_info:nxx { patch-cmd } { \token_to_str:N #1 } { succeeded } } - { \__xeCJK_warning:nxx { patch-cmd } { \token_to_str:N #1 } { failed } } - } -\__xeCJK_msg_new:nn { patch-cmd } { Patching~'#1'~#2! } \cs_new_eq:NN \xeCJK_cs_clear:N \tl_clear:N \cs_new_eq:NN \xeCJK_cs_gclear:N \tl_gclear:N \cs_new_protected:Npn \xeCJK_swap_cs:NN #1#2 @@ -153,30 +156,77 @@ } \cs_new_protected_nopar:Npn \xeCJK_glue_to_skip:nN #1#2 { - \hbox_set:Nn \l__xeCJK_tmp_box - { #1 \skip_gset_eq:NN \g__xeCJK_tmp_skip \tex_lastskip:D } - \skip_set_eq:NN #2 \g__xeCJK_tmp_skip + \hbox_set:Nn \l__xeCJK_tmp_box { #1 \scan_stop: \exp_after:wN } \exp_after:wN + \skip_set:Nn \exp_after:wN #2 \exp_after:wN { \skip_use:N \tex_lastskip:D } } \prg_new_conditional:Npnn \xeCJK_if_blank_x:n #1 { p , T , F , TF } { - \if_int_compare:w \pdftex_strcmp:D { \c_empty_tl } {#1} = \c_zero + \if_case:w \pdftex_strcmp:D { } {#1} \exp_stop_f: \prg_return_true: \else: - \if_int_compare:w \pdftex_strcmp:D { \c_space_tl } {#1} = \c_zero + \if_case:w \pdftex_strcmp:D { ~ } {#1} \exp_stop_f: \prg_return_true: \else: \prg_return_false: \fi: \fi: } -\prg_new_conditional:Npnn \xeCJK_if_package_loaded:n #1 { p , T , F , TF } - { - \tl_if_exist:cTF { ver@ #1 . \c__xeCJK_package_ext_tl } - { \prg_return_true: } - { \prg_return_false: } - } -\tl_const:Nx \c__xeCJK_package_ext_tl { \@pkgextension } \cs_new_protected:Npn \xeCJK_int_until_do:nn #1#2 { \__xeCJK_int_until_do:wn \use_none:n { \reverse_if:N \if_int_compare:w #1#2 } } \cs_new_protected:Npn \__xeCJK_int_until_do:wn \use_none:n #1 { #1 \exp_after:wN \__xeCJK_int_until_do:wn \fi: \use_none:n {#1} } +\cs_new_protected:Npn \xeCJK_peek_catcode_ignore_spaces:NTF #1#2#3 + { + \cs_set_eq:NN \l__peek_search_token #1 \scan_stop: + \tl_set:Nn \__xeCJK_peek_catcode_true:w { \group_align_safe_end: #2 } + \tl_set:Nn \__xeCJK_peek_catcode_false:w { \group_align_safe_end: #3 } + \bool_set_false:N \l__xeCJK_peek_ignore_spaces_bool + \group_align_safe_begin: + \peek_after:Nw \__xeCJK_peek_catcode_ignore_spaces_branches:w + } +\cs_new_protected_nopar:Npn \__xeCJK_peek_catcode_ignore_spaces_branches:w + { + \if_meaning:w \l_peek_token \c_space_token + \bool_set_true:N \l__xeCJK_peek_ignore_spaces_bool + \exp_after:wN \peek_after:Nw + \exp_after:wN \__xeCJK_peek_catcode_ignore_spaces_branches:w + \tex_romannumeral:D 0 + \else: + \if_catcode:w + \exp_not:N \l_peek_token \exp_not:N \l__peek_search_token + \exp_after:wN \exp_after:wN + \exp_after:wN \__xeCJK_peek_catcode_true:w + \else: + \exp_after:wN \exp_after:wN + \exp_after:wN \__xeCJK_peek_catcode_false:w + \fi: + \fi: + } +\bool_new:N \l__xeCJK_peek_ignore_spaces_bool +\cs_new_protected:Npn \xeCJK_peek_after_ignore_spaces:nw #1 + { + \tl_set:Nn \__xeCJK_peek_after_do:w { \group_align_safe_end: #1 } + \group_align_safe_begin: + \peek_after:Nw \__xeCJK_peek_ignore_spaces_branches:w + } +\cs_new_protected_nopar:Npn \__xeCJK_peek_ignore_spaces_branches:w + { + \if_meaning:w \l_peek_token \c_space_token + \exp_after:wN \peek_after:Nw + \exp_after:wN \__xeCJK_peek_ignore_spaces_branches:w + \tex_romannumeral:D 0 + \else: + \exp_after:wN \__xeCJK_peek_after_do:w + \fi: + } +\cs_new_nopar:Npn \xeCJK_token_value_class:N #1 + { \XeTeXcharclass \xeCJK_token_value_charcode:N #1 } +\cs_new_nopar:Npn \xeCJK_token_value_charcode:N #1 + { \exp_after:wN \__xeCJK_token_value_charcode:w \token_to_meaning:N #1 \q_stop } +\cs_new_nopar:Npn \__xeCJK_token_value_charcode:w #1 ~ #2 ~ #3 \q_stop { `#3 } +\prg_new_conditional:Npnn \xeCJK_if_same_class:NN #1#2 { p , T , F , TF } + { + \if_int_compare:w + \xeCJK_token_value_class:N #1 = \xeCJK_token_value_class:N #2 \exp_stop_f: + \prg_return_true: \else: \prg_return_false: \fi: + } \keys_define:nn { xeCJK / options } { xeCJKactive .choice: , @@ -187,18 +237,41 @@ \NewDocumentCommand \makexeCJKactive { } { \XeTeXinterchartokenstate = \c_one } \NewDocumentCommand \makexeCJKinactive { } { \XeTeXinterchartokenstate = \c_zero } \char_set_catcode_ignore:n { "FEFF } -\int_const:Nn \c__xeCJK_Default_class_int { \c_zero } -\int_const:Nn \c__xeCJK_CJK_class_int { \c_one } -\int_const:Nn \c__xeCJK_FullLeft_class_int { \c_two } -\int_const:Nn \c__xeCJK_FullRight_class_int { \c_three } -\int_const:Nn \c__xeCJK_Boundary_class_int { \c_two_hundred_fifty_five } +\seq_new:N \g__xeCJK_class_seq +\seq_new:N \g__xeCJK_new_class_seq \cs_new_protected_nopar:Npn \xeCJK_new_class:n #1 { - \exp_args:Nc \newXeTeXintercharclass { c__xeCJK_#1_class_int } - \clist_gclear_new:c { g__xeCJK_#1_range_clist } - \seq_gput_right:Nv \g__xeCJK_class_seq { c__xeCJK_#1_class_int } + \int_if_exist:cTF { \__xeCJK_class_csname:n {#1} } + { \__xeCJK_error:nx { class-already-defined } {#1} } + { + \exp_args:Nc \newXeTeXintercharclass { \__xeCJK_class_csname:n {#1} } + \clist_new:c { g__xeCJK_#1_range_clist } + \seq_gput_right:Nn \g__xeCJK_class_seq {#1} + \seq_gput_right:Nv \g__xeCJK_new_class_seq { \__xeCJK_class_csname:n {#1} } + } } -\seq_new:N \g__xeCJK_class_seq +\cs_new_protected_nopar:Npn \xeCJK_save_class:nn #1#2 + { + \int_if_exist:cTF { \__xeCJK_class_csname:n {#1} } + { \__xeCJK_error:nx { class-already-defined } {#1} } + { + \int_const:cn { \__xeCJK_class_csname:n {#1} } {#2} + \clist_new:c { g__xeCJK_#1_range_clist } + \seq_gput_right:Nn \g__xeCJK_class_seq {#1} + } + } +\cs_new_nopar:Npn \__xeCJK_class_csname:n #1 { c__xeCJK_#1_class_int } +\cs_new_eq:cN { \__xeCJK_class_csname:n { Others } } \l__xeCJK_tmpa_int +\__xeCJK_msg_new:nn { class-already-defined } + { + XeTeX~character~class~`#1'~has~been~already~defined.\\\\ + Please~take~another~name. \\ + } +\xeCJK_save_class:nn { Default } { \c_zero } +\xeCJK_save_class:nn { CJK } { \c_one } +\xeCJK_save_class:nn { FullLeft } { \c_two } +\xeCJK_save_class:nn { FullRight } { \c_three } +\xeCJK_save_class:nn { Boundary } { \c_two_hundred_fifty_five } \xeCJK_new_class:n { HalfLeft } \xeCJK_new_class:n { HalfRight } \xeCJK_new_class:n { NormalSpace } @@ -263,30 +336,23 @@ "2F800 -> "2FA1F } \seq_new:N \g__xeCJK_base_class_seq -\seq_gset_split:Nnn \g__xeCJK_base_class_seq { , } - { - Default , CJK , FullLeft , FullRight , Boundary , - HalfLeft , HalfRight , NormalSpace - } -\seq_map_inline:Nn \g__xeCJK_base_class_seq - { \clist_gclear_new:c { g__xeCJK_#1_range_clist } } +\seq_gset_eq:NN \g__xeCJK_base_class_seq \g__xeCJK_class_seq +\seq_new:N \g__xeCJK_non_CJK_class_seq +\seq_gset_from_clist:Nn \g__xeCJK_non_CJK_class_seq + { Default , HalfLeft , HalfRight , NormalSpace , Boundary } \seq_new:N \g__xeCJK_CJK_class_seq \prop_new:N \g__xeCJK_CJK_class_prop \cs_new_protected_nopar:Npn \__xeCJK_save_CJK_class:n #1 { \seq_gput_right:Nn \g__xeCJK_CJK_class_seq {#1} - \prop_gput:Nvn \g__xeCJK_CJK_class_prop { c__xeCJK_#1_class_int } {#1} + \prop_gput:Nvn \g__xeCJK_CJK_class_prop { \__xeCJK_class_csname:n {#1} } {#1} + \tl_gput_right:Nx \g__xeCJK_check_single_CJK_case_tl + { { \exp_not:c { \__xeCJK_class_csname:n {#1} } } { \exp_not:N \use_ii:nn } } } +\tl_new:N \g__xeCJK_check_single_CJK_case_tl \cs_generate_variant:Nn \prop_gput:Nnn { Nvn } \clist_map_function:nN { CJK , FullLeft , FullRight } \__xeCJK_save_CJK_class:n -\cs_new_nopar:Npn \xeCJK_class_num:n #1 { \use:c { c__xeCJK_#1_class_int } } -\cs_new_nopar:Npn \xeCJK_value_class:n #1 - { \XeTeXcharclass \etex_numexpr:D #1 \scan_stop: } -\prg_new_conditional:Npnn \xeCJK_if_same_class:NN #1#2 { p , T , F , TF } - { - \if_int_compare:w \xeCJK_value_class:n {`#1} = \xeCJK_value_class:n {`#2} - \prg_return_true: \else: \prg_return_false: \fi: - } +\cs_new_nopar:Npn \xeCJK_class_num:n #1 { \use:c { \__xeCJK_class_csname:n {#1} } } \NewDocumentCommand \xeCJKDeclareCharClass { s > { \TrimSpaces } m m } { \xeCJK_declare_char_class:nx {#2} {#3} @@ -310,16 +376,12 @@ { m > { \SplitArgument { 1 } { -> } } m } { #1 #2 } \cs_generate_variant:Nn \clist_gconcat:NNN { cc } \cs_generate_variant:Nn \xeCJK_declare_char_class:nn { nx , nV } -\NewDocumentCommand \xeCJKsetcharclass { s m m m } - { - \xeCJK_set_char_class:nnn {#2} {#3} {#4} - \IfBooleanF {#1} { \xeCJKResetPunctClass } - } -\cs_new_protected_nopar:Npn \xeCJK_set_char_class:nnn #1#2#3 +\cs_new_protected_nopar:Npn \__xeCJK_set_char_class_catcode:nnn #1#2#3 { \__xeCJK_check_num_range:nnNN {#1} {#2} \l__xeCJK_tmpa_int \l__xeCJK_tmpb_int \int_set:Nn \l__xeCJK_tmpc_int {#3} - \prop_get:NVNTF \g__xeCJK_CJK_class_prop \l__xeCJK_tmpc_int \l__xeCJK_tmpa_tl + \int_compare:nNnTF + { \use:c { \__xeCJK_class_csname:n { CJK } } } = \l__xeCJK_tmpc_int { \cs_set_eq:NN \__xeCJK_set_char_catcode:n \char_set_catcode_other:n } { \cs_set_eq:NN \__xeCJK_set_char_catcode:n \use_none:n } \xeCJK_int_until_do:nn { \l__xeCJK_tmpa_int > \l__xeCJK_tmpb_int } @@ -329,6 +391,16 @@ \int_incr:N \l__xeCJK_tmpa_int } } +\cs_new_protected_nopar:Npn \__xeCJK_set_char_class:nnn #1#2#3 + { + \__xeCJK_check_num_range:nnNN {#1} {#2} \l__xeCJK_tmpa_int \l__xeCJK_tmpb_int + \int_set:Nn \l__xeCJK_tmpc_int {#3} + \xeCJK_int_until_do:nn { \l__xeCJK_tmpa_int > \l__xeCJK_tmpb_int } + { + \XeTeXcharclass \l__xeCJK_tmpa_int = \l__xeCJK_tmpc_int + \int_incr:N \l__xeCJK_tmpa_int + } + } \cs_new_protected_nopar:Npn \__xeCJK_check_num_range:nnNN #1#2#3#4 { \bool_if:nTF { \xeCJK_if_blank_x_p:n {#1} || \xeCJK_if_blank_x_p:n {#2} } @@ -341,18 +413,20 @@ \int_set:Nn #4 { \int_max:nn {#1} { \IfNoValueTF {#2} {#1} {#2} } } } } +\cs_new_eq:NN \xeCJK_set_char_class:nnn \__xeCJK_set_char_class_catcode:nnn +\AtEndOfPackage + { \cs_set_eq:NN \xeCJK_set_char_class:nnn \__xeCJK_set_char_class:nnn } \cs_new_protected_nopar:Npn \__xeCJK_set_char_class_eq:nn #1#2 { - \int_set:Nn \l__xeCJK_tmpa_int { \xeCJK_class_num:n {#1} } - \clist_map_inline:cn { c__xeCJK_#2_chars_clist } + \int_set:Nn \l__xeCJK_tmpa_int { \xeCJK_class_num:n {#2} } + \clist_map_inline:cn { c__xeCJK_#1_chars_clist } { \XeTeXcharclass ##1 = \l__xeCJK_tmpa_int } } \NewDocumentCommand \normalspacedchars { m } { - \tl_map_inline:xn {#1} + \tl_map_inline:nn {#1} { \XeTeXcharclass `##1 = \xeCJK_class_num:n { NormalSpace } } } -\cs_generate_variant:Nn \tl_map_inline:nn { x } \NewDocumentCommand \xeCJKResetPunctClass { } { \xeCJK_declare_char_class:nV { HalfLeft } \c__xeCJK_HalfLeft_chars_clist @@ -369,7 +443,7 @@ \xeCJKResetCharClass \cs_new_protected_nopar:Npn \xeCJK_inter_class_toks:nnn #1#2#3 { \XeTeXinterchartoks \xeCJK_class_num:n {#1} ~ \xeCJK_class_num:n {#2} = {#3} } -\cs_generate_variant:Nn \xeCJK_inter_class_toks:nnn { nnc , nnx } +\cs_generate_variant:Nn \xeCJK_inter_class_toks:nnn { nnc , nnv , nnx } \cs_new_nopar:Npn \xeCJK_get_inter_class_toks:nn #1#2 { \tex_the:D \XeTeXinterchartoks \xeCJK_class_num:n {#1} ~ \xeCJK_class_num:n {#2} } \cs_new_protected_nopar:Npn \xeCJK_clear_inter_class_toks:nn #1#2 @@ -405,20 +479,15 @@ \cs_new_eq:NN \xeCJK_class_group_end: \c_group_end_token \clist_map_inline:nn { Default , HalfLeft , HalfRight , NormalSpace } { - \clist_map_inline:nn { CJK , FullLeft , FullRight } + \xeCJK_inter_class_toks:nnn {#1} { CJK } { - \xeCJK_inter_class_toks:nnn {#1} {##1} - { - \xeCJK_class_group_begin: - \xeCJK_select_font: - \xeCJK_clear_inter_class_toks:nn {#1} {##1} - \xeCJK_clear_Boundary_and_CJK_toks: - } - \xeCJK_inter_class_toks:nnn {##1} {#1} { \xeCJK_class_group_end: } + \xeCJK_class_group_begin: + \xeCJK_select_font: + \xeCJK_clear_inter_class_toks:nn {#1} { CJK } + \xeCJK_clear_Boundary_and_CJK_toks: + \CJKsymbol } - \xeCJK_app_inter_class_toks:nnn {#1} { CJK } { \CJKsymbol } - \clist_map_inline:nn { FullLeft , FullRight } - { \xeCJK_app_inter_class_toks:nnc {#1} {##1} { xeCJK_CJK_and_##1:N } } + \xeCJK_inter_class_toks:nnn { CJK } {#1} { \xeCJK_class_group_end: } } \clist_map_inline:nn { Default , HalfLeft , NormalSpace } { @@ -436,7 +505,7 @@ \xeCJK_if_last_node_p:n { CJK } || \xeCJK_if_last_node_p:n { CJK-space } } - { \CJKecglue } { \c_space_token } + { \CJKecglue } { ~ } } { \xeCJK_if_last_node:nTF { CJK } { \CJKecglue } @@ -450,8 +519,8 @@ { \xeCJK_inter_class_toks:nnn {#1} { Boundary } { - \peek_meaning_remove:NTF \/ - { \/ { \xeCJK_make_node:n { default } } } + \peek_meaning_remove:NTF \tex_italiccorrection:D + { \tex_italiccorrection:D { \xeCJK_make_node:n { default } } } { \token_if_space:NTF \l_peek_token { { \xeCJK_make_node:n { default-space } } } @@ -463,7 +532,7 @@ } \xeCJK_inter_class_toks:nnn { Boundary } { CJK } { - { \xeCJK_check_for_glue: } + \xeCJK_check_for_glue: \xeCJK_class_group_begin: \xeCJK_clear_Boundary_and_CJK_toks: \xeCJK_select_font: @@ -503,8 +572,8 @@ \xeCJK_if_last_node_p:n { CJK } || \xeCJK_if_last_node_p:n { CJK-space } } - { \bool_if:NTF \l__xeCJK_reserve_space_bool \c_space_token \CJKglue } - { \c_space_token } + { \bool_if:NTF \l__xeCJK_reserve_space_bool { ~ } { \CJKglue } } + { ~ } } } } @@ -531,13 +600,20 @@ \xeCJK_def_node:nn { default } { 13 sp } \xeCJK_def_node:nn { default-space } { 14 sp } \keys_define:nn { xeCJK / options } - { CJKglue .code:n = { \cs_set_protected:Npn \CJKglue {#1} } } + { + CJKglue .code:n = + { + \cs_set_protected_nopar:Npn \CJKglue {#1} + \xeCJK_glue_to_skip:nN {#1} \l__xeCJK_ccglue_skip + } + } +\skip_new:N \l__xeCJK_ccglue_skip \keys_define:nn { xeCJK / options } { CJKecglue .code:n = { - \cs_set_protected:Npn \CJKecglue {#1} - \xeCJK_glue_to_skip:nN \CJKecglue \l__xeCJK_ecglue_skip + \cs_set_protected_nopar:Npn \CJKecglue {#1} + \xeCJK_glue_to_skip:nN {#1} \l__xeCJK_ecglue_skip } , xCJKecglue .choice: , xCJKecglue / true .code:n = @@ -548,13 +624,13 @@ xCJKecglue / false .code:n = { \bool_set_false:N \l__xeCJK_xecglue_bool - \cs_set_eq:NN \__xeCJK_space_or_xecglue: \c_space_token + \cs_set_eq:NN \__xeCJK_space_or_xecglue: \c_space_tl } , xCJKecglue / unknown .code:n = { \bool_set_true:N \l__xeCJK_xecglue_bool - \cs_set_protected:Npn \CJKecglue {#1} - \xeCJK_glue_to_skip:nN \CJKecglue \l__xeCJK_ecglue_skip + \cs_set_protected_nopar:Npn \CJKecglue {#1} + \xeCJK_glue_to_skip:nN {#1} \l__xeCJK_ecglue_skip \cs_set_eq:NN \__xeCJK_space_or_xecglue: \CJKecglue } , xCJKecglue .default:n = { true } @@ -575,13 +651,16 @@ } \cs_new_protected_nopar:Npn \xeCJK_ignore_spaces:w { - \peek_catcode:NTF \c_space_token + \xeCJK_peek_catcode_ignore_spaces:NTF \c_math_toggle_token + { + \bool_if:NTF \l__xeCJK_peek_ignore_spaces_bool + { \__xeCJK_space_or_xecglue: } { \CJKecglue } + } { - \xeCJK_if_last_node:nT { CJK } - { \tex_unkern:D \tex_unkern:D { \xeCJK_make_node:n { CJK-space } } } - \peek_catcode_ignore_spaces:NTF \c_math_toggle_token - { \__xeCJK_space_or_xecglue: } + \bool_if:NTF \l__xeCJK_peek_ignore_spaces_bool { + \tex_unkern:D \tex_unkern:D + { \xeCJK_make_node:n { CJK-space } } \bool_if:nT { \token_if_macro_p:N \l_peek_token || @@ -590,41 +669,33 @@ } { \__xeCJK_space_or_xecglue: } } - } - { - \token_if_math_toggle:NTF \l_peek_token - { \CJKecglue } { \cs_if_exist:NF \l_peek_token \exp_not:N } } } -\cs_new_eq:NN \xeCJK_ignorespaces: \xeCJK_ignore_spaces:w \xeCJK_inter_class_toks:nnn { CJK } { CJK } { \xeCJK_CJK_and_CJK:N } \cs_new_protected_nopar:Npn \xeCJK_CJK_and_CJK:N #1 { \CJKglue \CJKsymbol {#1} } -\clist_map_inline:nn { FullLeft , FullRight } +\xeCJK_inter_class_toks:nnn { FullLeft } { CJK } + { \xeCJK_FullLeft_and_CJK: \CJKsymbol } +\xeCJK_inter_class_toks:nnn { FullRight } { CJK } + { \xeCJK_FullRight_and_CJK: \CJKsymbol } +\seq_map_inline:Nn \g__xeCJK_non_CJK_class_seq { - \xeCJK_inter_class_toks:nnn { Boundary } {#1} + \clist_map_inline:nn { FullLeft , FullRight } { - \xeCJK_class_group_begin: - \xeCJK_clear_Boundary_and_CJK_toks: - \xeCJK_select_font: - \use:c { xeCJK_CJK_and_#1:N } + \xeCJK_inter_class_toks:nnx {#1} {##1} + { \exp_not:c { xeCJK_Default_and_##1:nN } {#1} } + \xeCJK_inter_class_toks:nnc {##1} {#1} { xeCJK_##1_and_Default: } } } -\xeCJK_inter_class_toks:nnn { FullLeft } { Boundary } - { \xeCJK_class_group_end: \tex_ignorespaces:D } +\xeCJK_inter_class_toks:nnn { Boundary } { FullLeft } + { \xeCJK_Boundary_and_FullLeft:N } +\xeCJK_inter_class_toks:nnn { Boundary } { FullRight } + { \xeCJK_Boundary_and_FullRight:N } +\xeCJK_app_inter_class_toks:nnn { FullLeft } { Boundary } { \tex_ignorespaces:D } \xeCJK_inter_class_toks:nnn { FullRight } { Boundary } - { \xeCJK_class_group_end: \CJKglue \tex_ignorespaces:D } -\xeCJK_inter_class_toks:nnn { FullLeft } { CJK } { \CJKsymbol } -\xeCJK_inter_class_toks:nnn { FullRight } { CJK } { \CJKglue \CJKsymbol } -\seq_map_inline:Nn \g__xeCJK_base_class_seq - { - \bool_if:nF - { \str_if_eq_p:nn {#1} { FullLeft } || \str_if_eq_p:nn {#1} { FullRight } } - { - \xeCJK_pre_inter_class_toks:nnn { FullLeft } {#1} { \xeCJK_after_FullLeft: } - \xeCJK_pre_inter_class_toks:nnn { FullRight } {#1} { \xeCJK_after_FullRight: } - } - } + { \xeCJK_FullRight_and_Boundary: } +\cs_new_protected_nopar:Npn \xeCJK_FullRight_and_Boundary: + { \xeCJK_FullRight_and_Default: \tex_ignorespaces:D } \clist_map_inline:nn { CJK , FullLeft , FullRight } { \clist_map_inline:nn { FullLeft , FullRight } @@ -639,58 +710,133 @@ } \cs_new_protected_nopar:Npn \__xeCJK_punct_glue:NN #1#2 { - \skip_horizontal:n + \__xeCJK_punct_hskip:n { \__xeCJK_use_punct_dim:nnn { glue } {#1} {#2} minus \dim_eval:n { ( \__xeCJK_use_punct_dim:nnn { glue } {#1} {#2} ) / \c_two } } } +\cs_new_eq:NN \__xeCJK_punct_hskip:n \skip_horizontal:n \cs_new_protected_nopar:Npn \__xeCJK_punct_kern:NN #1#2 { \tex_kern:D \__xeCJK_use_punct_dim:nnn { kern } {#1} {#2} } \tl_new:N \g__xeCJK_last_punct_tl -\cs_new_protected_nopar:Npn \xeCJK_after_FullLeft: +\cs_new_protected_nopar:Npn \xeCJK_FullLeft_and_CJK: { - \xeCJK_no_break: - \__xeCJK_punct_if_middle:NT \g__xeCJK_last_punct_tl + \__xeCJK_punct_if_middle:NTF \g__xeCJK_last_punct_tl { - \xeCJK_get_punct_bounds:NN \c__xeCJK_left_tl \g__xeCJK_last_punct_tl - \__xeCJK_punct_glue:NN \c__xeCJK_left_tl \g__xeCJK_last_punct_tl \__xeCJK_punct_rule:NN \c__xeCJK_right_tl \g__xeCJK_last_punct_tl \xeCJK_no_break: + \__xeCJK_punct_glue:NN \c__xeCJK_left_tl \g__xeCJK_last_punct_tl } + { \xeCJK_no_break: } } -\cs_new_protected_nopar:Npn \xeCJK_after_FullRight: +\cs_new_protected_nopar:Npn \xeCJK_FullLeft_and_Default: + { + \__xeCJK_punct_if_middle:NTF \g__xeCJK_last_punct_tl + { + \__xeCJK_punct_rule:NN \c__xeCJK_right_tl \g__xeCJK_last_punct_tl + \xeCJK_class_group_end: \xeCJK_no_break: + \__xeCJK_punct_glue:NN \c__xeCJK_left_tl \g__xeCJK_last_punct_tl + } + { \xeCJK_class_group_end: \xeCJK_no_break: } + } +\cs_new_protected_nopar:Npn \xeCJK_FullRight_and_CJK: { - \xeCJK_get_punct_bounds:NN \c__xeCJK_right_tl \g__xeCJK_last_punct_tl \__xeCJK_punct_rule:NN \c__xeCJK_right_tl \g__xeCJK_last_punct_tl \__xeCJK_punct_glue:NN \c__xeCJK_right_tl \g__xeCJK_last_punct_tl + \CJKglue + } +\cs_new_protected_nopar:Npn \xeCJK_FullRight_and_Default: + { + \__xeCJK_punct_rule:NN \c__xeCJK_right_tl \g__xeCJK_last_punct_tl + \xeCJK_class_group_end: + \__xeCJK_punct_glue:NN \c__xeCJK_right_tl \g__xeCJK_last_punct_tl + } +\cs_new_protected_nopar:Npn \xeCJK_Default_and_FullLeft:nN #1#2 + { + \xeCJK_get_punct_bounds:NN \c__xeCJK_left_tl {#2} + \__xeCJK_Default_and_FullLeft_glue:N {#2} + \xeCJK_class_group_begin: + \xeCJK_select_font: + \xeCJK_clear_inter_class_toks:nn {#1} { FullLeft } + \xeCJK_clear_Boundary_and_CJK_toks: + \tl_gset:Nx \g__xeCJK_last_punct_tl {#2} + \__xeCJK_punct_rule:NN \c__xeCJK_left_tl {#2} + \CJKpunctsymbol {#2} } +\cs_new_protected_nopar:Npn \__xeCJK_Default_and_FullLeft_glue:N #1 + { \__xeCJK_punct_glue:NN \c__xeCJK_left_tl {#1} } \cs_new_protected_nopar:Npn \xeCJK_CJK_and_FullLeft:N #1 { \xeCJK_get_punct_bounds:NN \c__xeCJK_left_tl {#1} - \int_compare:nNnF \etex_lastnodetype:D = \c_one - { \__xeCJK_CJK_FullLeft_glue: \__xeCJK_punct_glue:NN \c__xeCJK_left_tl {#1} } + \__xeCJK_CJK_and_FullLeft_glue:N {#1} + \tl_gset:Nx \g__xeCJK_last_punct_tl {#1} + \__xeCJK_punct_rule:NN \c__xeCJK_left_tl {#1} + \CJKpunctsymbol {#1} + } +\cs_new_protected_nopar:Npn \__xeCJK_CJK_and_FullLeft_glue:N #1 + { \CJKglue \__xeCJK_punct_glue:NN \c__xeCJK_left_tl {#1} } +\cs_new_protected_nopar:Npn \xeCJK_Boundary_and_FullLeft:N #1 + { + \xeCJK_get_punct_bounds:NN \c__xeCJK_left_tl {#1} + \__xeCJK_Boundary_and_FullLeft_glue:N {#1} + \xeCJK_class_group_begin: + \xeCJK_select_font: + \xeCJK_clear_Boundary_and_CJK_toks: \tl_gset:Nx \g__xeCJK_last_punct_tl {#1} \__xeCJK_punct_rule:NN \c__xeCJK_left_tl {#1} \CJKpunctsymbol {#1} } -\cs_new_protected_nopar:Npn \__xeCJK_CJK_FullLeft_glue: { \CJKglue } +\cs_new_protected_nopar:Npn \__xeCJK_Boundary_and_FullLeft_glue:N #1 + { + \int_compare:nNnF \etex_lastnodetype:D = \c_one + { \__xeCJK_punct_glue:NN \c__xeCJK_left_tl {#1} } + } +\cs_new_protected_nopar:Npn \xeCJK_Default_and_FullRight:nN #1#2 + { + \xeCJK_get_punct_bounds:NN \c__xeCJK_right_tl {#2} + \__xeCJK_Default_and_FullRight_glue:N {#2} + \xeCJK_class_group_begin: + \xeCJK_select_font: + \xeCJK_clear_inter_class_toks:nn {#1} { FullRight } + \xeCJK_clear_Boundary_and_CJK_toks: + \tl_gset:Nx \g__xeCJK_last_punct_tl {#2} + \__xeCJK_punct_if_middle:NT {#2} + { \__xeCJK_punct_rule:NN \c__xeCJK_left_tl {#2} } + \xeCJK_FullRight_symbol:N {#2} + } +\cs_new_protected_nopar:Npn \xeCJK_Boundary_and_FullRight:N #1 + { + \xeCJK_get_punct_bounds:NN \c__xeCJK_right_tl {#1} + \__xeCJK_Default_and_FullRight_glue:N {#1} + \xeCJK_class_group_begin: + \xeCJK_select_font: + \xeCJK_clear_Boundary_and_CJK_toks: + \tl_gset:Nx \g__xeCJK_last_punct_tl {#1} + \__xeCJK_punct_if_middle:NT {#1} + { \__xeCJK_punct_rule:NN \c__xeCJK_left_tl {#1} } + \xeCJK_FullRight_symbol:N {#1} + } \cs_new_protected_nopar:Npn \xeCJK_CJK_and_FullRight:N #1 { \xeCJK_get_punct_bounds:NN \c__xeCJK_right_tl {#1} + \__xeCJK_CJK_and_FullRight_glue:N {#1} + \tl_gset:Nx \g__xeCJK_last_punct_tl {#1} + \__xeCJK_punct_if_middle:NT {#1} + { \__xeCJK_punct_rule:NN \c__xeCJK_left_tl {#1} } + \xeCJK_FullRight_symbol:N {#1} + } +\cs_new_protected_nopar:Npn \__xeCJK_CJK_and_FullRight_glue:N #1 + { \__xeCJK_punct_if_long:NTF {#1} { \CJKglue } { - \xeCJK_no_break: - \__xeCJK_punct_if_middle:NT {#1} - { - \__xeCJK_punct_glue:NN \c__xeCJK_right_tl {#1} - \__xeCJK_punct_rule:NN \c__xeCJK_left_tl {#1} - } + \__xeCJK_punct_if_middle:NTF {#1} + { \xeCJK_no_break: \__xeCJK_punct_glue:NN \c__xeCJK_right_tl {#1} } + { \xeCJK_no_break: } } - \tl_gset:Nx \g__xeCJK_last_punct_tl {#1} - \CJKpunctsymbol {#1} } +\cs_new_eq:NN \__xeCJK_Default_and_FullRight_glue:N \__xeCJK_CJK_and_FullRight_glue:N \cs_new_protected_nopar:Npn \xeCJK_FullLeft_and_FullLeft:N #1 { \xeCJK_no_break: @@ -708,7 +854,7 @@ \__xeCJK_punct_kern:NN \g__xeCJK_last_punct_tl {#1} \tl_gset:Nx \g__xeCJK_last_punct_tl {#1} \xeCJK_no_break: - \CJKpunctsymbol {#1} + \xeCJK_FullRight_symbol:N {#1} } \cs_new_protected_nopar:Npn \xeCJK_FullRight_and_FullLeft:N #1 { @@ -726,38 +872,115 @@ \__xeCJK_punct_kern:NN \g__xeCJK_last_punct_tl {#1} \tl_gset:Nx \g__xeCJK_last_punct_tl {#1} \xeCJK_no_break: - \CJKpunctsymbol {#1} + \xeCJK_FullRight_symbol:N {#1} } \keys_define:nn { xeCJK / options } { - CheckSingle .choice: , - CheckSingle / true .code:n = { \xeCJKenablechecksingle } , - CheckSingle / false .code:n = { \xeCJKdisablechecksingle } , - CheckSingle .default:n = { true } , - CJKchecksingle .meta:n = { CheckSingle = true } + CheckFullRight .choice: , + CheckFullRight / true .code:n = + { + \cs_if_eq:NNF \xeCJK_FullRight_and_Boundary: \xeCJK_check_FullRight: + { + \cs_set_eq:NN \__xeCJK_save_FullRight_check: \xeCJK_FullRight_and_Boundary: + \cs_set_eq:NN \__xeCJK_save_FullRight_symbol:N \xeCJK_FullRight_symbol:N + \cs_set_eq:NN \xeCJK_FullRight_and_Boundary: \xeCJK_check_FullRight: + \cs_set_eq:NN \xeCJK_FullRight_symbol:N \xeCJK_check_FullRight_symbol:Nw + } + } , + CheckFullRight / false .code:n = + { + \cs_if_eq:NNT \xeCJK_FullRight_and_Boundary: \xeCJK_check_FullRight: + { + \cs_set_eq:NN \xeCJK_FullRight_and_Boundary: \__xeCJK_save_FullRight_check: + \cs_set_eq:NN \xeCJK_FullRight_symbol:N \__xeCJK_save_FullRight_symbol:N + } + } , + CheckFullRight .default:n = { true } } -\bool_new:N \l__xeCJK_check_single_bool -\NewDocumentCommand \xeCJKenablechecksingle { } +\cs_new_nopar:Npn \xeCJK_FullRight_symbol:N { \CJKpunctsymbol } +\cs_new_protected_nopar:Npn \xeCJK_check_FullRight: { - \bool_if:NF \l__xeCJK_check_single_bool + \xeCJK_get_punct_bounds:NN \c__xeCJK_right_tl \g__xeCJK_last_punct_tl + \__xeCJK_punct_rule:NN \c__xeCJK_right_tl \g__xeCJK_last_punct_tl + \tl_case:Non \l_peek_token { \l__xeCJK_no_break_cs_case_tl } { } + \__xeCJK_punct_glue:NN \c__xeCJK_right_tl \g__xeCJK_last_punct_tl + \xeCJK_class_group_end: + } +\cs_generate_variant:Nn \tl_case:Nnn { No } +\cs_new_protected_nopar:Npn \xeCJK_check_FullRight_symbol:Nw #1 + { \xeCJK_peek_after_ignore_spaces:nw { \__xeCJK_save_FullRight_symbol:N {#1} } } +\cs_new_protected:Npn \xeCJK_cs_case_keys_define:nNNnn #1#2#3#4#5 + { + \tl_new:N #2 + \seq_new:N #3 + \keys_define:nn { xeCJK / options } { - \bool_set_true:N \l__xeCJK_check_single_bool - \cs_set_eq:NN \__xeCJK_check_single_save:N \xeCJK_CJK_and_CJK:N - \cs_set_eq:NN \xeCJK_CJK_and_CJK:N \xeCJK_check_single:Nw + #1 .code:n = + { + \seq_set_split:Nnn #3 { } {##1} + \__xeCJK_update_cs_case_tl:NNnn #2#3 {#4} {#5} + } , + #1+ .code:n = + { + \tl_map_inline:nn {##1} + { \seq_if_in:NnF #2 {####1} { \seq_put_right:Nn #3 {####1} } } + \__xeCJK_update_cs_case_tl:NNnn #2#3 {#4} {#5} + } , + #1- .code:n = + { + \tl_map_inline:nn {##1} { \seq_remove_all:Nn #3 {####1} } + \__xeCJK_update_cs_case_tl:NNnn #2#3 {#4} {#5} + } } } -\NewDocumentCommand \xeCJKdisablechecksingle { } +\cs_new_protected:Npn \__xeCJK_update_cs_case_tl:NNnn #1#2#3#4 { - \bool_if:NT \l__xeCJK_check_single_bool + \tl_clear:N #1 + \seq_map_inline:Nn #2 { \tl_put_right:Nn #1 { {##1} {#3} } } + #4 + } +\xeCJK_cs_case_keys_define:nNNnn { NoBreakCS } + \l__xeCJK_no_break_cs_case_tl \l__xeCJK_no_break_cs_seq { \xeCJK_no_break: } { } +\NewDocumentCommand \xeCJKnobreak { } + { + \int_zero:N \l__xeCJK_tmpa_int + \int_while_do:nNnn \etex_lastnodetype:D = \c_eleven { - \bool_set_false:N \l__xeCJK_check_single_bool - \cs_set_eq:NN \xeCJK_CJK_and_CJK:N \__xeCJK_check_single_save:N + \int_if_even:nTF \l__xeCJK_tmpa_int + { + \int_incr:N \l__xeCJK_tmpa_int + \skip_set_eq:NN \l__xeCJK_tmp_skip \tex_lastskip:D + } + { \skip_add:Nn \l__xeCJK_tmp_skip \tex_lastskip:D } + \tex_unskip:D } + \xeCJK_no_break: + \int_if_even:nF \l__xeCJK_tmpa_int + { \skip_horizontal:N \l__xeCJK_tmp_skip } + } +\keys_define:nn { xeCJK / options } + { + CheckSingle .choice: , + CheckSingle / true .code:n = + { + \cs_if_eq:NNF \xeCJK_CJK_and_CJK:N \xeCJK_check_single:Nw + { + \cs_set_eq:NN \__xeCJK_check_single_save:N \xeCJK_CJK_and_CJK:N + \cs_set_eq:NN \xeCJK_CJK_and_CJK:N \xeCJK_check_single:Nw + } + } , + CheckSingle / false .code:n = + { + \cs_if_eq:NNT \xeCJK_CJK_and_CJK:N \xeCJK_check_single:Nw + { \cs_set_eq:NN \xeCJK_CJK_and_CJK:N \__xeCJK_check_single_save:N } + } , + CheckSingle .default:n = { true } , + CJKchecksingle .meta:n = { CheckSingle = true } } \cs_new_protected_nopar:Npn \xeCJK_check_single:Nw #1 { \peek_catcode:NTF \c_catcode_other_token - { \xeCJK_check_single:NNw {#1} } + { \xeCJK_check_single:NNw #1 } { \bool_if:nTF { @@ -765,91 +988,138 @@ \exp_args:No \tl_if_single_token_p:n \l_peek_token && \exp_after:wN \token_if_other_p:N \l_peek_token } - { \xeCJK_check_single:NNw {#1} } - { \__xeCJK_check_single_save:N {#1} } + { \exp_after:wN \xeCJK_check_single:NNw \exp_after:wN #1 } + { \__xeCJK_check_single_save:N #1 } } } \cs_new_protected_nopar:Npn \xeCJK_check_single:NNw #1#2 { - \peek_catcode:NTF \c_catcode_other_token - { \__xeCJK_check_single_save:N {#1} #2 } + \xeCJK_peek_catcode_ignore_spaces:NTF \c_catcode_other_token { - \bool_if:nTF + \bool_if:NTF \l__xeCJK_peek_ignore_spaces_bool + { \__xeCJK_check_single_space:NN #1#2 } + { \__xeCJK_check_single_save:N #1 #2 } + } + { + \group_align_safe_begin: + \token_if_cs:NTF \l_peek_token { - \token_if_space_p:N \l_peek_token || - \token_if_math_toggle_p:N \l_peek_token || - \token_if_cs_p:N \l_peek_token + \group_align_safe_end: + \bool_if:NTF \l__xeCJK_peek_ignore_spaces_bool + { \xeCJK_check_single_cs:NNn #1#2 { ~ } } + { \xeCJK_check_single_cs:NNn #1#2 { } } } { - \bool_if:nTF { \token_if_space_p:N \l_peek_token } + \group_align_safe_end: + \bool_if:nTF { - \peek_catcode_ignore_spaces:NTF \c_catcode_other_token - { \__xeCJK_check_single_save:N {#1} #2 \c_space_token } - { - \bool_if:nTF - { - \token_if_math_toggle_p:N \l_peek_token || - \token_if_cs_p:N \l_peek_token - } - { \xeCJK_check_single:NNNw {#1} {#2} \c_space_token } - { \__xeCJK_check_single_save:N {#1} #2 \c_space_token } - } + \l__xeCJK_plain_equation_bool && + \token_if_math_toggle_p:N \l_peek_token + } + { + \bool_if:NTF \l__xeCJK_peek_ignore_spaces_bool + { \xeCJK_check_single_equation:NNnNw #1 #2 { ~ } } + { \xeCJK_check_single_equation:NNnNw #1 #2 { } } + } + { + \bool_if:NTF \l__xeCJK_peek_ignore_spaces_bool + { \__xeCJK_check_single_save:N #1 #2 ~ } + { \__xeCJK_check_single_save:N #1 #2 } } - { \xeCJK_check_single:NNNw {#1} {#2} { } } } - { \__xeCJK_check_single_save:N {#1} #2 } } } -\cs_new_protected_nopar:Npn \xeCJK_check_single:NNNw #1#2#3 +\cs_new_protected_nopar:Npn \__xeCJK_check_single_space:NN #1#2 { - \bool_if:nTF + \int_case:non { \xeCJK_token_value_class:N #2 } + { \g__xeCJK_check_single_CJK_case_tl } + { \use_i:nn } + { \__xeCJK_check_single_save:N #1 #2 ~ } { - \token_if_eq_meaning_p:NN \l_peek_token \par || - \token_if_eq_meaning_p:NN \l_peek_token \[ % \] + \int_case:non { \xeCJK_token_value_class:N \l_peek_token } + { \g__xeCJK_check_single_CJK_case_tl } + { \use_i:nn } + { \__xeCJK_check_single_save:N #1 #2 ~ } + { \__xeCJK_check_single_save:N #1 #2 } } - { \CJKsymbol {#1} \xeCJK_no_break: #2 } - { \xeCJK_check_single_env:NNNw {#1} {#2} {#3} } } -\cs_new_protected_nopar:Npn \xeCJK_check_single_env:NNNw #1#2#3 +\cs_generate_variant:Nn \int_case:nnn { no } +\cs_new_protected_nopar:Npn \xeCJK_check_single_equation:NNnNw #1#2#3#4 { - \peek_catcode_remove:NTF \c_math_toggle_token + \peek_catcode:NTF \c_math_toggle_token { - \peek_catcode:NTF \c_math_toggle_token - { \CJKsymbol {#1} \xeCJK_no_break: #2 \c_math_toggle_token } - { \__xeCJK_check_single_save:N {#1} #2#3 \c_math_toggle_token } + \xeCJK_no_break: \__xeCJK_check_single_save:N #1 + \xeCJK_no_break: #2 #4 } + { \__xeCJK_check_single_save:N #1 #2#3#4 } + } +\cs_new_protected_nopar:Npn \xeCJK_check_single_cs:NNn #1#2#3 + { + \tl_case:Non \l_peek_token + { \l__xeCJK_check_single_cs_case_tl } + { \use_iii:nnn } + { \xeCJK_check_single_env:nnNn } { - \peek_meaning_remove:NTF \begin - { \xeCJK_check_single_env:NNNNn {#1} {#2} {#3} \begin } - { - \peek_meaning_remove:NTF \end - { \xeCJK_check_single_env:NNNNn {#1} {#2} {#3} \end } - { \__xeCJK_check_single_save:N {#1} #2#3 } - } + \xeCJK_no_break: \__xeCJK_check_single_save:N #1 + \xeCJK_no_break: #2 } + { \__xeCJK_check_single_save:N #1 #2#3 } + } +\tl_new:N \l__xeCJK_check_single_cs_case_tl +\cs_new_protected_nopar:Npn \xeCJK_check_single_env:nnNn #1#2#3#4 + { + \str_case_x:non {#4} + { \l__xeCJK_inline_env_case_tl } + { \use_i:nn } + {#1} {#2} + \scan_stop: #3 {#4} } -\cs_new_protected_nopar:Npn \xeCJK_check_single_env:NNNNn #1#2#3#4#5 +\cs_generate_variant:Nn \str_case_x:nnn { no } +\xeCJK_cs_case_keys_define:nNNnn { NewLineCS } + \l__xeCJK_new_line_cs_case_tl \l__xeCJK_new_line_cs_seq { \use_ii:nnn } { - \clist_if_in:NnTF \g__xeCJK_inline_env_clist {#5} - { \__xeCJK_check_single_save:N {#1} #2#3 } - { \CJKsymbol {#1} \xeCJK_no_break: #2 } - \scan_stop: #4 {#5} + \tl_concat:NNN \l__xeCJK_check_single_cs_case_tl + \l__xeCJK_new_line_cs_case_tl \l__xeCJK_env_cs_case_tl + } +\xeCJK_cs_case_keys_define:nNNnn { EnvCS } + \l__xeCJK_env_cs_case_tl \l__xeCJK_env_cs_seq { \use:n } + { + \tl_concat:NNN \l__xeCJK_check_single_cs_case_tl + \l__xeCJK_new_line_cs_case_tl \l__xeCJK_env_cs_case_tl } \keys_define:nn { xeCJK / options } { - InlineEnv .clist_gset:N = \g__xeCJK_inline_env_clist , + InlineEnv .code:n = + { + \seq_set_from_clist:Nn \l__xeCJK_inline_env_seq {#1} + \__xeCJK_update_inline_env_case_tl: + } , InlineEnv+ .code:n = { - \clist_gput_right:Nx \g__xeCJK_inline_env_clist {#1} - \clist_gremove_duplicates:N \g__xeCJK_inline_env_clist + \clist_map_inline:nn {#1} + { + \seq_if_in:NnF \l__xeCJK_inline_env_seq {##1} + { \seq_put_right:Nn \l__xeCJK_inline_env_seq {##1} } + } + \__xeCJK_update_inline_env_case_tl: } , InlineEnv- .code:n = { - \clist_map_inline:xn {#1} - { \clist_gremove_all:Nn \g__xeCJK_inline_env_clist {##1} } + \clist_map_inline:nn {#1} + { \seq_remove_all:Nn \l__xeCJK_inline_env_seq {##1} } + \__xeCJK_update_inline_env_case_tl: } } -\cs_generate_variant:Nn \clist_map_inline:nn { x } +\seq_new:N \l__xeCJK_inline_env_seq +\cs_new_protected:Npn \__xeCJK_update_inline_env_case_tl: + { + \tl_clear:N \l__xeCJK_inline_env_case_tl + \seq_map_inline:Nn \l__xeCJK_inline_env_seq + { \tl_put_right:Nn \l__xeCJK_inline_env_case_tl { {##1} { \use_ii:nn } } } + } +\tl_new:N \l__xeCJK_inline_env_case_tl +\keys_define:nn { xeCJK / options } + { PlainEquation .bool_set:N = \l__xeCJK_plain_equation_bool } \seq_new:N \g__xeCJK_CJK_sub_class_seq \NewDocumentCommand \xeCJKDeclareSubCJKBlock { s > { \TrimSpaces } m > { \TrimSpaces } m } @@ -881,7 +1151,7 @@ { \clist_map_inline:nn {#1} { - \int_if_exist:cTF { c__xeCJK_ CJK/##1 _class_int } + \int_if_exist:cTF { \__xeCJK_class_csname:n { CJK/##1 } } { \xeCJK_declare_char_class:nx { CJK \bool_if:NF \l__xeCJK_sub_cancel_bool { /##1 } } @@ -899,11 +1169,11 @@ } \cs_new_protected_nopar:Npn \xeCJK_declare_sub_char_class:nnn #1#2#3 { - \int_if_exist:cF { c__xeCJK_ #1/#2 _class_int } + \int_if_exist:cF { \__xeCJK_class_csname:n { #1/#2 } } { \xeCJK_new_class:n { #1/#2 } \__xeCJK_set_sub_class_toks:nn {#1} {#2} - \__xeCJK_new_sub_key:n {#2} + \xeCJK_new_sub_key:n {#2} } \xeCJK_declare_char_class:nn { #1/#2 } {#3} } @@ -956,6 +1226,7 @@ } \NewDocumentCommand \xeCJKsetwidth { m m } { \tl_map_inline:xn {#1} { \tl_gset:cn { g__xeCJK_punct_width/##1/tl } {#2} } } +\cs_generate_variant:Nn \tl_map_inline:nn { x } \NewDocumentCommand \xeCJKsetkern { m m m } { \tl_gset:cn { g__xeCJK_punct/kern/#1/#2/tl } {#3} } \tl_const:Nn \c__xeCJK_left_tl { left } @@ -1017,13 +1288,13 @@ } \prg_new_conditional:Npnn \__xeCJK_punct_if_right:N #1 { p , T , F , TF } { - \if_int_compare:w \xeCJK_value_class:n {`#1} = \xeCJK_class_num:n { FullRight } + \if_int_compare:w \xeCJK_token_value_class:N #1 = \xeCJK_class_num:n { FullRight } \prg_return_true: \else: \prg_return_false: \fi: } -\cs_generate_variant:Nn \prg_new_conditional:Npnn { c } \clist_map_inline:Nn \g__xeCJK_special_punct_clist { - \prg_new_conditional:cpnn { __xeCJK_punct_if_#1:N } ##1 { p , T , F , TF } + \exp_args:Nc + \prg_new_conditional:Npnn { __xeCJK_punct_if_#1:N } ##1 { p , T , F , TF } { \if_cs_exist:w \__xeCJK_special_punct_tl:nN {#1} {##1} \cs_end: \prg_return_true: \else: \prg_return_false: \fi: @@ -1045,8 +1316,8 @@ { \tl_gset:cx { \__xeCJK_punct_dim_csname:nnn {#1} {#2} {#3} } {#4} } \cs_new_protected_nopar:Npn \__xeCJK_gset_punct_dim:nnnnx #1#2#3#4#5 { \tl_gset:cx { \__xeCJK_punct_dim_csname:nnnn {#1} {#2} {#3} {#4} } {#5} } -\DeclareObjectType { xeCJK / punctuation } { 3 } -\DeclareTemplateInterface { xeCJK / punctuation } { basic } { 3 } +\DeclareObjectType { xeCJK / punctuation } { \c_three } +\DeclareTemplateInterface { xeCJK / punctuation } { basic } { \c_three } { enabled-global-setting : boolean = true , fixed-punct-width : length = \c_max_dim , @@ -1077,7 +1348,7 @@ kerning-margin-ratio : real = \c_one_fp , kerning-margin-minimum : length = \c_zero_dim } -\DeclareTemplateCode { xeCJK / punctuation } { basic } { 3 } +\DeclareTemplateCode { xeCJK / punctuation } { basic } { \c_three } { enabled-global-setting = \l__xeCJK_enabled_global_setting_bool , fixed-punct-width = \l__xeCJK_fixed_punct_width_dim , @@ -1367,7 +1638,7 @@ ( \__xeCJK_use_punct_dim:nnn { bound } \c__xeCJK_right_tl {#1} ) } \__xeCJK_gset_punct_dim:nnx { width } {#1} - { \dim_use:N \etex_fontcharwd:D \tex_font:D `#1 } + { \dim_use:N \etex_fontcharwd:D \tex_font:D \xeCJK_token_value_charcode:N #1 } \__xeCJK_gset_punct_dim:nnx { dimen } {#1} { \dim_eval:n { \__xeCJK_use_punct_dim:nn { width } {#1} - \l__xeCJK_tmp_dim } } \__xeCJK_punct_if_long:NT {#1} @@ -1389,7 +1660,10 @@ } \cs_generate_variant:Nn \xeCJK_calc_punct_dimen:N { f } \cs_new_nopar:Npn \xeCJK_glyph_bounds:NN #1#2 - { \dim_use:N \XeTeXglyphbounds #1 ~ \XeTeXcharglyph `#2 \exp_stop_f: } + { + \dim_use:N \XeTeXglyphbounds #1 ~ + \XeTeXcharglyph \xeCJK_token_value_charcode:N #2 \exp_stop_f: + } \cs_new_protected_nopar:Npn \xeCJK_get_punct_kerning:NN #1#2 { \tl_if_exist:cF { \__xeCJK_punct_dim_csname:nnn { kern } {#1} {#2} } @@ -1475,29 +1749,22 @@ \keys_define:nn { xeCJK / options } { AutoFallBack .choice: , - AutoFallBack / true .code:n = { \xeCJKenablefallback } , - AutoFallBack / false .code:n = { \xeCJKdisablefallback } , - AutoFallBack .default:n = { true } , - fallback .meta:n = { AutoFallBack = true } - } -\NewDocumentCommand \xeCJKenablefallback { } - { - \bool_if:NF \l__xeCJK_fallback_bool + AutoFallBack / true .code:n = { - \bool_set_true:N \l__xeCJK_fallback_bool - \cs_set_eq:NN \__xeCJK_fallback_save_CJKsymbol:N \CJKsymbol - \cs_set_eq:NN \CJKsymbol \xeCJK_fallback_test_glyph:N - } - } -\NewDocumentCommand \xeCJKdisablefallback { } - { - \bool_if:NT \l__xeCJK_fallback_bool + \cs_if_eq:NNF \CJKsymbol \xeCJK_fallback_test_glyph:N + { + \cs_set_eq:NN \__xeCJK_fallback_save_CJKsymbol:N \CJKsymbol + \cs_set_eq:NN \CJKsymbol \xeCJK_fallback_test_glyph:N + } + } , + AutoFallBack / false .code:n = { - \bool_set_false:N \l__xeCJK_fallback_bool - \cs_set_eq:NN \CJKsymbol \__xeCJK_fallback_save_CJKsymbol:N - } + \cs_if_eq:NNT \CJKsymbol \xeCJK_fallback_test_glyph:N + { \cs_set_eq:NN \CJKsymbol \__xeCJK_fallback_save_CJKsymbol:N } + } , + AutoFallBack .default:n = { true } , + fallback .meta:n = { AutoFallBack = true } } -\bool_new:N \l__xeCJK_fallback_bool \cs_new_protected_nopar:Npn \xeCJK_fallback_test_glyph:N #1 { \xeCJK_glyph_if_exist:NTF {#1} @@ -1514,7 +1781,8 @@ { \xeCJK_fallback_loop:Nn {#1} { #2/FallBack } } } { - \__xeCJK_warning:nxx { fallback } {#1} {#2} + \xeCJK_family_if_exist:xT { \l_xeCJK_family_tl/FallBack } + { \__xeCJK_warning:nxx { fallback } {#1} {#2} } \__xeCJK_fallback_save_CJKsymbol:N {#1} } } @@ -1524,6 +1792,7 @@ ( \prop_get:No \g__xeCJK_family_font_name_prop {#2} )~ does~not~contain~glyph~'#1'~(U+\int_to_hexadecimal:n {`#1}).\\ } +\bool_new:N \l__xeCJK_fallback_first_bool \cs_generate_variant:Nn \prop_get:Nn { No } \NewDocumentCommand \setCJKfallbackfamilyfont { m O{} m } { @@ -1582,7 +1851,7 @@ slantfont .meta:n = { AutoFakeSlant = true } } \seq_new:N \g__xeCJK_sub_key_seq -\cs_new_protected_nopar:Npn \__xeCJK_new_sub_key:n #1 +\cs_new_protected_nopar:Npn \xeCJK_new_sub_key:n #1 { \seq_gput_right:Nn \g__xeCJK_sub_key_seq {#1} \keys_define:nn { xeCJK / features } @@ -1612,7 +1881,6 @@ #1 .default:n = { } } } -\cs_generate_variant:Nn \__xeCJK_new_sub_key:n { x } \cs_new_protected_nopar:Npn \__xeCJK_get_sub_features:nn #1#2 { \tl_set:Nx \l__xeCJK_tmpa_tl { \xeCJK_tl_remove_outer_braces:n {#2} } @@ -1643,7 +1911,7 @@ \cs_generate_variant:Nn \__xeCJK_get_sub_features:nn { V } \cs_generate_variant:Nn \tl_if_head_eq_meaning:nNTF { V } \cs_generate_variant:Nn \tl_replace_all:Nnn { NnV } -\__xeCJK_new_sub_key:n { FallBack } +\xeCJK_new_sub_key:n { FallBack } \prop_new:N \g__xeCJK_features_id_prop \prop_put:Nnn \g__xeCJK_features_id_prop { bf } { Bold } \prop_put:Nnn \g__xeCJK_features_id_prop { it } { Italic } @@ -1681,7 +1949,6 @@ } \cs_new_protected_nopar:Npn \__xeCJK_set_family_initial: { - \__xeCJK_gobble_CJKfamily: \int_gincr:N \g__xeCJK_family_int \prop_clear:N \l__xeCJK_add_font_prop \prop_map_inline:Nn \g__xeCJK_features_id_prop @@ -1745,7 +2012,8 @@ \cs_gset_protected_nopar:cpx { \__xeCJK_family_csname:n {#1} } { \group_begin: - \__xeCJK_gobble_CJKfamily: + \cs_set_eq:NN + \exp_not:n { \__xeCJK_update_family:n \use_none:n } \exp_not:n { \fontspec_set_family:Nnn \l__xeCJK_fontspec_family_tl } { \exp_not:V \l__xeCJK_fontspec_options_clist } { \exp_not:V \l__xeCJK_font_name_tl } @@ -1870,7 +2138,7 @@ } } \prop_map_inline:Nn \l__xeCJK_add_font_prop - { \clist_put_right:Nn \l__xeCJK_fontspec_options_clist { ##1 = { ##2 } } } + { \clist_put_right:Nn \l__xeCJK_fontspec_options_clist { ##1 = {##2} } } } \prop_new:N \g__xeCJK_family_name_prop \prop_new:N \g__xeCJK_family_font_name_prop @@ -1991,7 +2259,8 @@ { \__xeCJK_copy_family:xx { \l_xeCJK_family_tl/#1 } { - \cs_if_exist:cTF { \__xeCJK_family_csname:n { \CJKfamilydefault/#1 } } + \cs_if_exist:cTF + { \__xeCJK_family_csname:n { \CJKfamilydefault/#1 } } { \CJKfamilydefault/#1 } { \l_xeCJK_family_tl } } } @@ -2007,8 +2276,8 @@ \prop_gput:Nxx \g__xeCJK_family_name_prop {#1} {#2} \cs_gset_protected_nopar:cpx { \__xeCJK_family_nfss_csname:n {#1} } { - \exp_not:N \fontencoding { \c__xeCJK_encoding_tl } - \exp_not:N \fontfamily {#2} + \tl_set:Nx \exp_not:N \f@encoding { \c__xeCJK_encoding_tl } + \tl_set:Nx \exp_not:N \f@family {#2} \exp_not:N \selectfont } } @@ -2179,6 +2448,16 @@ \prop_if_empty:NTF \g__xeCJK_family_font_name_prop { \__xeCJK_warning:n { no-CJKfamily } } { + \tl_gset:Nx \CJKfamilydefault + { + \str_case_x:nnn { \familydefault } + { + { \rmdefault } { \CJKrmdefault } + { \sfdefault } { \CJKsfdefault } + { \ttdefault } { \CJKttdefault } + } + { \CJKfamilydefault } + } \CJKfamily { \CJKfamilydefault } \bool_if:NT \g__xeCJK_math_bool { \xeCJK_set_mathfont: } } @@ -2239,16 +2518,16 @@ \bool_if:NF \l__xeCJK_verb_addon_bool { \bool_set_true:N \l__xeCJK_verb_addon_bool - \__xeCJK_set_char_class_eq:nn { CJK } { FullLeft } - \__xeCJK_set_char_class_eq:nn { CJK } { FullRight } - \__xeCJK_set_char_class_eq:nn { Default } { HalfLeft } - \__xeCJK_set_char_class_eq:nn { Default } { HalfRight } - \__xeCJK_set_char_class_eq:nn { Default } { NormalSpace } + \__xeCJK_set_char_class_eq:nn { FullLeft } { CJK } + \__xeCJK_set_char_class_eq:nn { FullRight } { CJK } + \__xeCJK_set_char_class_eq:nn { HalfLeft } { Default } + \__xeCJK_set_char_class_eq:nn { HalfRight } { Default } + \__xeCJK_set_char_class_eq:nn { NormalSpace } { Default } \xeCJKsetup { xCJKecglue = false } \cs_set_protected_nopar:Npn \CJKglue { \skip_horizontal:N \g__xeCJK_verb_exspace_skip } \cs_set_protected_nopar:Npn \CJKecglue - { \skip_horizontal:N 0.5 \g__xeCJK_verb_exspace_skip } + { \skip_horizontal:n { 0.5 \g__xeCJK_verb_exspace_skip } } \cs_set_eq:NN \xeCJK_check_for_glue: \CJKecglue \cs_set_eq:NN \xeCJK_ignore_spaces:w \CJKecglue \skip_set:Nn \tex_rightskip:D { \c_zero_dim plus 1 fil } @@ -2257,24 +2536,29 @@ } \bool_new:N \l__xeCJK_verb_addon_bool \cs_new_eq:NN \CJKfixedspacing \xeCJKVerbAddon -\__xeCJK_after_preamble:n - { \xeCJK_cs_add:Nnn \verbatim@font { } { \xeCJKVerbAddon } } +\__xeCJK_after_preamble:n { \tl_put_right:Nn \verbatim@font { \xeCJKVerbAddon } } \cs_new_protected_nopar:Npn \__xeCJK_set_verb_exspace: { - \tl_if_exist:cTF { xeCJK/verb/\curr@fontshape/\f@size } - { - \skip_gset:Nn \g__xeCJK_verb_exspace_skip - { \tl_use:c { xeCJK/verb/\curr@fontshape/\f@size } } - } + \tl_if_exist:cF { xeCJK/verb/\l_xeCJK_family_tl/\curr@fontshape/\f@size } { - \skip_gset:Nn \g__xeCJK_verb_exspace_skip + \group_begin: + \xeCJK_select_font: + \use:x { - \dim_max:nn - { \c_zero_dim } - { \c_two \tex_fontdimen:D \c_two \tex_font:D - \f@size pt } + \group_end: + \tl_gset:cx + \exp_not:n { { xeCJK/verb/\l_xeCJK_family_tl/\curr@fontshape/\f@size } } + { + \exp_not:N \dim_max:nn { \c_zero_dim } + { + \c_two \tex_fontdimen:D \c_two \tex_font:D - + \dim_use:N \etex_fontcharwd:D \tex_font:D "4E00 + } + } } - \tl_gset:cV { xeCJK/verb/\curr@fontshape/\f@size } \g__xeCJK_verb_exspace_skip } + \skip_gset:Nn \g__xeCJK_verb_exspace_skip + { \use:c { xeCJK/verb/\l_xeCJK_family_tl/\curr@fontshape/\f@size } } } \skip_new:N \g__xeCJK_verb_exspace_skip \cs_new_protected_nopar:Npn \xeCJK_visible_space_fallback: @@ -2285,30 +2569,34 @@ } } \AtEndOfPackage { - \xeCJK_cs_add:Nnn \fontspec_visible_space: { \scan_stop: } { } + \tl_put_left:Nn \fontspec_visible_space: { \scan_stop: } \cs_gset_eq:NN \fontspec_visible_space_fallback: \xeCJK_visible_space_fallback: } \cs_new_protected_nopar:Npn \xeCJK_set_visible_space_font: { \tl_set:Nx \l__xeCJK_current_coor_tl { xeCJK/space/\curr@fontshape/\f@size } - \dim_set:Nn \l__xeCJK_tmp_dim { \tex_fontdimen:D \c_two \tex_font:D } - \fontencoding { \g_fontspec_encoding_tl } - \fontfamily { lmtt } + \exp_after:wN \__xeCJK_set_visible_space_size:n + \exp_after:wN { \dim_use:N \tex_fontdimen:D \c_two \tex_font:D } + \xeCJK_font_gset_to_current:c { \l__xeCJK_current_coor_tl } + } +\cs_new_protected_nopar:Npn \__xeCJK_set_visible_space_size:n #1 + { + \tl_set:Nx \f@encoding { \g_fontspec_encoding_tl } + \tl_set:Nx \f@family { lmtt } \selectfont - \dim_compare:nNnF \l__xeCJK_tmp_dim = { \tex_fontdimen:D \c_two \tex_font:D } + \dim_compare:nNnF {#1} = { \tex_fontdimen:D \c_two \tex_font:D } { \fontsize { \dim_eval:n { - \f@size pt * \dim_ratio:nn - { \l__xeCJK_tmp_dim } { \tex_fontdimen:D \c_two \tex_font:D } + \f@size pt * + \dim_ratio:nn {#1} { \tex_fontdimen:D \c_two \tex_font:D } } } { \f@baselineskip } \selectfont } - \xeCJK_font_gset_to_current:c { \l__xeCJK_current_coor_tl } } \keys_define:nn { xeCJK / options } { @@ -2368,9 +2656,11 @@ \keys_set:nn { xeCJK / options } { CJKglue = { \skip_horizontal:n { \c_zero_dim plus 0.08 \tex_baselineskip:D } } , - CJKecglue = \c_space_token , + CJKecglue = { ~ } , xCJKecglue = false , CheckSingle = false , + PlainEquation = false , + CheckFullRight = false , CJKspace = false , CJKmath = false , CJKnumber = false , @@ -2380,6 +2670,9 @@ EmboldenFactor = 4 , SlantFactor = 0.167 , PunctStyle = quanjiao , + NewLineCS = { \par \[ } , + EnvCS = { \begin \end } , + NoBreakCS = { \footnote \footnotemark \nobreak } , KaiMingPunct = { ^^^^3002 ^^^^ff0e ^^^^ff1f ^^^^ff01 } , LongPunct = { ^^^^2014 ^^^^2015 ^^^^2500 ^^^^2025 ^^^^2026 } , MiddlePunct = { ^^^^2014 ^^^^2015 ^^^^2500 ^^^^00b7 ^^^^30fb ^^^^ff65 } , @@ -2407,7 +2700,7 @@ \tl_if_exist:NF \CJKttdefault { \tl_gset:Nn \CJKttdefault { tt } } \tl_if_exist:NF \CJKfamilydefault { \tl_gset:Nn \CJKfamilydefault { \CJKrmdefault } } \tl_new:c { \__xeCJK_family_csname:n { \CJKfamilydefault } } -\NewDocumentCommand \xeCJKsetup { m } +\NewDocumentCommand \xeCJKsetup { +m } { \keys_set:nn { xeCJK / options } {#1} \tex_ignorespaces:D @@ -2426,16 +2719,62 @@ { \xeCJKsetup { AllowBreakBetweenPuncts = true } } \NewDocumentCommand \xeCJKnobreakbetweenpuncts { } { \xeCJKsetup { AllowBreakBetweenPuncts = false } } -\xeCJK_cs_add:Nnn \rmfamily { \CJKfamily { \CJKrmdefault } } { } -\xeCJK_cs_add:Nnn \sffamily { \CJKfamily { \CJKsfdefault } } { } -\xeCJK_cs_add:Nnn \ttfamily { \CJKfamily { \CJKttdefault } } { } -\xeCJK_cs_add:Nnn \normalfont { \CJKfamily { \CJKfamilydefault } } { } -\cs_set_eq:NN \reset@font \normalfont -\xeCJK_cs_add:Nnn \fontspec_init: { \__xeCJK_gobble_CJKfamily: } { } +\NewDocumentCommand \xeCJKenablefallback { } + { \xeCJKsetup { AutoFallBack = true } } +\NewDocumentCommand \xeCJKdisablefallback { } + { \xeCJKsetup { AutoFallBack = false } } +\NewDocumentCommand \xeCJKsetcharclass { m m m } + { + \xeCJK_set_char_class:nnn {#1} {#2} {#3} + \xeCJKResetPunctClass + } +\__xeCJK_msg_new:nn { conflict-package } + { + The~`#1'~package~is~in~conflict~with~xeCJK. \\ + Please~do~not~use~it~or~load~it~after~xeCJK. + } +\xeCJK_if_package_loaded:nTF { realscripts } + { + \@ifpackagelater { realscripts } { 2010/10/10 } { } + { \__xeCJK_error:nx { conflict-package } { xltxtra } } + } + { + \cs_new_eq:NN \__xeCJK_dim_max:nn \dim_max:nn + \cs_new_eq:NN \__xeCJK_dim_min:nn \dim_min:nn + \__xeCJK_at_end_preamble:n + { + \xeCJK_if_package_loaded:nT { realscripts } + { + \@ifpackagelater { realscripts } { 2010/10/10 } { } + { + \cs_gset_eq:NN \dim_max:nn \__xeCJK_dim_max:nn + \cs_gset_eq:NN \dim_min:nn \__xeCJK_dim_min:nn + } + } + \cs_undefine:N \__xeCJK_dim_max:nn + \cs_undefine:N \__xeCJK_dim_min:nn + } + } +\RenewDocumentCommand \fontfamily { m } + { + \tl_set:Nx \f@family {#1} + \__xeCJK_update_family:n + { + \str_case_x:nnn {#1} + { + { \rmdefault } { \CJKfamily { \CJKrmdefault } } + { \sfdefault } { \CJKfamily { \CJKsfdefault } } + { \ttdefault } { \CJKfamily { \CJKttdefault } } + { \familydefault } { \CJKfamily { \CJKfamilydefault } } + } + { } + } + } +\cs_new_eq:NN \__xeCJK_update_family:n \use:n \cs_new_eq:NN \xeCJK@fix@penalty \fix@penalty -\xeCJK_cs_patch:Nnn \xeCJK@fix@penalty \@@italiccorr \xeCJK@patch@italiccorr -\xeCJK_cs_patch:Nnn \sw@slant \fix@penalty \xeCJK@fix@penalty -\cs_new_protected_nopar:Npn \xeCJK@patch@italiccorr +\tl_replace_once:Nnn \xeCJK@fix@penalty { \@@italiccorr } { \xeCJK@italiccorr } +\tl_replace_once:Nnn \sw@slant { \fix@penalty } { \xeCJK@fix@penalty } +\cs_new_protected_nopar:Npn \xeCJK@italiccorr { \int_compare:nNnTF \XeTeXinterchartokenstate > \c_zero { @@ -2472,18 +2811,18 @@ \__xeCJK_after_end_preamble:n { \int_compare:nNnF - { \c_three + ( \seq_count:N \g__xeCJK_class_seq ) } = \xe@alloc@intercharclass + { \c_three + \seq_count:N \g__xeCJK_new_class_seq } = \xe@alloc@intercharclass { \int_step_inline:nnnn \c_four \c_one \xe@alloc@intercharclass { - \seq_if_in:NnF \g__xeCJK_class_seq {#1} + \seq_if_in:NnF \g__xeCJK_new_class_seq {#1} { \__xeCJK_set_others_toks:n {#1} } } } } \cs_new_protected_nopar:Npn \__xeCJK_set_others_toks:n #1 { - \int_set:Nn \c__xeCJK_Others_class_int {#1} + \int_set:cn { \__xeCJK_class_csname:n { Others } } {#1} \seq_map_inline:Nn \g__xeCJK_CJK_class_seq { \xeCJK_copy_inter_class_toks:nnnn {##1} { Others } {##1} { NormalSpace } @@ -2506,7 +2845,6 @@ } } } -\cs_new_eq:NN \c__xeCJK_Others_class_int \l__xeCJK_tmpa_int \__xeCJK_after_preamble:n { \tl_map_inline:nn @@ -2514,18 +2852,16 @@ \textellipsis \textemdash \textperiodcentered \textcentereddot \textquoteleft \textquoteright \textquotedblleft \textquotedblright } - { - \xeCJK_cs_add:Nnn #1 - { \__xeCJK_group_begin: \makexeCJKinactive } { \__xeCJK_group_end: } - } - \xeCJK_cs_add:Nnn \tipaencoding { \makexeCJKinactive } { } + { \cs_gset_nopar:Npx #1 { { \makexeCJKinactive \exp_not:o {#1} } } } + \tl_put_left:Nn \tipaencoding { \makexeCJKinactive } \cs_new_eq:NN \__xeCJK_aux_r:n \r \cs_set_nopar:Npn \r #1 { { \makexeCJKinactive \__xeCJK_aux_r:n {#1} } } \xeCJK_if_package_loaded:nT { pifont } - { \xeCJK_cs_add:Nnn \Pifont { \makexeCJKinactive } { } } + { + \RenewDocumentCommand \Pifont { m } + { \makexeCJKinactive \usefont { U } {#1} { m } { n } } + } } -\cs_new_eq:NN \__xeCJK_group_begin: \group_begin: -\cs_new_eq:NN \__xeCJK_group_end: \group_end: \__xeCJK_after_end_preamble:n { \xeCJK_if_package_loaded:nT { hyperref } @@ -2534,8 +2870,6 @@ { \__xeCJK_gobble_CJKfamily: \xeCJK_cs_clear:N \makexeCJKinactive - \xeCJK_cs_clear:N \__xeCJK_group_begin: - \xeCJK_cs_clear:N \__xeCJK_group_end: } } } @@ -2546,6 +2880,7 @@ { \exp_after:wN \tex_let:D \cs:w cprotect \cs_end: \icprotect } } \tl_set:cn { ver@CJK.sty } { 9999/99/99 } +\tl_set_eq:cc { ver@CJKulem.sty } { ver@CJK.sty } \tl_set_eq:cc { ver@CJKpunct.sty } { ver@CJK.sty } \cs_if_exist:NF \CJK@ifundefined { \cs_set_eq:NN \CJK@ifundefined \cs_if_free:NTF } @@ -2560,44 +2895,22 @@ } \XeTeXdefaultencoding "UTF-8" } -\cs_new_protected_nopar:Npn \xeCJK_hook_for_ulem: +\cs_if_eq:NNTF \ifCTEX@fntef \tex_iftrue:D + { \RequirePackage { xeCJKfntef } } { - \bool_if:NF \l__xeCJK_ulem_hook_used_bool + \__xeCJK_at_end_preamble:n { - \bool_set_true:N \l__xeCJK_ulem_hook_used_bool - \xeCJK_cs_clear:N \__xeCJK_CJK_FullLeft_glue: - \cs_set_protected_nopar:Npn \__xeCJK_FullLeft_ulem_hook: { { \CJKglue } } - \xeCJK_swap_cs:NN \CJKsymbol \__xeCJK_ulem_CJKsymbol:N - \xeCJK_swap_cs:NN \CJKpunctsymbol \__xeCJK_ulem_CJKpunctsymbol:N - } - } -\bool_new:N \l__xeCJK_ulem_hook_used_bool -\__xeCJK_after_preamble:n - { - \xeCJK_if_package_loaded:nT { ulem } - { - \xeCJK_cs_gclear:N \__xeCJK_FullLeft_ulem_hook: - \xeCJK_pre_inter_class_toks:nnn { Boundary } { FullLeft } - { \__xeCJK_FullLeft_ulem_hook: } - \cs_if_exist:NTF \XeTeX@CJKfntef@hook + \xeCJK_if_package_loaded:nF { xeCJKfntef } { - \xeCJK_cs_gclear:N \CJKf@global - \AtBeginEnvironment - { CJKfilltwosides } { \cs_set_eq:NN \CJKglue \tex_hfil:D } - \cs_set_protected_nopar:Npn \XeTeX@CJKfntef@hook - { \xeCJK_select_font: \makexeCJKinactive } + \xeCJK_if_package_loaded:nTF { CJKfntef } + { \RequirePackage { xeCJKfntef } } + { + \xeCJK_if_package_loaded:nT { ulem } + { \RequirePackage { xeCJKfntef } } + } } - { \RequirePackage { CJKulem } } - \addto@hook \UL@hook { \xeCJK_hook_for_ulem: } } } -\cs_new_protected_nopar:Npn \__xeCJK_ulem_CJKsymbol:N #1 - { - { \__xeCJK_ulem_CJKsymbol:N {#1} } - { \xeCJK_make_node:n { CJK } } \xeCJK_ignore_spaces:w - } -\cs_new_protected_nopar:Npn \__xeCJK_ulem_CJKpunctsymbol:N #1 - { { \__xeCJK_ulem_CJKpunctsymbol:N {#1} } \tex_ignorespaces:D } \bool_if:NT \g__xeCJK_number_bool { \tl_set:Nn \CJK@UnicodeEnc { UTF8 } @@ -2622,6 +2935,7 @@ %% xeCJK.sty, %% xeCJK.cfg, %% xeCJK.ins, +%% xeCJKfntef.sty, %% xeCJK-example-autofake.tex, %% xeCJK-example-fallback.tex, %% xeCJK-example-subCJKblock.tex, diff --git a/Master/texmf-dist/tex/xelatex/xecjk/xeCJKfntef.sty b/Master/texmf-dist/tex/xelatex/xecjk/xeCJKfntef.sty new file mode 100644 index 00000000000..6d3e152a498 --- /dev/null +++ b/Master/texmf-dist/tex/xelatex/xecjk/xeCJKfntef.sty @@ -0,0 +1,339 @@ +%% +%% This is file `xeCJKfntef.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% xeCJK.dtx (with options: `fntef') +%% +%% $Id: xeCJK.dtx 382 2012-12-13 04:58:22Z sobenlee $ +%% $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ +%% ----------------------------------------------------------------- +%% Author: +%% Wenchang Sun +%% Current Maintainers: +%% Leo Liu +%% Qing Lee +%% +%% Copyright (C) 2007--2012 Wenchang Sun +%% +%% This file may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either version 1.3 +%% of this license or (at your option) any later version. +%% The latest version of this license is in +%% http://www.latex-project.org/lppl.txt +%% and version 1.3 or later is part of all distributions of LaTeX +%% version 2005/12/01 or later. +%% +%% This work has the LPPL maintenance status "maintained". +%% The Current Maintainer of this work are Leo Liu and Qing Lee. +%% ----------------------------------------------------------------- +%% +\NeedsTeXFormat{LaTeX2e} +\RequirePackage{expl3} +\GetIdInfo$Id: xeCJK.dtx 382 2012-12-13 04:58:22Z sobenlee $ + {xeCJK patch file for ulem/CJKfntef} +\ProvidesExplPackage + {xeCJKfntef} + {\ExplFileDate}{3.1.1}{\ExplFileDescription} +\PassOptionsToPackage { normalem } { ulem } +\DeclareOption* { \PassOptionsToPackage { \CurrentOption } { ulem } } +\ProcessOptions \scan_stop: +\@ifpackageloaded { xeCJK } + { } + { \RequirePackage { xeCJK } } +\RequirePackage { ulem } +\RequirePackage { CJKfntef } +\addto@hook \UL@hook { \xeCJK_hook_for_ulem: } +\cs_new_protected_nopar:Npn \xeCJK_hook_for_ulem: + { + \bool_if:NF \l__xeCJK_ulem_hook_used_bool + { + \bool_set_true:N \l__xeCJK_ulem_hook_used_bool + \xeCJKsetup { CheckFullRight = false } + \bool_if:NTF \l__xeCJK_ulem_skip_punct_bool + { \cs_set_eq:NN \__xeCJK_ulem_leader_type: \UL@leadtype } + { + \xeCJK_cs_clear:N \__xeCJK_ulem_skip_punct_begin: + \xeCJK_cs_clear:N \__xeCJK_ulem_skip_punct_end: + } + \__xeCJK_ulem_initial: + \xeCJK_glue_to_skip:nN + { + \cs_set_eq:NN \ \tex_space:D + \cs_set_eq:NN \penalty \tex_penalty:D + \cs_set_eq:NN \hskip \skip_horizontal:N + \CJKglue + } \l__xeCJK_ccglue_skip + \xeCJK_glue_to_skip:nN + { + \cs_set_eq:NN \ \tex_space:D + \cs_set_eq:NN \penalty \tex_penalty:D + \cs_set_eq:NN \hskip \skip_horizontal:N + \CJKecglue + } \l__xeCJK_ecglue_skip + \cs_set_protected_nopar:Npn \CJKglue + { \__xeCJK_ulem_glue:n \l__xeCJK_ccglue_skip } + \cs_set_protected_nopar:Npn \CJKecglue + { \__xeCJK_ulem_glue:n \l__xeCJK_ecglue_skip } + } + } +\bool_new:N \l__xeCJK_ulem_hook_used_bool +\cs_set_eq:NN \CJK@UL \CJK@@UL +\tl_replace_once:Nnn \CJK@UL { \ULon } + { \bool_set_true:N \l__xeCJK_ulem_skip_punct_bool \ULon } +\tl_replace_once:Nnn \CJK@@UL { \ULon } + { \bool_set_false:N \l__xeCJK_ulem_skip_punct_bool \ULon } +\bool_new:N \l__xeCJK_ulem_skip_punct_bool +\cs_new_protected_nopar:Npn \__xeCJK_ulem_skip_punct_begin: + { \xeCJK_cs_clear:N \UL@leadtype } +\cs_new_protected_nopar:Npn \__xeCJK_ulem_skip_punct_end: + { \cs_set_eq:NN \UL@leadtype \__xeCJK_ulem_leader_type: } +\xeCJK_cs_clear:N \__xeCJK_ulem_leader_type: +\cs_new_protected_nopar:Npn \__xeCJK_ulem_initial: + { + \cs_set_eq:NN \__xeCJK_punct_hskip:n \__xeCJK_ulem_hskip:n + \cs_set_eq:NN + \__xeCJK_Default_and_FullLeft_glue:N \__xeCJK_ulem_Default_and_FullLeft_glue:N + \cs_set_eq:NN + \__xeCJK_Default_and_FullRight_glue:N \__xeCJK_ulem_Default_and_FullRight_glue:N + \cs_set_eq:NN + \__xeCJK_CJK_and_FullLeft_glue:N \__xeCJK_ulem_CJK_and_FullLeft_glue:N + \cs_set_eq:NN + \__xeCJK_CJK_and_FullRight_glue:N \__xeCJK_ulem_CJK_and_FullRight_glue:N + \cs_set_eq:NN + \__xeCJK_Boundary_and_FullLeft_glue:N \__xeCJK_ulem_Boundary_and_FullLeft_glue:N + \cs_set_eq:NN \xeCJK_FullLeft_and_Default: \__xeCJK_ulem_FullLeft_and_Default: + \cs_set_eq:NN \xeCJK_FullLeft_and_CJK: \__xeCJK_ulem_FullLeft_and_CJK: + \cs_set_eq:NN \xeCJK_FullRight_and_Default: \__xeCJK_ulem_FullRight_and_Default: + \cs_set_eq:NN \xeCJK_FullRight_and_CJK: \__xeCJK_ulem_FullRight_and_CJK: + \cs_set_eq:NN \xeCJK_CJK_and_CJK:N \__xeCJK_ulem_CJK_and_CJK:N + \seq_map_inline:Nn \g__xeCJK_CJK_sub_class_seq + { + \seq_map_inline:Nn \g__xeCJK_CJK_sub_class_seq + { + \str_if_eq:nnTF {##1} {####1} + { + \xeCJK_inter_class_toks:nnn { CJK } { CJK/##1 } + { \__xeCJK_ulem_between_CJK_blocks:nnN { CJK } {##1} } + \xeCJK_inter_class_toks:nnn { CJK/##1 } { CJK/##1 } + { \__xeCJK_ulem_between_CJK_blocks:nnN { CJK } {##1} } + } + { + \xeCJK_inter_class_toks:nnn { CJK/##1 } { CJK/####1 } + { \__xeCJK_ulem_between_CJK_blocks:nnN {##1} {####1} } + } + } + } + } +\cs_new_protected_nopar:Npn \__xeCJK_ulem_CJK_and_CJK:N + { + \xeCJK_class_group_end: + \UL@stop \__xeCJK_ulem_ccglue: \UL@start + \__xeCJK_ulem_class_group_begin: + \CJKsymbol + } +\cs_new_protected_nopar:Npn \__xeCJK_ulem_class_group_begin: + { + \xeCJK_class_group_begin: + \xeCJK_clear_Boundary_and_CJK_toks: + \xeCJK_select_font: + } +\cs_new_protected_nopar:Npn \__xeCJK_ulem_between_CJK_blocks:nnN #1#2 + { + \xeCJK_class_group_end: + \UL@stop \__xeCJK_ulem_ccglue: \UL@start + \xeCJK_class_group_begin: + \xeCJK_clear_Boundary_and_CJK_toks: + \__xeCJK_switch_font:nn {#1} {#2} + \CJKsymbol + } +\cs_new_protected_nopar:Npn \__xeCJK_ulem_Default_and_FullLeft_glue:N #1 + { + \UL@stop + \__xeCJK_ulem_skip_punct_begin: + \__xeCJK_punct_glue:NN \c__xeCJK_left_tl {#1} + \UL@start + } +\cs_new_protected_nopar:Npn \__xeCJK_ulem_Boundary_and_FullLeft_glue:N #1 + { + \UL@stop + \__xeCJK_ulem_skip_punct_begin: + \int_compare:nNnF \etex_lastnodetype:D = \c_one + { \__xeCJK_punct_glue:NN \c__xeCJK_left_tl {#1} } + \UL@start + } +\cs_new_protected_nopar:Npn \__xeCJK_ulem_CJK_and_FullLeft_glue:N #1 + { + \xeCJK_class_group_end: + \UL@stop + \__xeCJK_ulem_skip_punct_begin: + \__xeCJK_ulem_ccglue: + \__xeCJK_punct_glue:NN \c__xeCJK_left_tl {#1} + \UL@start + \__xeCJK_ulem_class_group_begin: + } +\cs_new_protected_nopar:Npn \__xeCJK_ulem_Default_and_FullRight_glue:N #1 + { + \UL@stop + \__xeCJK_ulem_skip_punct_begin: + \__xeCJK_punct_if_long:NTF {#1} + { \__xeCJK_ulem_ccglue: } + { + \__xeCJK_punct_if_middle:NT {#1} + { + \xeCJK_no_break: + \__xeCJK_punct_glue:NN \c__xeCJK_right_tl {#1} + } + \xeCJK_no_break: + } + \UL@start + } +\cs_new_protected_nopar:Npn \__xeCJK_ulem_CJK_and_FullRight_glue:N #1 + { + \xeCJK_class_group_end: + \__xeCJK_ulem_Default_and_FullRight_glue:N {#1} + \__xeCJK_ulem_class_group_begin: + } +\cs_new_protected_nopar:Npn \__xeCJK_ulem_FullLeft_and_Default: + { + \__xeCJK_punct_if_middle:NTF \g__xeCJK_last_punct_tl + { + \xeCJK_get_punct_bounds:NN \c__xeCJK_left_tl \g__xeCJK_last_punct_tl + \__xeCJK_punct_rule:NN \c__xeCJK_right_tl \g__xeCJK_last_punct_tl + \xeCJK_class_group_end: \UL@stop \xeCJK_no_break: + \__xeCJK_punct_glue:NN \c__xeCJK_left_tl \g__xeCJK_last_punct_tl + } + { \xeCJK_class_group_end: \UL@stop } + \__xeCJK_ulem_skip_punct_end: + \xeCJK_no_break: + \UL@start + } +\cs_new_protected_nopar:Npn \__xeCJK_ulem_FullLeft_and_CJK: + { + \__xeCJK_ulem_FullLeft_and_Default: + \__xeCJK_ulem_class_group_begin: + } +\cs_new_protected_nopar:Npn \__xeCJK_ulem_FullRight_and_Default: + { + \__xeCJK_punct_rule:NN \c__xeCJK_right_tl \g__xeCJK_last_punct_tl + \xeCJK_class_group_end: + \UL@stop + \__xeCJK_punct_glue:NN \c__xeCJK_right_tl \g__xeCJK_last_punct_tl + \__xeCJK_ulem_skip_punct_end: + \UL@start + } +\cs_new_protected_nopar:Npn \__xeCJK_ulem_FullRight_and_CJK: + { + \__xeCJK_punct_rule:NN \c__xeCJK_right_tl \g__xeCJK_last_punct_tl + \xeCJK_class_group_end: + \UL@stop + \__xeCJK_punct_glue:NN \c__xeCJK_right_tl \g__xeCJK_last_punct_tl + \__xeCJK_ulem_ccglue: + \__xeCJK_ulem_skip_punct_end: + \UL@start + \__xeCJK_ulem_class_group_begin: + } +\cs_new_protected_nopar:Npn \__xeCJK_ulem_glue:n #1 + { + \cs_if_eq:NNTF \ \LA@space + { \skip_horizontal:n {#1} } + { \UL@stop \__xeCJK_ulem_hskip:n {#1} \UL@start } + } +\cs_new_protected_nopar:Npn \__xeCJK_ulem_ccglue: + { \skip_set_eq:NN \UL@skip \l__xeCJK_ccglue_skip \UL@leaders } +\cs_new_protected_nopar:Npn \__xeCJK_ulem_hskip:n #1 + { + \int_compare:nNnTF \tex_lastkern:D = \c_three + { \skip_horizontal:n {#1} } + { \skip_set:Nn \UL@skip {#1} \UL@leaders } + } +\RenewDocumentCommand \CJKunderdot { m } + { + \bool_if:NT \l__xeCJK_ulem_hook_used_bool { \UL@stop } + \CJK@preUnderdot + \__xeCJK_make_under_symbol:n { \CJK@underdotSkip } + \cs_gset_eq:NN \__xeCJK_save_under_dot_CJKsymbol:N \CJKsymbol + \cs_set_eq:NN \CJKsymbol \__xeCJK_under_CJKsymbol:N + \bool_if:NT \l__xeCJK_ulem_hook_used_bool { \UL@start } + #1 + \bool_if:NT \l__xeCJK_ulem_hook_used_bool { \UL@stop } + \cs_set_eq:NN \CJKsymbol \__xeCJK_save_under_dot_CJKsymbol:N + \CJK@postUnderdot + \bool_if:NT \l__xeCJK_ulem_hook_used_bool { \UL@start } + \tex_ignorespaces:D + } +\box_new:N \g__xeCJK_under_symbol_box +\RenewDocumentCommand \CJKunderanysymbol { m m m } + { + \group_begin: + \hbox_set:Nn \CJK@underdotBox {#2} + \__xeCJK_make_under_symbol:n {#1} + \cs_gset_eq:NN \__xeCJK_save_under_dot_CJKsymbol:N \CJKsymbol + \cs_set_eq:NN \CJKsymbol \__xeCJK_under_CJKsymbol:N + #3 + \group_end: + \tex_ignorespaces:D + } +\cs_new_protected:Npn \__xeCJK_make_under_symbol:n #1 + { + \hbox_set:Nn \l__xeCJK_tmp_box { ^^^^4e00 } + \vbox_gset_to_ht:Nnn \g__xeCJK_under_symbol_box \c_zero_dim + { + \skip_vertical:n {#1} + \hbox_to_zero:n + { + \tex_kern:D - \box_wd:N \l__xeCJK_tmp_box + \tex_hss:D \box_use:N \CJK@underdotBox \tex_hss:D + } + \tex_vss:D + } + } +\cs_new_protected_nopar:Npn \__xeCJK_under_CJKsymbol:N #1 + { + \__xeCJK_save_under_dot_CJKsymbol:N {#1} + \hbox_overlap_left:n { \box_use:N \g__xeCJK_under_symbol_box } + { \xeCJK_make_node:n { CJK } } + \xeCJK_ignore_spaces:w + } +\RenewDocumentEnvironment { CJKfilltwosides } { m } + { + \dim_set:Nn \l__xeCJK_fill_width_dim {#1} + \cs_set_eq:NN \CJKglue \tex_hfil:D + \cs_set_eq:NN \\ \__xeCJK_fill_newline: + \mode_if_vertical:T { \tex_indent:D } + \tex_vbox:D \c_group_begin_token + \tex_hbox:D to \l__xeCJK_fill_width_dim \c_group_begin_token + \tex_ignorespaces:D + } + { + \tex_unskip:D + \c_group_end_token + \c_group_end_token + } +\dim_new:N \l__xeCJK_fill_width_dim +\cs_new_protected_nopar:Npn \__xeCJK_fill_newline: + { + \tex_unskip:D + \c_group_end_token + \tex_hbox:D to \l__xeCJK_fill_width_dim \c_group_begin_token + \tex_ignorespaces:D + } +%% +%% This package consists of the file xeCJK.dtx +%% and the derived files xeCJK.pdf, +%% xeCJK.sty, +%% xeCJK.cfg, +%% xeCJK.ins, +%% xeCJKfntef.sty, +%% xeCJK-example-autofake.tex, +%% xeCJK-example-fallback.tex, +%% xeCJK-example-subCJKblock.tex, +%% xeCJK-example-CJKecglue.tex, +%% xeCJK-example-checksingle.tex, +%% xeCJK-example-CJKfntef.tex, +%% xeCJK-example-punctstyle.tex, +%% xeCJK-example-verbatim.tex, and +%% README.txt. +%% +%% End of file `xeCJKfntef.sty'. -- cgit v1.2.3