From c9afdb0f95d5ffff9dd84394bfded0f52b4278e4 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sun, 7 Apr 2019 21:28:36 +0000 Subject: xecjk (7apr19) git-svn-id: svn://tug.org/texlive/trunk@50852 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/tex/xelatex/xecjk/xeCJK.sty | 515 +++++++++++++------------- 1 file changed, 261 insertions(+), 254 deletions(-) (limited to 'Master/texmf-dist/tex/xelatex/xecjk/xeCJK.sty') diff --git a/Master/texmf-dist/tex/xelatex/xecjk/xeCJK.sty b/Master/texmf-dist/tex/xelatex/xecjk/xeCJK.sty index f67e2e68ff9..410feb3846b 100644 --- a/Master/texmf-dist/tex/xelatex/xecjk/xeCJK.sty +++ b/Master/texmf-dist/tex/xelatex/xecjk/xeCJK.sty @@ -7,8 +7,8 @@ %% xeCJK.dtx (with options: `package') %% %% Copyright (C) 2007--2010 by Wenchang Sun -%% Copyright (C) 2009--2018 by Leo Liu -%% Copyright (C) 2012--2018 by Qing Lee +%% Copyright (C) 2009--2019 by Leo Liu +%% Copyright (C) 2012--2019 by Qing Lee %% ---------------------------------------------------------------------- %% %% This work may be distributed and/or modified under the @@ -29,10 +29,10 @@ %% \NeedsTeXFormat{LaTeX2e} \RequirePackage{expl3} -\GetIdInfo$Id: xeCJK.dtx b604170 2018-04-30 10:29:28 +0800 Liu Haiyang $ +\GetIdInfo$Id: xeCJK.dtx 8be031f 2019-04-07 23:30:14 +0800 Qing Lee $ {Typesetting CJK scripts with XeLaTeX} \ProvidesExplPackage{\ExplFileName} - {\ExplFileDate}{3.7.1}{\ExplFileDescription} + {\ExplFileDate}{3.7.2}{\ExplFileDescription} \msg_new:nnn { xeCJK } { Require-XeTeX } { The~xeCJK~package~requires~XeTeX~to~function.\\\\ @@ -49,7 +49,7 @@ using~your~TeX~package~manager~or~from~CTAN.\\ \str_if_eq:nnT {#1} { expl3 } { Loading~xeCJK~will~abort! } } -\@ifpackagelater { expl3 } { 2017/12/16 } { } +\@ifpackagelater { expl3 } { 2019/03/05 } { } { \msg_critical:nnn { xeCJK } { l3-too-old } { expl3 } } \prg_new_conditional:Npnn \xeCJK_if_package_loaded:n #1 { p , T , F , TF } { @@ -99,9 +99,10 @@ \cs_new_protected_nopar:Npn \__xeCJK_warning:nxxx { \msg_warning:nnxxx { xeCJK } } \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 } + { \tex_penalty:D \c_zero_int } \cs_new_protected_nopar:Npn \xeCJK_no_break: - { \tex_penalty:D \c_ten_thousand } + { \tex_penalty:D \c__xeCJK_ten_thousand_int } +\int_const:Nn \c__xeCJK_ten_thousand_int { 10 000 } \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 @@ -183,23 +184,23 @@ } \cs_new_protected_nopar:Npn \xeCJK_font_gset_to_current:c #1 { - \exp_after:wN \cs_gset_eq:NN - \cs:w #1 \exp_after:wN \cs_end: \tex_the:D \tex_font:D + \exp_last_unbraced:Nco \cs_gset_eq:NN + {#1} \tex_the:D \tex_font:D } \prg_new_conditional:Npnn \xeCJK_glyph_if_exist:N #1 { p , T , F , TF } { - \etex_iffontchar:D \tex_font:D `#1 \exp_stop_f: + \tex_iffontchar:D \tex_font:D `#1 \exp_stop_f: \prg_return_true: \else: \prg_return_false: \fi: } \tl_const:Nn \c_xeCJK_space_skip_tl { - \int_compare:nNnTF \g__xeCJK_space_factor_int = \c_one_thousand + \int_compare:nNnTF \g__xeCJK_space_factor_int = { 1000 } { \skip_if_eq:nnTF \tex_spaceskip:D \c_zero_skip { - \tex_fontdimen:D \c_two \tex_font:D - plus \tex_fontdimen:D \c_three \tex_font:D - minus \tex_fontdimen:D \c_four \tex_font:D + \tex_fontdimen:D 2 ~ \tex_font:D + plus \tex_fontdimen:D 3 ~ \tex_font:D + minus \tex_fontdimen:D 4 ~ \tex_font:D } { \tex_spaceskip:D } } @@ -209,21 +210,21 @@ \int_compare:nNnTF \g__xeCJK_space_factor_int < { 2000 } { \__xeCJK_space_skip_scale:nnn - { \tex_fontdimen:D \c_two \tex_font:D } + { \tex_fontdimen:D 2 ~ \tex_font:D } } { \skip_if_eq:nnTF \tex_xspaceskip:D \c_zero_skip { \__xeCJK_space_skip_scale:nnn { - \tex_fontdimen:D \c_two \tex_font:D + - \tex_fontdimen:D \c_seven \tex_font:D + \tex_fontdimen:D 2 ~ \tex_font:D + + \tex_fontdimen:D 7 ~ \tex_font:D } } { \tex_xspaceskip:D \use_none:nn } } - { \tex_fontdimen:D \c_three \tex_font:D } - { \tex_fontdimen:D \c_four \tex_font:D } + { \tex_fontdimen:D 3 ~ \tex_font:D } + { \tex_fontdimen:D 4 ~ \tex_font:D } } { \int_compare:nNnTF \g__xeCJK_space_factor_int < { 2000 } @@ -234,13 +235,13 @@ \__xeCJK_space_skip_scale:nnn { \tex_spaceskip:D + - \tex_fontdimen:D \c_seven \tex_font:D + \tex_fontdimen:D 7 ~ \tex_font:D } } { \tex_xspaceskip:D \use_none:nn } } - { \etex_gluestretch:D \tex_spaceskip:D } - { \etex_glueshrink:D \tex_spaceskip:D } + { \tex_gluestretch:D \tex_spaceskip:D } + { \tex_glueshrink:D \tex_spaceskip:D } } } } @@ -250,32 +251,32 @@ plus \fp_eval:n { \g__xeCJK_space_factor_int / 1000 } #2 minus \int_div_truncate:nn - { 1000 * \tex_number:D #3 } { \g__xeCJK_space_factor_int } sp + { 1000 * \int_value:w #3 } { \g__xeCJK_space_factor_int } sp } \int_new:N \g__xeCJK_space_factor_int -\int_gset_eq:NN \g__xeCJK_space_factor_int \c_one_thousand +\int_gset:Nn \g__xeCJK_space_factor_int { 1000 } \cs_new_protected_nopar:Npn \xeCJK_glue_to_skip:nN #1#2 { \group_begin: - \hbox_set:Nw \l__xeCJK_tmp_box #1 \scan_stop: - \int_compare:nNnTF \etex_lastnodetype:D = \c_eleven - { - \exp_after:wN \hbox_set_end: \exp_after:wN \group_end: \exp_after:wN - \skip_set:Nn \exp_after:wN #2 \exp_after:wN - { \skip_use:N \tex_lastskip:D } - } - { - \hbox_set_end: \exp_after:wN \group_end: \exp_after:wN - \skip_set:Nn \exp_after:wN #2 \exp_after:wN - { \dim_use:N \box_wd:N \l__xeCJK_tmp_box } - } + \hbox_set:Nw \l__xeCJK_tmp_box #1 \scan_stop: + \int_compare:nNnTF \tex_lastnodetype:D = { 11 } + { + \exp_args:NNNo \hbox_set_end: + \skip_set:Nn #2 { \skip_use:N \tex_lastskip:D } + } + { + \exp_args:NNNo \hbox_set_end: + \skip_set:Nn #2 { \dim_use:N \box_wd:N \l__xeCJK_tmp_box } + } + \exp_args:NNNo \group_end: + \skip_set:Nn #2 { \skip_use:N #2 } } \prg_new_conditional:Npnn \xeCJK_if_blank_x:n #1 { p , T , F , TF } { - \if_case:w \pdftex_strcmp:D { } {#1} \exp_stop_f: + \if_case:w \tex_strcmp:D { } {#1} \exp_stop_f: \prg_return_true: \else: - \if_case:w \pdftex_strcmp:D { ~ } {#1} \exp_stop_f: + \if_case:w \tex_strcmp:D { ~ } {#1} \exp_stop_f: \prg_return_true: \else: \prg_return_false: \fi: \fi: } @@ -336,7 +337,7 @@ \fi: } \cs_new_nopar:Npn \xeCJK_token_value_class:N #1 - { \xetex_charclass:D \xeCJK_token_value_charcode:N #1 } + { \tex_XeTeXcharclass:D \xeCJK_token_value_charcode:N #1 } \cs_new_nopar:Npn \xeCJK_token_value_charcode:N #1 { \exp_after:wN \__xeCJK_get_charcode:w \token_to_meaning:N #1 \q_stop } \group_begin: @@ -393,9 +394,9 @@ xeCJKactive .default:n = { true } } \NewDocumentCommand \makexeCJKactive { } - { \xetex_interchartokenstate:D = \c_one } + { \tex_XeTeXinterchartokenstate:D = \c_one_int } \NewDocumentCommand \makexeCJKinactive { } - { \xetex_interchartokenstate:D = \c_zero } + { \tex_XeTeXinterchartokenstate:D = \c_zero_int } \char_set_catcode_ignore:n { "FEFF } \seq_new:N \g__xeCJK_class_seq \seq_new:N \g__xeCJK_new_class_seq @@ -429,24 +430,24 @@ XeTeX~character~class~`#1'~has~been~already~defined.\\\\ Please~take~another~name. \\ } -\xeCJK_save_class:nn { Default } { \c_zero } -\tl_set:Nx \l__xeCJK_tmp_tl - { \int_use:N \xetex_XeTeXversion:D \xetex_XeTeXrevision:D } -\fp_compare:nNnTF { \l__xeCJK_tmp_tl } > { 0.99993 } +\xeCJK_save_class:nn { Default } { 0 } +\str_const:Nx \c__xeCJK_xetex_version_str + { \int_use:N \tex_XeTeXversion:D \tex_XeTeXrevision:D } +\fp_compare:nNnTF { \c__xeCJK_xetex_version_str } > { 0.99993 } { \xeCJK_save_class:nn { Boundary } { 4095 } } - { \xeCJK_save_class:nn { Boundary } { \c_two_hundred_fifty_five } } -\int_compare:nNnTF { \xetex_charclass:D "4E00 } = \c_one + { \xeCJK_save_class:nn { Boundary } { 255 } } +\int_compare:nNnTF { \tex_XeTeXcharclass:D "4E00 } = \c_one_int { - \xeCJK_save_class:nn { CJK } { \c_one } - \xeCJK_save_class:nn { FullLeft } { \c_two } - \xeCJK_save_class:nn { FullRight } { \c_three } - \int_const:Nn \c__xeCJK_class_begin_int { \c_three } + \xeCJK_save_class:nn { CJK } { 1 } + \xeCJK_save_class:nn { FullLeft } { 2 } + \xeCJK_save_class:nn { FullRight } { 3 } + \int_const:Nn \c__xeCJK_class_begin_int { 3 } } { \xeCJK_new_class:n { CJK } \xeCJK_new_class:n { FullLeft } \xeCJK_new_class:n { FullRight } - \int_const:Nn \c__xeCJK_class_begin_int { \c_zero } + \int_const:Nn \c__xeCJK_class_begin_int { 0 } } \xeCJK_new_class:n { HalfLeft } \xeCJK_new_class:n { HalfRight } @@ -488,7 +489,7 @@ \AtEndOfPackage { \cs_set:Npn \__xeCJK_tmp:w #1 - { \char_generate:nn {#1} { \c_twelve } } + { \char_generate:nn {#1} { 12 } } \__xeCJK_add_special_punct:nn { middle } { \clist_map_function:NN \c__xeCJK_hyphens_chars_clist \__xeCJK_tmp:w } \cs_undefine:N \__xeCJK_tmp:w @@ -630,7 +631,7 @@ \int_set:Nn \l__xeCJK_tmp_int {#3} \xeCJK_int_until_do:nn { \l__xeCJK_begin_int > \l__xeCJK_end_int } { - \xetex_charclass:D \l__xeCJK_begin_int = \l__xeCJK_tmp_int + \tex_XeTeXcharclass:D \l__xeCJK_begin_int = \l__xeCJK_tmp_int \int_incr:N \l__xeCJK_begin_int } } @@ -638,12 +639,12 @@ { \int_set:Nn \l__xeCJK_tmp_int { \xeCJK_class_num:n {#2} } \clist_map_inline:cn { c__xeCJK_#1_chars_clist } - { \xetex_charclass:D ##1 = \l__xeCJK_tmp_int } + { \tex_XeTeXcharclass:D ##1 = \l__xeCJK_tmp_int } } \NewDocumentCommand \normalspacedchars { m } { \tl_map_inline:nn {#1} - { \xetex_charclass:D `##1 = \xeCJK_class_num:n { NormalSpace } } + { \tex_XeTeXcharclass:D `##1 = \xeCJK_class_num:n { NormalSpace } } } \NewDocumentCommand \xeCJKResetPunctClass { } { @@ -671,14 +672,14 @@ \xeCJKResetCharClass \cs_new_protected_nopar:Npn \xeCJK_inter_class_toks:nnn #1#2#3 { - \xetex_interchartoks:D \xeCJK_class_num:n {#1} ~ - \xeCJK_class_num:n {#2} = {#3} + \tex_XeTeXinterchartoks:D \xeCJK_class_num:n {#1} ~ + \xeCJK_class_num:n {#2} = {#3} } \cs_generate_variant:Nn \xeCJK_inter_class_toks:nnn { nnx } \cs_new_nopar:Npn \xeCJK_get_inter_class_toks:nn #1#2 { - \tex_the:D \xetex_interchartoks:D \xeCJK_class_num:n {#1} ~ - \xeCJK_class_num:n {#2} + \tex_the:D \tex_XeTeXinterchartoks:D \xeCJK_class_num:n {#1} ~ + \xeCJK_class_num:n {#2} } \cs_new_protected_nopar:Npn \xeCJK_clear_inter_class_toks:nn #1#2 { \xeCJK_inter_class_toks:nnn {#1} {#2} { \prg_do_nothing: } } @@ -725,7 +726,7 @@ \cs_gset_protected_nopar:Npx \xeCJK_clear_Boundary_and_CJK_toks: { \exp_not:o { \xeCJK_clear_Boundary_and_CJK_toks: } - \xetex_interchartoks:D + \tex_XeTeXinterchartoks:D \xeCJK_class_num:n { Boundary } ~ \xeCJK_class_num:n {#1} = { \exp_not:N \prg_do_nothing: } } @@ -750,8 +751,8 @@ { \c_group_begin_token \bool_set_true:N \l__xeCJK_CJK_group_bool - \int_gset_eq:NN \g__xeCJK_space_factor_int \c_one_thousand - \int_zero:N \xetex_dashbreakstate:D + \int_gset:Nn \g__xeCJK_space_factor_int { 1000 } + \int_zero:N \tex_XeTeXdashbreakstate:D } \bool_new:N \l__xeCJK_CJK_group_bool \cs_new_eq:NN \xeCJK_class_group_end: \c_group_end_token @@ -802,7 +803,7 @@ { \xeCJK_check_for_ecglue: } \cs_new_protected_nopar:Npn \__xeCJK_check_for_xecglue: { - \int_compare:nNnTF \etex_lastnodetype:D = \c_eleven + \int_compare:nNnTF \tex_lastnodetype:D = { 11 } { \__xeCJK_replace_space: } { \__xeCJK_check_for_ecglue: } } @@ -861,7 +862,7 @@ { \xeCJK_check_for_ecglue_normalsp: } \cs_new_protected_nopar:Npn \__xeCJK_check_for_xecglue_normalsp: { - \int_compare:nNnTF \etex_lastnodetype:D = \c_eleven + \int_compare:nNnTF \tex_lastnodetype:D = { 11 } { \__xeCJK_replace_space: } { \__xeCJK_check_for_ecglue_normalsp: } } @@ -896,10 +897,10 @@ } \cs_new_protected_nopar:Npn \xeCJK_check_for_glue: { - \int_compare:nNnTF \etex_lastnodetype:D = \c_twelve + \int_compare:nNnTF \tex_lastnodetype:D = { 12 } { \__xeCJK_check_for_glue_auxi: } { - \int_compare:nNnTF \etex_lastnodetype:D = \c_ten + \int_compare:nNnTF \tex_lastnodetype:D = { 10 } { \xeCJK_remove_node: \CJKecglue } { \__xeCJK_check_for_glue_auxii: } } @@ -911,7 +912,7 @@ { \__xeCJK_node:n { CJK } } { \xeCJK_remove_node: \CJKglue } { \__xeCJK_node:n { CJK-space } } - { \xeCJK_remove_node: \CJKglue } + { \xeCJK_remove_node: \__xeCJK_ccglue_or_space: } { \__xeCJK_node:n { CJK-widow } } { \xeCJK_remove_node: \xeCJK_widow_penalty: \CJKglue } { \__xeCJK_node:n { default } } @@ -937,7 +938,7 @@ \cs_new_eq:NN \xeCJK_check_for_xglue: \prg_do_nothing: \cs_new_protected_nopar:Npn \__xeCJK_check_for_xglue: { - \int_compare:nNnT \etex_lastnodetype:D = \c_eleven + \int_compare:nNnT \tex_lastnodetype:D = { 11 } { \skip_set_eq:NN \l__xeCJK_last_skip \tex_lastskip:D \tex_unskip:D @@ -962,7 +963,7 @@ \xeCJK_if_last_node:nTF { default } { \xeCJK_remove_node: \CJKecglue } { - \int_compare:nNnTF \etex_lastnodetype:D = \c_ten + \int_compare:nNnTF \tex_lastnodetype:D = { 10 } { \CJKecglue } { \skip_horizontal:N \l__xeCJK_last_skip } } @@ -985,7 +986,7 @@ { c__xeCJK_#1_node_dim } { \g__xeCJK_node_int sp } } \int_new:N \g__xeCJK_node_int -\int_gset_eq:NN \g__xeCJK_node_int \c_ten +\int_gset:Nn \g__xeCJK_node_int { 10 } \cs_new_protected_nopar:Npn \xeCJK_make_node:n #1 { \exp_args:Nc \__xeCJK_make_node:N { c__xeCJK_#1_node_dim } } \cs_new_nopar:Npn \__xeCJK_node:n #1 @@ -1063,20 +1064,12 @@ CJKspace / true .code:n = { \bool_set_true:N \l__xeCJK_reserve_space_bool - \cs_set_eq:NN \__xeCJK_ignore_space_end: - \__xeCJK_maybe_reserve_space: - \cs_set_eq:NN \__xeCJK_boundary_group_end_space: - \__xeCJK_boundary_maybe_reserve_space: \cs_set_protected_nopar:Npn \__xeCJK_ccglue_or_space: { \xeCJK_space_glue: } } , CJKspace / false .code:n = { \bool_set_false:N \l__xeCJK_reserve_space_bool - \cs_set_eq:NN \__xeCJK_ignore_space_end: - \group_align_safe_end: - \cs_set_eq:NN \__xeCJK_boundary_group_end_space: - \__xeCJK_boundary_group_end_aux: \cs_set_protected_nopar:Npn \__xeCJK_ccglue_or_space: { \CJKglue } } , @@ -1100,7 +1093,7 @@ { \token_if_macro:NTF \l_peek_token { \__xeCJK_boundary_reserve_space: } - { \__xeCJK_boundary_group_end_space: } + { \__xeCJK_boundary_group_end:n { CJK-space } } } { \token_if_eq_meaning:NNTF \l_peek_token \scan_stop: @@ -1111,18 +1104,9 @@ } \cs_new_protected_nopar:Npn \__xeCJK_boundary_reserve_space: { - \__xeCJK_boundary_group_end_aux: + \__xeCJK_boundary_group_end:n { CJK-space } \xeCJK_space_or_xecglue: } -\cs_new_protected_nopar:Npn \__xeCJK_boundary_maybe_reserve_space: - { - \token_if_letter:NTF \l_peek_token - { \__xeCJK_boundary_reserve_space: } - { \__xeCJK_boundary_group_end_aux: } - } -\cs_new_protected_nopar:Npn \__xeCJK_boundary_group_end_aux: - { \__xeCJK_boundary_group_end:n { CJK-space } } -\cs_new_eq:NN \__xeCJK_boundary_group_end_space: \__xeCJK_boundary_group_end_aux: \cs_new_protected:Npn \__xeCJK_CJK_and_Boundary_relax:N #1 { \__xeCJK_boundary_group_end:n { CJK } @@ -1145,27 +1129,25 @@ { \bool_if:NT \l__xeCJK_peek_ignore_spaces_bool { - \xeCJK_if_last_node:nT { CJK } - { \xeCJK_remove_node: { \xeCJK_make_node:n { CJK-space } } } + \dim_case:nn { \tex_lastkern:D } + { + { \__xeCJK_node:n { CJK } } + { \xeCJK_remove_node: \xeCJK_make_node:n { CJK-space } } + { \__xeCJK_node:n { default } } + { \xeCJK_remove_node: \xeCJK_make_node:n { default-space } } + } \group_align_safe_begin: \token_if_macro:NTF \l_peek_token { \__xeCJK_reserve_space_aux: } - { \__xeCJK_ignore_space_end: } + { \group_align_safe_end: } } } } -\cs_new_protected:Npn \__xeCJK_reserve_space_aux: +\cs_new_protected_nopar:Npn \__xeCJK_reserve_space_aux: { \group_align_safe_end: \xeCJK_space_or_xecglue: } -\cs_new_protected:Npn \__xeCJK_maybe_reserve_space: - { - \token_if_letter:NTF \l_peek_token - { \__xeCJK_reserve_space_aux: } - { \group_align_safe_end: } - } -\cs_new_eq:NN \__xeCJK_ignore_space_end: \group_align_safe_end: \xeCJK_inter_class_toks:nnn { CJK } { CJK } { \xeCJK_CJK_and_CJK:N } \cs_new_protected_nopar:Npn \xeCJK_CJK_and_CJK:N @@ -1205,7 +1187,7 @@ { \xeCJK_class_group_end: \exp_after:wN \xeCJK_punct_node:N \g__xeCJK_last_punct_tl - \xeCJK_no_break: \__xeCJK_zero_glue: + \__xeCJK_nobreak_zero_glue: } \tex_ignorespaces:D } @@ -1263,7 +1245,7 @@ { \tl_if_eq:NNF \l__xeCJK_aligni_tl \c__xeCJK_left_tl { - \int_compare:nNnT \etex_lastnodetype:D = \c_eleven + \int_compare:nNnT \tex_lastnodetype:D = { 11 } { \skip_add:Nn #1 { \tex_lastskip:D } \tex_unskip:D @@ -1364,7 +1346,7 @@ \cs_new_eq:NN \__xeCJK_punct_hskip:n \skip_horizontal:n \cs_new_protected_nopar:Npn \__xeCJK_punct_kern:NN #1#2 { - \str_if_eq_x:nnTF {#1} {#2} + \str_if_eq:eeTF {#1} {#2} { \__xeCJK_punct_nobreak_kern:NN } { \__xeCJK_punct_if_long:NTF #1 @@ -1410,7 +1392,15 @@ \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_class_group_end: + \__xeCJK_nobreak_zero_glue: + } + } +\cs_new_protected_nopar:Npn \__xeCJK_nobreak_zero_glue: + { + \tex_penalty:D \c__xeCJK_ten_thousand_int + \skip_horizontal:N \c_zero_skip } \cs_new_protected_nopar:Npn \__xeCJK_zero_glue: { \skip_horizontal:N \c_zero_skip } @@ -1477,7 +1467,7 @@ { \tl_set_eq:NN \l__xeCJK_alignii_tl \c__xeCJK_left_tl \group_begin: \exp_args:NNc \group_end: \cs_if_exist_use:NTF - { __xeCJK_bound_type_ \int_use:N \etex_lastnodetype:D _glue:Nn } + { __xeCJK_bound_type_ \int_use:N \tex_lastnodetype:D _glue:Nn } {#1} { \use:n } { \__xeCJK_punct_glue:NN \c__xeCJK_left_tl #1 } @@ -1488,7 +1478,7 @@ \cs_new_protected_nopar:cpn { __xeCJK_bound_type_ 1 _glue:Nn } #1#2 { \box_set_to_last:N \l__xeCJK_tmp_box - \int_compare:nNnTF \etex_lastnodetype:D = { -1 } + \int_compare:nNnTF \tex_lastnodetype:D = { -1 } { \dim_compare:nNnTF { \box_wd:N \l__xeCJK_tmp_box } = \tex_parindent:D @@ -1518,9 +1508,9 @@ \skip_if_eq:nnTF { \l__xeCJK_last_skip } { \labelsep } { \tex_unskip:D - \int_compare:nNnTF \etex_lastnodetype:D = \c_thirteen + \int_compare:nNnTF \tex_lastnodetype:D = { 13 } { - \int_compare:nNnTF \tex_lastpenalty:D = \c_zero + \int_compare:nNnTF \tex_lastpenalty:D = \c_zero_int { \skip_horizontal:N \l__xeCJK_last_skip } { \skip_horizontal:N \l__xeCJK_last_skip #1 } } @@ -1541,12 +1531,12 @@ \__xeCJK_if_last_punct_penalty:TF { \xeCJK_punct_bound_kern:N #1 } { - \int_compare:nNnTF \tex_lastpenalty:D = \c_zero + \int_compare:nNnTF \tex_lastpenalty:D = \c_zero_int { \tex_unpenalty:D - \int_compare:nNnTF \etex_lastnodetype:D = \c_one - { \tex_penalty:D \c_zero } - { \tex_penalty:D \c_zero #2 } + \int_compare:nNnTF \tex_lastnodetype:D = \c_one_int + { \tex_penalty:D \c_zero_int } + { \tex_penalty:D \c_zero_int #2 } } {#2} } @@ -1589,10 +1579,10 @@ \cs_new_protected_nopar:Npn \xeCJK_if_last_punct:TF { \bool_set_false:N \l__xeCJK_last_penalty_bool - \int_compare:nNnTF \etex_lastnodetype:D = \c_eleven + \int_compare:nNnTF \tex_lastnodetype:D = { 11 } { \__xeCJK_if_last_punct_glue:TF } { - \int_compare:nNnTF \etex_lastnodetype:D = \c_thirteen + \int_compare:nNnTF \tex_lastnodetype:D = { 13 } { \__xeCJK_if_last_punct_penalty:TF } { \use_ii:nn } } @@ -1608,7 +1598,7 @@ { \skip_set_eq:NN \l__xeCJK_last_skip \tex_lastskip:D \tex_unskip:D - \int_compare:nNnTF \tex_lastpenalty:D = \c_ten_thousand + \int_compare:nNnTF \tex_lastpenalty:D = { 1000 } { \__xeCJK_if_last_punct_auxi:TF { \use_i:nn } } { \xeCJK_if_last_node:TF @@ -1628,7 +1618,7 @@ { \skip_set_eq:NN \l__xeCJK_tmp_skip \tex_lastskip:D \tex_unskip:D - \int_compare:nNnTF \etex_lastnodetype:D = \c_eleven + \int_compare:nNnTF \tex_lastnodetype:D = { 11 } { \prop_get:NoNTF \g__xeCJK_punct_skip_prop { \skip_use:N \tex_lastskip:D } \l__xeCJK_tmp_tl @@ -1643,7 +1633,7 @@ \int_set_eq:NN \l__xeCJK_last_penalty_int \tex_lastpenalty:D \tex_unpenalty:D \bool_set_true:N \l__xeCJK_last_penalty_bool - \int_compare:nNnTF \etex_lastnodetype:D = \c_eleven + \int_compare:nNnTF \tex_lastnodetype:D = { 11 } { \__xeCJK_if_last_punct_glue:TF { \use_i:nn } } { \use:n } { \tex_penalty:D \l__xeCJK_last_penalty_int \use_ii:nn } @@ -1654,7 +1644,7 @@ \bool_if:NF \l__xeCJK_last_penalty_bool { \bool_set_true:N \l__xeCJK_last_penalty_bool - \int_set_eq:NN \l__xeCJK_last_penalty_int \c_ten_thousand + \int_set:Nn \l__xeCJK_last_penalty_int { 1000 } } \xeCJK_if_last_node:TF { \__xeCJK_if_last_punct_auxii:TF { \use_i:nn } } @@ -1669,7 +1659,7 @@ } \cs_new_protected_nopar:Npn \__xeCJK_if_last_punct_auxiii:TF { - \int_case:nnTF { \xetex_charclass:D \l__xeCJK_last_kern_dim } + \int_case:nnTF { \tex_XeTeXcharclass:D \l__xeCJK_last_kern_dim } { { \xeCJK_class_num:n { FullRight } } { \tl_set_eq:NN \l__xeCJK_aligni_tl \c__xeCJK_right_tl } @@ -1685,7 +1675,7 @@ \xeCJK_if_last_node:TF { \tl_gset:Nx \g__xeCJK_last_punct_tl - { \utex_char:D \l__xeCJK_tmp_dim } + { \tex_Uchar:D \l__xeCJK_tmp_dim } \dim_set_eq:NN \l__xeCJK_last_bound_dim \l__xeCJK_last_kern_dim \use_i:nn } @@ -1698,11 +1688,11 @@ \bool_new:N \l__xeCJK_last_penalty_bool \cs_new_protected:Npn \xeCJK_if_last_node:TF #1#2 { - \int_compare:nNnTF \etex_lastnodetype:D = \c_twelve + \int_compare:nNnTF \tex_lastnodetype:D = { 12 } { \dim_set_eq:NN \l__xeCJK_last_kern_dim \tex_lastkern:D \tex_unkern:D - \int_compare:nNnTF \etex_lastnodetype:D = \c_twelve + \int_compare:nNnTF \tex_lastnodetype:D = { 12 } { \dim_compare:nNnTF \tex_lastkern:D = { - \l__xeCJK_last_kern_dim } { \tex_unkern:D #1 } @@ -1857,7 +1847,7 @@ \NewDocumentCommand \xeCJKnobreak { } { \bool_set_true:N \l__xeCJK_tmp_bool - \int_while_do:nNnn \etex_lastnodetype:D = \c_eleven + \int_while_do:nNnn \tex_lastnodetype:D = { 11 } { \bool_if:NTF \l__xeCJK_tmp_bool { @@ -1872,7 +1862,7 @@ \dim_set_eq:NN \l__xeCJK_tmp_dim \l__xeCJK_last_kern_dim \xeCJK_if_last_node:TF { - \int_compare:nNnT \etex_lastnodetype:D = \c_eleven + \int_compare:nNnT \tex_lastnodetype:D = { 11 } { \exp_args:NNNo \tex_unskip:D \xeCJK_no_break: \skip_horizontal:n { \skip_use:N \tex_lastskip:D } @@ -1909,7 +1899,7 @@ \keys_define:nn { xeCJK / options } { WidowPenalty .int_set:N = \l__xeCJK_widow_penalty_int , - WidowPenalty .default:n = { \c_ten_thousand } + WidowPenalty .default:n = { 1000 } } \cs_new_protected_nopar:Npn \xeCJK_widow_penalty: { \tex_penalty:D \l__xeCJK_widow_penalty_int } @@ -2023,13 +2013,13 @@ \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:noTF {#4} + \str_case_e:noTF {#4} { \l__xeCJK_inline_env_case_tl } {#2} {#1} #3 {#4} } -\prg_generate_conditional_variant:Nnn \str_case_x:nn { no } { TF } +\prg_generate_conditional_variant:Nnn \str_case_e:nn { no } { TF } \xeCJK_cs_case_keys_define:nNNnn { NewLineCS } \l__xeCJK_new_line_cs_case_tl \l__xeCJK_new_line_cs_seq { \use_ii:nnn } @@ -2168,11 +2158,11 @@ { \__xeCJK_switch_font:nn {#2} {#1} } } } -\cs_if_exist:NF \xetex_glyphbounds:D +\cs_if_exist:NF \tex_XeTeXglyphbounds:D { \__xeCJK_msg_new:nn { XeTeX-too-old } { - \token_to_str:N \xetex_glyphbounds:D \ is~not~defined.\\ + \token_to_str:N \tex_XeTeXglyphbounds:D \ is~not~defined.\\ CJK~punctuation~kerning~will~not~be~available.\\\\ You~have~to~update~XeTeX~to~the~version~0.9995.0~or~later. } @@ -2359,8 +2349,8 @@ \prop_gput:Non \g__xeCJK_punct_skip_prop { \skip_use:N \c_zero_skip } { } \cs_generate_variant:Nn \__xeCJK_save_punct_width_aux:Nnn { cx } \cs_new_eq:NN \__xeCJK_use_dim_or_skip:nNN \__xeCJK_use_punct_skip:nNN -\DeclareObjectType { xeCJK / punctuation } { \c_zero } -\DeclareTemplateInterface { xeCJK / punctuation } { basic } { \c_zero } +\DeclareObjectType { xeCJK / punctuation } { 0 } +\DeclareTemplateInterface { xeCJK / punctuation } { basic } { 0 } { enabled-global-setting : boolean = true , fixed-punct-width : length = \c_max_dim , @@ -2396,7 +2386,7 @@ kerning-margin-ratio : real = \c_one_fp , kerning-margin-minimum : length = \c_zero_dim } -\DeclareTemplateCode { xeCJK / punctuation } { basic } { \c_zero } +\DeclareTemplateCode { xeCJK / punctuation } { basic } { 0 } { enabled-global-setting = \l__xeCJK_enabled_global_setting_bool , fixed-punct-width = \l__xeCJK_fixed_punct_width_dim , @@ -2554,7 +2544,7 @@ { ( \l__xeCJK_tmp_dim - ( \__xeCJK_use_punct_dim:nN { dimen } #2 ) - ) / \c_two + ) / 2 } { \bool_if:NTF \l__xeCJK_optimize_margin_bool @@ -2589,7 +2579,7 @@ \__xeCJK_punct_if_middle:NTF #2 { ( \__xeCJK_use_punct_dim:nN { width } #2 - - \__xeCJK_use_punct_dim:nN { dimen } #2 ) / \c_two + \__xeCJK_use_punct_dim:nN { dimen } #2 ) / 2 - \l__xeCJK_tmp_dim } { \l__xeCJK_bound_dim - \l__xeCJK_tmp_dim } @@ -2619,8 +2609,8 @@ { \l__xeCJK_middle_margin_width_dim } { \fp_use:N \l__xeCJK_middle_margin_ratio_fp - \etex_dimexpr:D - ( \l__xeCJK_bound_dim + \l__xeCJK_reverse_bound_dim ) / \c_two + \tex_dimexpr:D + ( \l__xeCJK_bound_dim + \l__xeCJK_reverse_bound_dim ) / 2 \scan_stop: } } @@ -2687,7 +2677,7 @@ { \c_max_dim } { \fp_use:c { l__xeCJK_#1_punct_ratio_fp } - \etex_dimexpr:D \__xeCJK_use_punct_dim:nN { width } #2 \scan_stop: + \tex_dimexpr:D \__xeCJK_use_punct_dim:nN { width } #2 \scan_stop: } } } @@ -2697,7 +2687,7 @@ { \use:c { l__xeCJK_#1_margin_width_dim } } { \fp_use:c { l__xeCJK_#1_margin_ratio_fp } - \etex_dimexpr:D \l__xeCJK_bound_dim \scan_stop: + \tex_dimexpr:D \l__xeCJK_bound_dim \scan_stop: } \bool_if:NT \l__xeCJK_add_min_bound_to_margin_bool { + \dim_min:nn \l__xeCJK_bound_dim \l__xeCJK_reverse_bound_dim } @@ -2838,7 +2828,7 @@ \__xeCJK_calc_kerning_margin:nNN { \fp_use:N \l__xeCJK_kerning_total_ratio_fp - \etex_dimexpr:D + \tex_dimexpr:D \__xeCJK_use_punct_dim:nN { width } #1 + \__xeCJK_use_punct_dim:nN { width } #2 \scan_stop: @@ -2894,11 +2884,11 @@ \cs_new_protected_nopar:Npn \xeCJK_calc_punct_dimen:N #1 { \__xeCJK_save_punct_dim:nNNn { bound } \c__xeCJK_left_tl #1 - { \xeCJK_glyph_bounds:NN \c_one #1 } + { \xeCJK_glyph_bounds:NN 1 #1 } \__xeCJK_save_punct_dim:nNNn { bound } \c__xeCJK_right_tl #1 - { \xeCJK_glyph_bounds:NN \c_three #1 } + { \xeCJK_glyph_bounds:NN 3 #1 } \__xeCJK_save_punct_dim:nNn { width } #1 - { \etex_fontcharwd:D \tex_font:D `#1 } + { \tex_fontcharwd:D \tex_font:D `#1 } \__xeCJK_save_punct_dim:nNn { dimen } #1 { ( \__xeCJK_use_punct_dim:nN { width } #1 ) - @@ -2907,7 +2897,7 @@ } } \cs_new_nopar:Npn \xeCJK_glyph_bounds:NN #1#2 - { \xetex_glyphbounds:D #1 ~ \xetex_charglyph:D `#2 \exp_stop_f: } + { \tex_XeTeXglyphbounds:D #1 ~ \tex_XeTeXcharglyph:D `#2 \exp_stop_f: } \keys_define:nn { xeCJK / options } { PunctStyle .choice: , @@ -3012,10 +3002,10 @@ \cs_new_protected_nopar:Npn \xeCJK_aftergroup_reset_Boundary:N #1 { \tl_set:Nx \l__xeCJK_tmp_tl - { \tex_the:D \xetex_charclass:D `#1 ~ \xeCJK_class_num:n { Boundary } } + { \tex_the:D \tex_XeTeXcharclass:D `#1 ~ \xeCJK_class_num:n { Boundary } } \tl_gset:Nx \g__xeCJK_aftergroup_Boundary_tl - { \tex_the:D \xetex_interchartoks:D \l__xeCJK_tmp_tl } - \xetex_interchartoks:D \l__xeCJK_tmp_tl = { \prg_do_nothing: } + { \tex_the:D \tex_XeTeXinterchartoks:D \l__xeCJK_tmp_tl } + \tex_XeTeXinterchartoks:D \l__xeCJK_tmp_tl = { \prg_do_nothing: } \group_insert_after:N \g__xeCJK_aftergroup_Boundary_tl } \tl_new:N \g__xeCJK_aftergroup_Boundary_tl @@ -3031,7 +3021,7 @@ { \xeCJK_fallback_loop:No #1 { \l_xeCJK_family_tl/FallBack } } } { - \str_if_eq_x:nnTF { \CJKfamilydefault } { \l__xeCJK_fallback_family_tl } + \str_if_eq:eeTF { \CJKfamilydefault } { \l__xeCJK_fallback_family_tl } { \__xeCJK_warning:nxxx { missing-glyph } { \l_xeCJK_family_tl } {#1} @@ -3115,10 +3105,12 @@ \tl_if_blank:nTF {##1} { \prop_clear:N \l__xeCJK_sub_key_prop - \tl_put_right:Nn \l__xeCJK_family_name_tl { /#1 } + \tl_set:Nx \l__xeCJK_sub_family_name_tl + { \l__xeCJK_family_name_tl /#1 } \clist_remove_all:Nn \l__xeCJK_font_options_clist {#1} } { + \tl_clear:N \l__xeCJK_sub_family_name_tl \str_if_eq:nnTF {##1} { * } { \prop_put:Nnn \l__xeCJK_sub_key_prop {#1} { \q_no_value } } { \__xeCJK_get_sub_features:nn {#1} {##1} } @@ -3202,6 +3194,7 @@ \prop_clear:N \l__xeCJK_sub_key_prop \tl_clear:N \l__xeCJK_font_name_bf_tl \tl_clear:N \l__xeCJK_font_name_it_tl + \tl_clear:N \l__xeCJK_sub_family_name_tl \clist_clear:N \l__xeCJK_fontspec_options_clist \bool_set_eq:NN \l__xeCJK_auto_fake_bold_bool \g__xeCJK_auto_fake_bold_bool \bool_set_eq:NN \l__xeCJK_auto_fake_slant_bool \g__xeCJK_auto_fake_slant_bool @@ -3224,9 +3217,9 @@ \tl_set:Nn \l__xeCJK_font_name_tl {#3} \clist_concat:NNN \l__xeCJK_font_options_clist \g__xeCJK_default_features_clist \l__xeCJK_font_options_clist - \__xeCJK_remove_duplicate_keys:N \l__xeCJK_font_options_clist \keys_set_known:nVN { xeCJK / features } \l__xeCJK_font_options_clist \l__xeCJK_fontspec_options_clist + \__xeCJK_binding_sub_family: \__xeCJK_parse_font_shape: \__xeCJK_check_family:V \l__xeCJK_family_name_tl \__xeCJK_gset_family_cs:x { \l__xeCJK_family_name_tl } @@ -3238,44 +3231,28 @@ \tl_new:N \l__xeCJK_font_name_tl \clist_new:N \l__xeCJK_font_options_clist \cs_generate_variant:Nn \xeCJK_set_family:nnn { x , VVV , Voo } -\cs_new_protected_nopar:Npn \__xeCJK_remove_duplicate_keys:N #1 +\cs_new_protected_nopar:Npn \__xeCJK_binding_sub_family: { - \prop_clear:N \l__xeCJK_font_options_prop - \keyval_parse:NNV \__xeCJK_prop_put_aux:n \__xeCJK_prop_put_aux:nn #1 - \clist_clear:N #1 - \prop_map_inline:Nn \l__xeCJK_font_options_prop - { - \tl_set:No \l__xeCJK_tmp_tl { \use_ii:nn ##2 } - \tl_if_blank:VTF \l__xeCJK_tmp_tl - { \clist_put_right:No #1 { \use_i:nn ##2 } } - { - \clist_put_right:Nx #1 - { \exp_not:o { \use_i:nn ##2 } = { \exp_not:V \l__xeCJK_tmp_tl } } - } - } + \tl_if_empty:NF \l__xeCJK_sub_family_name_tl + { \tl_set_eq:NN \l__xeCJK_family_name_tl \l__xeCJK_sub_family_name_tl } } -\prop_new:N \l__xeCJK_font_options_prop -\cs_generate_variant:Nn \keyval_parse:NNn { NNV } -\cs_new_protected_nopar:Npn \__xeCJK_prop_put_aux:n #1 - { \prop_put:Nnn \l__xeCJK_font_options_prop {#1} { {#1} { } } } -\cs_new_protected_nopar:Npn \__xeCJK_prop_put_aux:nn #1#2 - { \prop_put:Nnn \l__xeCJK_font_options_prop {#1} { {#1} {#2} } } \cs_new_protected_nopar:Npn \__xeCJK_gset_family_cs:x #1 { \cs_gset_protected_nopar:cpx { \__xeCJK_family_csname:n {#1} } { \group_begin: \exp_not:n { \cs_set_eq:NN \xeCJK@fontfamily \use_none:n } - \exp_not:n { \fontspec_set_family:Nnn \l__xeCJK_fontspec_family_tl } + \exp_not:n { \fontspec_gset_family:Nnn \g__xeCJK_fontspec_family_tl } { \exp_not:V \l__xeCJK_fontspec_options_clist } { \exp_not:V \l__xeCJK_font_name_tl } \__xeCJK_gset_family_nfss_cs:xx - {#1} { \exp_not:N \l__xeCJK_fontspec_family_tl } - \exp_not:N \exp_args:NNNo \group_end: - \tl_set:Nn \exp_not:N \l__xeCJK_fontspec_family_tl - { \exp_not:N \l__xeCJK_fontspec_family_tl } + {#1} { \exp_not:N \g__xeCJK_fontspec_family_tl } + \group_end: + \tl_set_eq:NN \exp_not:N \l__xeCJK_fontspec_family_tl + \exp_not:N \g__xeCJK_fontspec_family_tl } } +\tl_new:N \g__xeCJK_fontspec_family_tl \tl_new:N \l__xeCJK_fontspec_family_tl \cs_new_protected_nopar:Npn \__xeCJK_check_family:n #1 { @@ -3583,7 +3560,7 @@ } \cs_new_nopar:Npn \__xeCJK_msg_def_family_map:n #1 { - \str_case_x:nnF {#1} + \str_case_e:nnF {#1} { \CJKrmdefault { \token_to_str:N \setCJKmainfont } \CJKsfdefault { \token_to_str:N \setCJKsansfont } @@ -3594,7 +3571,7 @@ } \cs_new_nopar:Npn \__xeCJK_msg_family_map:n #1 { - \str_case_x:nnF {#1} + \str_case_e:nnF {#1} { \CJKrmdefault { \token_to_str:N \CJKrmdefault } \CJKsfdefault { \token_to_str:N \CJKsfdefault } @@ -3669,7 +3646,7 @@ { \xeCJK_switch_family:o { \l_xeCJK_family_tl } } { \__xeCJK_fontspec:xnn - { CJKfontspec ( \int_eval:n { \g__xeCJK_family_int + \c_one } ) } + { CJKfontspec ( \int_eval:n { \g__xeCJK_family_int + 1 } ) } {#1} {#2} } } @@ -3824,7 +3801,7 @@ \xeCJK_family_if_exist:xF { \CJKfamilydefault } { \tl_set_eq:NN \l__xeCJK_tmp_tl \CJKfamilydefault - \str_if_eq_x:nnTF { \CJKfamilydefault } { \CJKrmdefault } + \str_if_eq:eeTF { \CJKfamilydefault } { \CJKrmdefault } { \use:n } { \xeCJK_family_if_exist:xTF { \CJKrmdefault } @@ -3972,7 +3949,7 @@ } \tex_countdef:D \g__xeCJK_fam_bottom_int = 18 ~ \int_new:N \g__xeCJK_fam_allocation_int -\int_gset_eq:NN \g__xeCJK_fam_allocation_int \c_two_hundred_fifty_five +\int_gset:Nn \g__xeCJK_fam_allocation_int { 255 } \__xeCJK_msg_new:nn { fam-exhausted } { No~room~for~a~new~fam. } \cs_new_protected:Npn \xeCJK_new_symbol_font:Nnnnn #1#2#3#4#5 @@ -3990,7 +3967,7 @@ \clist_map_inline:Nn #1 { \__xeCJK_set_char_class_aux:Nnw \xeCJK_gset_mathcode:nnnn { ##1 } - { \c_zero } {#2} + { 0 } {#2} } } \cs_generate_variant:Nn \xeCJK_gset_mathcode:Nn { c } @@ -4004,7 +3981,7 @@ } } \cs_new_protected_nopar:Npn \xeCJK_gset_mathcode:Nnn #1#2#3 - { \tex_global:D \utex_mathcode:D #1 = #2 ~ #3 ~ #1 } + { \tex_global:D \tex_Umathcode:D #1 = #2 ~ #3 ~ #1 } \int_new:N \l__xeCJK_verb_case_int \keys_define:nn { xeCJK / options } { @@ -4019,11 +3996,11 @@ \or: \__xeCJK_nobreak_skip_zero: \or: - \int_compare:nNnTF \etex_currentgrouptype:D = \c_fourteen + \int_compare:nNnTF \tex_currentgrouptype:D = { 14 } { \xeCJKVerbAddon } { \__xeCJK_nobreak_skip: } \or: - \int_compare:nNnTF \etex_currentgrouptype:D = \c_fourteen + \int_compare:nNnTF \tex_currentgrouptype:D = { 14 } { \xeCJKVerbAddon } { \__xeCJK_nobreak_skip_zero: } \fi: @@ -4096,13 +4073,13 @@ \tl_new:N \l__xeCJK_reset_shipout_skip_hook_tl \NewDocumentCommand \xeCJKVerbAddon { } { - \int_compare:nNnF \etex_currentgrouplevel:D = \c_zero + \int_compare:nNnF \tex_currentgrouplevel:D = \c_zero_int { \bool_if:NF \l__xeCJK_listings_env_bool { \dim_compare:nNnTF - { \tex_fontdimen:D \c_two \tex_font:D } = - { \etex_fontcharwd:D \tex_font:D \c__xeCJK_mono_letter_int } + { \tex_fontdimen:D 2 ~ \tex_font:D } = + { \tex_fontcharwd:D \tex_font:D \c__xeCJK_mono_letter_int } { \__xeCJK_set_verb_exspace: \__xeCJK_verb_addon: @@ -4175,7 +4152,7 @@ { \int_set:Nn \l__xeCJK_tmp_int { \xeCJK_class_num:n {#1} } \clist_map_inline:cn { c__xeCJK_#1_chars_clist } - { \xetex_charclass:D ##1 = \l__xeCJK_tmp_int } + { \tex_XeTeXcharclass:D ##1 = \l__xeCJK_tmp_int } } \bool_new:N \l__xeCJK_verb_addon_bool \cs_new_eq:NN \CJKfixedspacing \xeCJKVerbAddon @@ -4195,9 +4172,9 @@ \skip_zero:N \l__xeCJK_verb_exspace_skip } { - \group_begin: \xeCJK_select_font: \exp_after:wN \group_end: - \exp_after:wN \__xeCJK_set_verb_exspace:n - \exp_after:wN { \dim_use:N \etex_fontcharwd:D \tex_font:D "4E00 } + \group_begin: \xeCJK_select_font: \exp_args:NNo \group_end: + \__xeCJK_set_verb_exspace:n + { \dim_use:N \tex_fontcharwd:D \tex_font:D "4E00 ~ } } } } @@ -4205,14 +4182,14 @@ \cs_new_protected_nopar:Npn \__xeCJK_set_verb_exspace:n #1 { \skip_set:Nn \l__xeCJK_verb_exspace_skip - { \c_two \tex_fontdimen:D \c_two \tex_font:D - #1 } + { 2 \tex_fontdimen:D 2 ~ \tex_font:D - #1 } \dim_compare:nNnTF \l__xeCJK_verb_exspace_skip < \c_zero_dim { \skip_zero:N \l__xeCJK_verb_exspace_skip \use:x { \__xeCJK_set_verb_scale:nn - { \dim_to_fp:n { \c_two \tex_fontdimen:D \c_two \tex_font:D } } + { \dim_to_fp:n { 2 \tex_fontdimen:D 2 ~ \tex_font:D } } { \dim_to_fp:n {#1} } } } @@ -4238,7 +4215,7 @@ You~may~set~`Scale=#1'~to~CJKfamily~ `\__xeCJK_msg_family_map:n { \l_xeCJK_family_tl }',\\ or~set~`Scale=#2'~to~family~ - `\str_if_eq_x:nnTF \f@family \ttdefault + `\str_if_eq:eeTF \f@family \ttdefault { \token_to_str:N \ttdefault } { \f@family }'. } \fp_new:N \l__xeCJK_scale_factor_fp @@ -4249,9 +4226,9 @@ \xeCJK_glyph_if_exist:NTF { ^^^^2423 } { ^^^^2423 } { - \int_compare:nNnTF { \xetex_fonttype:D \tex_font:D } = \c_zero + \int_compare:nNnTF { \tex_XeTeXfonttype:D \tex_font:D } = \c_zero_int { - \str_if_eq_x:nnTF { \f@family } { \ttdefault } + \str_if_eq:eeTF { \f@family } { \ttdefault } { \c_catcode_other_space_tl } { \textvisiblespace } } @@ -4270,8 +4247,8 @@ { \tl_set:Nx \l__xeCJK_current_coor_tl { xeCJK/space/\curr@fontshape/\f@size } - \exp_after:wN \__xeCJK_set_visible_space_size:n - \exp_after:wN { \dim_use:N \tex_fontdimen:D \c_two \tex_font:D } + \exp_args:No \__xeCJK_set_visible_space_size:n + { \dim_use:N \tex_fontdimen:D 2 ~ \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 @@ -4279,14 +4256,14 @@ \fontencoding { \g_fontspec_encoding_tl } \tl_set:Nx \f@family { lmtt } \selectfont - \dim_compare:nNnF {#1} = { \tex_fontdimen:D \c_two \tex_font:D } + \dim_compare:nNnF {#1} = { \tex_fontdimen:D 2 ~ \tex_font:D } { \fontsize { \dim_eval:n { \f@size pt * - \dim_ratio:nn {#1} { \tex_fontdimen:D \c_two \tex_font:D } + \dim_ratio:nn {#1} { \tex_fontdimen:D 2 ~ \tex_font:D } } } { \f@baselineskip } @@ -4377,7 +4354,7 @@ PunctStyle = quanjiao , NewLineCS = { \par \[ } , EnvCS = { \begin \end } , - WidowPenalty = \c_ten_thousand , + WidowPenalty = 1000 , NoBreakCS = { \footnote \footnotemark \nobreak } , KaiMingPunct = { ^^^^3002 ^^^^ff0e ^^^^ff1f ^^^^ff01 } , LongPunct = { ^^^^2014 ^^^^2e3a ^^^^2025 ^^^^2026 } , @@ -4387,7 +4364,7 @@ \defaultCJKfontfeatures { Script = CJK } \xeCJKsetwidth { ^^^^2013 } { 0.5 em } \ProcessKeysOptions { xeCJK / options } -\RequirePackage { fontspec } [ 2012/05/01 ] +\RequirePackage { fontspec } [ 2019/03/15 ] \tl_const:Nx \c__xeCJK_encoding_tl { \g_fontspec_encoding_tl } \keys_define:nn { xeCJK / options } { @@ -4480,9 +4457,10 @@ } \cs_new_protected_nopar:Npn \__xeCJK_update_main_fam: { - \group_begin: \xeCJK_select_font: \exp_after:wN \group_end: - \exp_after:wN \tex_textfont:D \exp_after:wN \c_xeCJK_math_fam_int - \tex_the:D \tex_font:D + \group_begin: + \xeCJK_select_font: + \exp_last_unbraced:NNNo \group_end: + \tex_textfont:D \c_xeCJK_math_fam_int \tex_the:D \tex_font:D } \cs_new_protected_nopar:Npn \__xeCJK_update_block_fam: { @@ -4496,9 +4474,10 @@ \cs_new_protected_nopar:Npn \__xeCJK_update_block_fam:nn #1#2 { \int_set:Nn \l__xeCJK_fam_int {#2} - \group_begin: \xeCJK_select_font:n {#1} \exp_after:wN \group_end: - \exp_after:wN \tex_textfont:D \exp_after:wN \l__xeCJK_fam_int - \tex_the:D \tex_font:D + \group_begin: + \xeCJK_select_font:n {#1} + \exp_last_unbraced:NNNo \group_end: + \tex_textfont:D \l__xeCJK_fam_int \tex_the:D \tex_font:D } \__xeCJK_after_end_preamble:n { @@ -4528,7 +4507,7 @@ } \cs_new_protected_nopar:Npn \__xeCJK_math_robust_aux:NN #1#2 { - \exp_args:Nx \str_case:nnTF { \token_get_replacement_spec:N #1 } + \exp_args:Nx \str_case:nnTF { \cs_replacement_spec:N #1 } { { \x@protect #1 \protect #2 } { } { \protect #2 } { } @@ -4538,7 +4517,7 @@ } \cs_new_protected_nopar:Npn \__xeCJK_math_robust:NN #1#2 { - \str_if_eq_x:nnTF { \token_get_arg_spec:N #2 } { } + \str_if_eq:eeTF { \cs_argument_spec:N #2 } { } { \exp_args:No \tl_if_head_eq_meaning:nNTF {#2} \scan_stop: { @@ -4634,7 +4613,7 @@ } \cs_new_protected_nopar:Npn \__xeCJK_update_family_aux: { - \str_case_x:nn { \f@family } + \str_case_e:nn { \f@family } { { \rmdefault } { \xeCJK_switch_family:x { \CJKrmdefault } } { \sfdefault } { \xeCJK_switch_family:x { \CJKsfdefault } } @@ -4647,13 +4626,13 @@ \tl_replace_once:Nnn \sw@slant { \fix@penalty } { \xeCJK@fix@penalty } \cs_new_protected_nopar:Npn \xeCJK@italiccorr { - \int_compare:nNnTF \xetex_interchartokenstate:D > \c_zero + \int_compare:nNnTF \tex_XeTeXinterchartokenstate:D > \c_zero_int { \xeCJK_italic_correction: } { \@@italiccorr } } \cs_new_protected_nopar:Npn \xeCJK_italic_correction: { - \int_compare:nNnT \etex_lastnodetype:D = \c_twelve + \int_compare:nNnT \tex_lastnodetype:D = { 12 } { \__xeCJK_italic_correction: } } \cs_new_protected_nopar:Npn \__xeCJK_italic_correction: @@ -4695,9 +4674,8 @@ { \c__xeCJK_class_begin_int + \seq_count:N \g__xeCJK_new_class_seq } = { \g__xeCJK_xetex_allocator_int } { - \int_step_inline:nnnn - { \c__xeCJK_class_begin_int + \c_one } - { \c_one } + \int_step_inline:nnn + { \c__xeCJK_class_begin_int + 1 } { \g__xeCJK_xetex_allocator_int } { \seq_if_in:NnF \g__xeCJK_new_class_seq {#1} @@ -4733,7 +4711,7 @@ \cs_new_protected_nopar:Npn \__xeCJK_inactive_group_begin: { \group_begin: \makexeCJKinactive } \cs_new_eq:NN \__xeCJK_inactive_group_end: \group_end: -\prop_const_from_keyval:Nn \c__xeCJK_ambigious_char_prop +\prop_const_from_keyval:Nn \c__xeCJK_ambiguous_char_prop { "00B7 = \textperiodcentered \textcentereddot \textcdot , "2013 = \textendash , @@ -4751,18 +4729,18 @@ \cs_new_protected_nopar:Npn \__xeCJK_patch_text_command: { \xeCJK_if_package_loaded:nTF { xunicode } - { \__xeCJK_patch_xunicode_ambigious_char: } + { \__xeCJK_patch_xunicode_ambiguous_char: } { - \exp_args:Nx \__xeCJK_patch_tuenc_ambigious_char:n + \exp_args:Nx \__xeCJK_patch_tuenc_ambiguous_char:n { \UnicodeEncodingName } \__xeCJK_patch_tuenc_accent: \__xeCJK_patch_tuenc_composite: } } -\cs_new_protected_nopar:Npn \__xeCJK_patch_xunicode_ambigious_char: +\cs_new_protected_nopar:Npn \__xeCJK_patch_xunicode_ambiguous_char: { \RequirePackage { xunicode-addon } - \prop_map_inline:Nn \c__xeCJK_ambigious_char_prop + \prop_map_inline:Nn \c__xeCJK_ambiguous_char_prop { \tl_map_inline:nn { ##2 } { @@ -4774,67 +4752,73 @@ } \xunadd_append_begin_hook:n { \xeCJK_make_boundary: } } -\cs_new_protected_nopar:Npn \__xeCJK_patch_tuenc_ambigious_char:n #1 +\cs_new_protected_nopar:Npn \__xeCJK_patch_tuenc_ambiguous_char:n #1 { - \prop_map_inline:Nn \c__xeCJK_ambigious_char_prop + \prop_map_inline:Nn \c__xeCJK_ambiguous_char_prop { \tl_map_inline:nn { ##2 } { \cs_if_exist:NF ####1 { \DeclareTextSymbol ####1 {#1} { ##1 } } - \__xeCJK_patch_ambigious_char:nN {#1} ####1 + \__xeCJK_patch_ambiguous_char:nN {#1} ####1 } } } -\cs_new_protected_nopar:Npn \__xeCJK_patch_ambigious_char:nN #1#2 +\cs_new_protected_nopar:Npn \__xeCJK_patch_ambiguous_char:nN #1#2 { - \exp_args:Nx \__xeCJK_patch_ambigious_char:n + \exp_args:Nx \__xeCJK_patch_ambiguous_char:nn { #1 \token_to_str:N #2 } + { #1 - #2 } } -\cs_new_protected_nopar:Npx \__xeCJK_patch_ambigious_char:nNn #1#2#3 +\cs_new_protected_nopar:Npx \__xeCJK_patch_ambiguous_char:nNn #1#2#3 { - \exp_args:Nx \exp_not:N \__xeCJK_patch_ambigious_char:n + \exp_args:Nx \exp_not:N \__xeCJK_patch_ambiguous_char:nn { \c_backslash_str #1 \exp_not:N \token_to_str:N #2 - \exp_not:N \token_to_str:N #3 } + { #1 - #2#3 } } -\cs_new_protected_nopar:Npn \__xeCJK_patch_ambigious_char:n #1 +\cs_new_protected_nopar:Npn \__xeCJK_patch_ambiguous_char:nn #1#2 { \cs_if_free:cF {#1} - { \exp_args:Nc \__xeCJK_patch_ambigious_char:N {#1} } + { \exp_args:Nc \__xeCJK_patch_ambiguous_char:Nn {#1} {#2} } } -\cs_new_protected_nopar:Npn \__xeCJK_patch_ambigious_char:N #1 +\cs_new_protected_nopar:Npn \__xeCJK_patch_ambiguous_char:Nn #1#2 { - \cs_set_protected_nopar:Npx #1 + \token_if_chardef:NTF #1 + { + \prop_gput:Nnx \c__xeCJK_ambiguous_slot_prop {#2} + { \int_eval:n {#1} } + \cs_set_protected_nopar:Npx #1 + { \__xeCJK_ambiguous_char:n { \tex_Uchar:D #1 } } + } { - \__xeCJK_ambigious_char:n - { \token_if_chardef:NTF #1 { \utex_char:D } { \exp_not:o } #1 } + \prop_gput:Nnx \c__xeCJK_ambiguous_slot_prop {#2} + { \int_eval:n { \exp_after:wN ` #1 } } + \cs_set_protected_nopar:Npx #1 + { \__xeCJK_ambiguous_char:n { \exp_not:o {#1} } } } } -\cs_new_protected_nopar:Npn \__xeCJK_ambigious_char:n #1 +\cs_new_protected_nopar:Npn \__xeCJK_ambiguous_char:n #1 { - \int_compare:nNnTF \xetex_interchartokenstate:D > \c_zero + \int_compare:nNnTF \tex_XeTeXinterchartokenstate:D > \c_zero_int { \__xeCJK_inactive_group_begin: #1 \__xeCJK_inactive_group_end: } {#1} } -\cs_new_protected_nopar:Npn \xeCJK@composite@patch +\prop_new:N \c__xeCJK_ambiguous_slot_prop +\cs_new_protected_nopar:Npn \xeCJK_text_composite_patch: { - \str_if_eq_x:nnT { \f@encoding } { \UnicodeEncodingName } + \str_if_eq:eeT { \f@encoding } { \UnicodeEncodingName } { \xeCJK_make_boundary: } } \cs_new_protected_nopar:Npn \__xeCJK_patch_tuenc_composite: { - \cs_set_nopar:Npn \@text@composite@x ##1 + \cs_set_nopar:Npn \@text@composite@x { - \xeCJK@composite@patch - \ifx ##1 \relax - \expandafter \@secondoftwo - \else - \expandafter \@firstoftwo - \fi - ##1 + \xeCJK_text_composite_patch: + \cs_if_exist_use:NF } } \group_begin: @@ -4844,7 +4828,7 @@ \cs_set_protected_nopar:Npn \add@unicode@accent ##1 ##2 { \tl_if_blank:nTF { ##2 } { ^^a0 } { ##2 } - \utex_char:D \etex_numexpr:D ##1 \scan_stop: + \tex_Uchar:D \tex_numexpr:D ##1 \scan_stop: } } \group_end: @@ -4860,18 +4844,18 @@ T4 = \B t , T5 = \` \ecircumflex } -\__xeCJK_after_end_preamble:n { \__xeCJK_patch_middle_dot: } +\__xeCJK_at_end_preamble:n { \__xeCJK_patch_middle_dot: } \cs_new_protected_nopar:Npn \__xeCJK_patch_middle_dot: { \prop_map_inline:Nn \c__xeCJK_middle_dot_prop { \__xeCJK_patch_middle_dot:nw { ##1 } ##2 \q_stop } - \__xeCJK_patch_ambigious_char:nNn { T5 } \` { \^ - e } + \__xeCJK_patch_ambiguous_char:nNn { T5 } \` { \^ - e } } \cs_new_protected_nopar:Npn \__xeCJK_patch_middle_dot:nw #1#2#3 \q_stop { \tl_if_empty:nTF {#3} - { \__xeCJK_patch_ambigious_char:nN {#1} #2 } - { \__xeCJK_patch_ambigious_char:nNn {#1} #2 {#3} } + { \__xeCJK_patch_ambiguous_char:nN {#1} #2 } + { \__xeCJK_patch_ambiguous_char:nNn {#1} #2 {#3} } } \__xeCJK_after_end_preamble:n { @@ -4881,6 +4865,29 @@ { \makexeCJKinactive \usefont { U } {#1} { m } { n } } } } +\__xeCJK_at_end_preamble:n + { + \cs_if_free:NF \MT@get@slot@ + { \__xeCJK_patch_microtype_get_slot: } + } +\cs_new_protected_nopar:Npn \__xeCJK_patch_microtype_get_slot: + { + \cs_new_eq:NN \xeCJK@original@get@slot \MT@get@slot@ + \cs_set_eq:NN \MT@get@slot@ \xeCJK@microtype@get@slot + \cs_set_eq:NN \MT@warn@unknown@once \use_none:n + } +\cs_new_protected_nopar:Npn \xeCJK@microtype@get@slot + { + \int_compare:nNnT \MT@char < \c_zero_int + { \__xeCJK_get_ambiguous_slot: } + \xeCJK@original@get@slot + } +\cs_new_protected_nopar:Npn \__xeCJK_get_ambiguous_slot: + { + \exp_args:NNx \prop_get:NnNT \c__xeCJK_ambiguous_slot_prop + { \MT@encoding - \tex_the:D \MT@toks } \l__xeCJK_tmp_tl + { \cs_set_eq:NN \MT@char \l__xeCJK_tmp_tl } + } \__xeCJK_after_end_preamble:n { \cs_if_exist_use:NT \pdfstringdefDisableCommands @@ -4942,8 +4949,8 @@ \cs_set_eq:NN \def \xdef #2 \group_end: - \str_gset:Nx \CJK@tenthousand { ^^^^4e07 } - \str_gset:Nx \CJK@hundredmillion { ^^^^4ebf } + \str_gset:Nn \CJK@tenthousand { ^^^^4e07 } + \str_gset:Nn \CJK@hundredmillion { ^^^^4ebf } \tl_if_exist:NF \CJK@UnicodeEnc { \tl_const:Nn \CJK@UnicodeEnc { UTF8 } } \cs_if_exist:NF \Unicode @@ -4951,7 +4958,7 @@ } } \cs_new_nopar:Npn \xeCJK_unicode_char:nn #1#2 - { \utex_char:D \etex_numexpr:D (#1) * 256 + (#2) \scan_stop: } + { \tex_Uchar:D \tex_numexpr:D (#1) * 256 + (#2) \scan_stop: } \bool_if:NT \g__xeCJK_config_bool { \ExplSyntaxOff -- cgit v1.2.3