diff options
author | Karl Berry <karl@freefriends.org> | 2019-04-07 21:28:36 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2019-04-07 21:28:36 +0000 |
commit | c9afdb0f95d5ffff9dd84394bfded0f52b4278e4 (patch) | |
tree | b1be96dad48713f816bd43b89252c07fa91a93b3 /Master/texmf-dist/source/xelatex/xecjk | |
parent | df16dd32216e16f65d5c57028978fa3ddb2d1af8 (diff) |
xecjk (7apr19)
git-svn-id: svn://tug.org/texlive/trunk@50852 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/xelatex/xecjk')
-rw-r--r-- | Master/texmf-dist/source/xelatex/xecjk/xeCJK.dtx | 760 | ||||
-rw-r--r-- | Master/texmf-dist/source/xelatex/xecjk/xeCJK.ins | 8 |
2 files changed, 431 insertions, 337 deletions
diff --git a/Master/texmf-dist/source/xelatex/xecjk/xeCJK.dtx b/Master/texmf-dist/source/xelatex/xecjk/xeCJK.dtx index eefa597224b..af49e3b5d11 100644 --- a/Master/texmf-dist/source/xelatex/xecjk/xeCJK.dtx +++ b/Master/texmf-dist/source/xelatex/xecjk/xeCJK.dtx @@ -26,8 +26,8 @@ Copyright and Licence --------------------- Copyright (C) 2007--2010 by Wenchang Sun <sunwch@nankai.edu.cn> - Copyright (C) 2009--2018 by Leo Liu <leoliu.pku@gmail.com> - Copyright (C) 2012--2018 by Qing Lee <sobenlee@gmail.com> + Copyright (C) 2009--2019 by Leo Liu <leoliu.pku@gmail.com> + Copyright (C) 2012--2019 by Qing Lee <sobenlee@gmail.com> ---------------------------------------------------------------------- This work may be distributed and/or modified under the @@ -92,8 +92,8 @@ Copyright and Licence \preamble Copyright (C) 2007--2010 by Wenchang Sun <sunwch@nankai.edu.cn> - Copyright (C) 2009--2018 by Leo Liu <leoliu.pku@gmail.com> - Copyright (C) 2012--2018 by Qing Lee <sobenlee@gmail.com> + Copyright (C) 2009--2019 by Leo Liu <leoliu.pku@gmail.com> + Copyright (C) 2012--2019 by Qing Lee <sobenlee@gmail.com> ---------------------------------------------------------------------- This work may be distributed and/or modified under the @@ -194,7 +194,7 @@ Copyright and Licence %<*package|config|fntef|listings|xunicode|xunextra> %<!(config|xunextra)>\NeedsTeXFormat{LaTeX2e} %<!(config|xunextra)>\RequirePackage{expl3} -%<+!driver>\GetIdInfo$Id: xeCJK.dtx b604170 2018-04-30 10:29:28 +0800 Liu Haiyang <leoliu.pku@gmail.com> $ +%<+!driver>\GetIdInfo$Id: xeCJK.dtx 8be031f 2019-04-07 23:30:14 +0800 Qing Lee <sobenlee@gmail.com> $ %<package> {Typesetting CJK scripts with XeLaTeX} %<config> {Configuration file for xeCJK package} %<fntef> {xeCJK font effect} @@ -207,7 +207,7 @@ Copyright and Licence %<listings>\ProvidesExplPackage{xeCJK-listings} %<xunicode>\ProvidesExplPackage{xunicode-addon} %<xunextra>\ProvidesExplFile{xunicode-extra.def} -%<!driver> {\ExplFileDate}{3.7.1}{\ExplFileDescription} +%<!driver> {\ExplFileDate}{3.7.2}{\ExplFileDescription} %</package|config|fntef|listings|xunicode|xunextra> %<*driver> \documentclass{ctxdoc} @@ -244,7 +244,7 @@ Copyright and Licence \use_none:n ##1 & \tex_char:D ##1 \scan_stop: \int_compare:nNnF \l_tmpa_int = \l_tmpb_int { - \int_compare:nNnTF { \int_mod:nn \l_tmpa_int {#1} } = \c_zero + \int_compare:nNnTF { \int_mod:nn \l_tmpa_int {#1} } = \c_zero_int { \exp_not:N \\ \scan_stop: } { & } } } @@ -279,8 +279,9 @@ Copyright and Licence % 进行最小化运算(\LaTeXiii{} 2017/07/19)。} % \changes{v3.6.0}{2018/01/13}{同步 \LaTeXiii{} 2017/12/16。} % \changes{v3.6.1}{2018/02/27}{减少 \texttt{bool} 运算。} +% \changes{v3.7.2}{2019/03/23}{同步 \LaTeXiii{} 2019/03/05。} % -% \CheckSum{10889} +% \CheckSum{10855} % \GetFileId{xeCJK.sty} % % \title{\bfseries\pkg{xeCJK} 宏包} @@ -772,7 +773,7 @@ Copyright and Licence % \tn{CJKfontspec} \Arg{font name}\oarg{font features} 或\\ % \tn{CJKfontspec} \oarg{font features} \Arg{font name} % \end{syntax} -% 在文档中随机定义新的 CJK 字体族,并马上使用它。 +% 在文档中定义新的 CJK 字体族,并马上使用它。 % \end{function} % % \begin{function}[rEXP]{\defaultCJKfontfeatures} @@ -1133,16 +1134,16 @@ Copyright and Licence % \PSKeyVal{mixed-punct-width}{length} % 设置句末标点符号的宽度。其中句末标点符号通过 \tn{xeCJKsetup} 的 |KaiMingPunct| % 来设置。默认值是与 |fixed-punct-width| 选项的值相同。 -% \PSKeyVal{mixed-punct-width}{real} +% \PSKeyVal{mixed-punct-ratio}{real} % 设置句末标点符号的宽度比例。默认值是与 |fixed-punct-ratio| 选项的值相同。 % \PSKeyVal{middle-punct-width}{length} % 设置居中标点符号的宽度。其中居中标点符号通过 \tn{xeCJKsetup} 的 |MiddlePunct| % 来设置。默认值是与 |fixed-punct-width| 选项的值相同。 -% \PSKeyVal{middle-punct-width}{real} +% \PSKeyVal{middle-punct-ratio}{real} % 设置居中标点符号的宽度比例。默认值是与 |fixed-punct-ratio| 选项的值相同。 % \end{psopt} % -% 以上三个选项设置的是标点的固定宽度或比例,\pkg{xeCJK} 会根据设定的选项计算标点符号 +% 以上几个选项设置的是标点的固定宽度或比例,\pkg{xeCJK} 会根据设定的选项计算标点符号 % 左/右的空白宽度。下面的选项设置的是标点符号左/右的空白宽度或比例,因此不同标点符号 % 的宽度可能会不同。为了使下面的选项生效,需要先禁用上面的相应选项。优先级自上而下。 % @@ -1609,7 +1610,7 @@ Copyright and Licence 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 } } % \end{macrocode} % @@ -1694,9 +1695,10 @@ Copyright and Licence % \begin{macro}[int]{\xeCJK_allow_break:,\xeCJK_no_break:} % \begin{macrocode} \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_@@_ten_thousand_int } +\int_const:Nn \c_@@_ten_thousand_int { 10 000 } % \end{macrocode} % \end{macro} % @@ -1830,8 +1832,8 @@ Copyright and Licence % \begin{macrocode} \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 } % \end{macrocode} % \end{macro} @@ -1845,7 +1847,7 @@ Copyright and Licence % \begin{macrocode} \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: } % \end{macrocode} @@ -1858,13 +1860,13 @@ Copyright and Licence % \begin{macrocode} \tl_const:Nn \c_xeCJK_space_skip_tl { - \int_compare:nNnTF \g_@@_space_factor_int = \c_one_thousand + \int_compare:nNnTF \g_@@_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 } } @@ -1874,21 +1876,21 @@ Copyright and Licence \int_compare:nNnTF \g_@@_space_factor_int < { 2000 } { \_@@_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 { \_@@_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_@@_space_factor_int < { 2000 } @@ -1899,13 +1901,13 @@ Copyright and Licence \_@@_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 } } } } @@ -1915,10 +1917,10 @@ Copyright and Licence plus \fp_eval:n { \g_@@_space_factor_int / 1000 } #2 minus \int_div_truncate:nn - { 1000 * \tex_number:D #3 } { \g_@@_space_factor_int } sp + { 1000 * \int_value:w #3 } { \g_@@_space_factor_int } sp } \int_new:N \g_@@_space_factor_int -\int_gset_eq:NN \g_@@_space_factor_int \c_one_thousand +\int_gset:Nn \g_@@_space_factor_int { 1000 } % \end{macrocode} % \end{variable} % @@ -1928,18 +1930,18 @@ Copyright and Licence \cs_new_protected_nopar:Npn \xeCJK_glue_to_skip:nN #1#2 { \group_begin: - \hbox_set:Nw \l_@@_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_@@_tmp_box } - } + \hbox_set:Nw \l_@@_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_@@_tmp_box } + } + \exp_args:NNNo \group_end: + \skip_set:Nn #2 { \skip_use:N #2 } } % \end{macrocode} % \end{macro} @@ -1949,10 +1951,10 @@ Copyright and Licence % \begin{macrocode} \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: } @@ -2042,7 +2044,7 @@ Copyright and Licence % 的显性或隐性记号。 % \begin{macrocode} \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 } % \end{macrocode} % \end{macro} % @@ -2146,9 +2148,9 @@ Copyright and Licence % \begin{macro}[int]{\makexeCJKactive, \makexeCJKinactive} % \begin{macrocode} \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 } % \end{macrocode} % \end{macro} % @@ -2248,31 +2250,31 @@ Copyright and Licence % \changes{v3.3.4}{2016/02/07}{兼容 \XeTeX{} 0.99994 的边界字符类。} % \begin{macro}[int]{Default,CJK,FullLeft,FullRight,Boundary} % \begin{macrocode} -\xeCJK_save_class:nn { Default } { \c_zero } +\xeCJK_save_class:nn { Default } { 0 } % \end{macrocode} % \XeTeX{} 0.99994 将字符类总数扩大到 $4096$^^A % \footnote{\url{http://tug.org/pipermail/xetex/2016-February/026363.html}}。 % \begin{macrocode} -\tl_set:Nx \l_@@_tmp_tl - { \int_use:N \xetex_XeTeXversion:D \xetex_XeTeXrevision:D } -\fp_compare:nNnTF { \l_@@_tmp_tl } > { 0.99993 } +\str_const:Nx \c_@@_xetex_version_str + { \int_use:N \tex_XeTeXversion:D \tex_XeTeXrevision:D } +\fp_compare:nNnTF { \c_@@_xetex_version_str } > { 0.99993 } { \xeCJK_save_class:nn { Boundary } { 4095 } } - { \xeCJK_save_class:nn { Boundary } { \c_two_hundred_fifty_five } } + { \xeCJK_save_class:nn { Boundary } { 255 } } % \end{macrocode} % \LaTeXe{} 2016/02/01 不再预设置 CJK 字符类。 % \begin{macrocode} -\int_compare:nNnTF { \xetex_charclass:D "4E00 } = \c_one +\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_@@_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_@@_class_begin_int { 3 } } { \xeCJK_new_class:n { CJK } \xeCJK_new_class:n { FullLeft } \xeCJK_new_class:n { FullRight } - \int_const:Nn \c_@@_class_begin_int { \c_zero } + \int_const:Nn \c_@@_class_begin_int { 0 } } % \end{macrocode} % \end{macro} @@ -2397,7 +2399,7 @@ Copyright and Licence \AtEndOfPackage { \cs_set:Npn \@@_tmp:w #1 - { \char_generate:nn {#1} { \c_twelve } } + { \char_generate:nn {#1} { 12 } } \@@_add_special_punct:nn { middle } { \clist_map_function:NN \c_@@_hyphens_chars_clist \@@_tmp:w } \cs_undefine:N \@@_tmp:w @@ -2790,7 +2792,7 @@ Copyright and Licence \int_set:Nn \l_@@_tmp_int {#3} \xeCJK_int_until_do:nn { \l_@@_begin_int > \l_@@_end_int } { - \xetex_charclass:D \l_@@_begin_int = \l_@@_tmp_int + \tex_XeTeXcharclass:D \l_@@_begin_int = \l_@@_tmp_int \int_incr:N \l_@@_begin_int } } @@ -2806,7 +2808,7 @@ Copyright and Licence { \int_set:Nn \l_@@_tmp_int { \xeCJK_class_num:n {#2} } \clist_map_inline:cn { c_@@_#1_chars_clist } - { \xetex_charclass:D ##1 = \l_@@_tmp_int } + { \tex_XeTeXcharclass:D ##1 = \l_@@_tmp_int } } % \end{macrocode} % \end{macro} @@ -2817,7 +2819,7 @@ Copyright and Licence \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 } } } % \end{macrocode} % \end{macro} @@ -2868,8 +2870,8 @@ Copyright and Licence % \begin{macrocode} \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 } % \end{macrocode} @@ -2880,8 +2882,8 @@ Copyright and Licence % \begin{macrocode} \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} } % \end{macrocode} % \end{macro} @@ -2975,7 +2977,7 @@ Copyright and Licence \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: } } @@ -3116,8 +3118,8 @@ Copyright and Licence { \c_group_begin_token \bool_set_true:N \l_@@_CJK_group_bool - \int_gset_eq:NN \g_@@_space_factor_int \c_one_thousand - \int_zero:N \xetex_dashbreakstate:D + \int_gset:Nn \g_@@_space_factor_int { 1000 } + \int_zero:N \tex_XeTeXdashbreakstate:D } \bool_new:N \l_@@_CJK_group_bool \cs_new_eq:NN \xeCJK_class_group_end: \c_group_end_token @@ -3191,7 +3193,7 @@ Copyright and Licence { \xeCJK_check_for_ecglue: } \cs_new_protected_nopar:Npn \@@_check_for_xecglue: { - \int_compare:nNnTF \etex_lastnodetype:D = \c_eleven + \int_compare:nNnTF \tex_lastnodetype:D = { 11 } { \@@_replace_space: } { \@@_check_for_ecglue: } } @@ -3275,7 +3277,7 @@ Copyright and Licence { \xeCJK_check_for_ecglue_normalsp: } \cs_new_protected_nopar:Npn \@@_check_for_xecglue_normalsp: { - \int_compare:nNnTF \etex_lastnodetype:D = \c_eleven + \int_compare:nNnTF \tex_lastnodetype:D = { 11 } { \@@_replace_space: } { \@@_check_for_ecglue_normalsp: } } @@ -3323,10 +3325,10 @@ Copyright and Licence % \begin{macrocode} \cs_new_protected_nopar:Npn \xeCJK_check_for_glue: { - \int_compare:nNnTF \etex_lastnodetype:D = \c_twelve + \int_compare:nNnTF \tex_lastnodetype:D = { 12 } { \@@_check_for_glue_auxi: } { - \int_compare:nNnTF \etex_lastnodetype:D = \c_ten + \int_compare:nNnTF \tex_lastnodetype:D = { 10 } { \xeCJK_remove_node: \CJKecglue } { \@@_check_for_glue_auxii: } } @@ -3338,7 +3340,7 @@ Copyright and Licence { \@@_node:n { CJK } } { \xeCJK_remove_node: \CJKglue } { \@@_node:n { CJK-space } } - { \xeCJK_remove_node: \CJKglue } + { \xeCJK_remove_node: \@@_ccglue_or_space: } { \@@_node:n { CJK-widow } } { \xeCJK_remove_node: \xeCJK_widow_penalty: \CJKglue } { \@@_node:n { default } } @@ -3364,7 +3366,7 @@ Copyright and Licence \cs_new_eq:NN \xeCJK_check_for_xglue: \prg_do_nothing: \cs_new_protected_nopar:Npn \@@_check_for_xglue: { - \int_compare:nNnT \etex_lastnodetype:D = \c_eleven + \int_compare:nNnT \tex_lastnodetype:D = { 11 } { \skip_set_eq:NN \l_@@_last_skip \tex_lastskip:D \tex_unskip:D @@ -3389,7 +3391,7 @@ Copyright and Licence \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_@@_last_skip } } @@ -3426,7 +3428,7 @@ Copyright and Licence { c_@@_#1_node_dim } { \g_@@_node_int sp } } \int_new:N \g_@@_node_int -\int_gset_eq:NN \g_@@_node_int \c_ten +\int_gset:Nn \g_@@_node_int { 10 } \cs_new_protected_nopar:Npn \xeCJK_make_node:n #1 { \exp_args:Nc \@@_make_node:N { c_@@_#1_node_dim } } \cs_new_nopar:Npn \@@_node:n #1 @@ -3516,6 +3518,7 @@ Copyright and Licence % \end{macro} % % \changes{v3.4.1}{2016/05/21}{修复 \texttt{CJKspace} 功能失效。} +% \changes{v3.7.2}{2019/04/07}{简化 \texttt{CJKspace} 的实现,并修复错误。} % % \begin{macro}{CJKspace} % 是否保留 CJK 文字间的空白,默认不保留。 @@ -3526,20 +3529,12 @@ Copyright and Licence CJKspace / true .code:n = { \bool_set_true:N \l_@@_reserve_space_bool - \cs_set_eq:NN \@@_ignore_space_end: - \@@_maybe_reserve_space: - \cs_set_eq:NN \@@_boundary_group_end_space: - \@@_boundary_maybe_reserve_space: \cs_set_protected_nopar:Npn \@@_ccglue_or_space: { \xeCJK_space_glue: } } , CJKspace / false .code:n = { \bool_set_false:N \l_@@_reserve_space_bool - \cs_set_eq:NN \@@_ignore_space_end: - \group_align_safe_end: - \cs_set_eq:NN \@@_boundary_group_end_space: - \@@_boundary_group_end_aux: \cs_set_protected_nopar:Npn \@@_ccglue_or_space: { \CJKglue } } , @@ -3576,7 +3571,7 @@ Copyright and Licence { \token_if_macro:NTF \l_peek_token { \@@_boundary_reserve_space: } - { \@@_boundary_group_end_space: } + { \@@_boundary_group_end:n { CJK-space } } } { \token_if_eq_meaning:NNTF \l_peek_token \scan_stop: @@ -3587,18 +3582,9 @@ Copyright and Licence } \cs_new_protected_nopar:Npn \@@_boundary_reserve_space: { - \@@_boundary_group_end_aux: + \@@_boundary_group_end:n { CJK-space } \xeCJK_space_or_xecglue: } -\cs_new_protected_nopar:Npn \@@_boundary_maybe_reserve_space: - { - \token_if_letter:NTF \l_peek_token - { \@@_boundary_reserve_space: } - { \@@_boundary_group_end_aux: } - } -\cs_new_protected_nopar:Npn \@@_boundary_group_end_aux: - { \@@_boundary_group_end:n { CJK-space } } -\cs_new_eq:NN \@@_boundary_group_end_space: \@@_boundary_group_end_aux: \cs_new_protected:Npn \@@_CJK_and_Boundary_relax:N #1 { \@@_boundary_group_end:n { CJK } @@ -3626,27 +3612,25 @@ Copyright and Licence { \bool_if:NT \l_@@_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 } + { + { \@@_node:n { CJK } } + { \xeCJK_remove_node: \xeCJK_make_node:n { CJK-space } } + { \@@_node:n { default } } + { \xeCJK_remove_node: \xeCJK_make_node:n { default-space } } + } \group_align_safe_begin: \token_if_macro:NTF \l_peek_token { \@@_reserve_space_aux: } - { \@@_ignore_space_end: } + { \group_align_safe_end: } } } } -\cs_new_protected:Npn \@@_reserve_space_aux: +\cs_new_protected_nopar:Npn \@@_reserve_space_aux: { \group_align_safe_end: \xeCJK_space_or_xecglue: } -\cs_new_protected:Npn \@@_maybe_reserve_space: - { - \token_if_letter:NTF \l_peek_token - { \@@_reserve_space_aux: } - { \group_align_safe_end: } - } -\cs_new_eq:NN \@@_ignore_space_end: \group_align_safe_end: % \end{macrocode} % \end{macro} % @@ -3713,7 +3697,7 @@ Copyright and Licence { \xeCJK_class_group_end: \exp_after:wN \xeCJK_punct_node:N \g_@@_last_punct_tl - \xeCJK_no_break: \@@_zero_glue: + \@@_nobreak_zero_glue: } \tex_ignorespaces:D } @@ -3795,7 +3779,7 @@ Copyright and Licence { \tl_if_eq:NNF \l_@@_aligni_tl \c_@@_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 @@ -3947,7 +3931,7 @@ Copyright and Licence % \begin{macrocode} \cs_new_protected_nopar:Npn \@@_punct_kern:NN #1#2 { - \str_if_eq_x:nnTF {#1} {#2} + \str_if_eq:eeTF {#1} {#2} { \@@_punct_nobreak_kern:NN } { \@@_punct_if_long:NTF #1 @@ -4016,6 +4000,8 @@ Copyright and Licence % % \begin{macro}[int]{\xeCJK_FullLeft_and_Default:} % \changes{v3.2.0}{2013/05/20}{修正 \pkg{xeCJK} 使西文在部分情况下无法断词的问题。} +% \changes{v3.7.2}{2018/05/21}{再次修正 FullLeft 类字符与西文连用断词失败的问题。} +% \cs{@@_nobreak_zero_glue:} 用于确保 FullLeft 类后的西文单词可以断词。 % \begin{macrocode} \cs_new_protected_nopar:Npn \xeCJK_FullLeft_and_Default: { @@ -4025,7 +4011,15 @@ Copyright and Licence \xeCJK_class_group_end: \xeCJK_no_break: \@@_punct_glue:NN \c_@@_left_tl \g_@@_last_punct_tl } - { \xeCJK_class_group_end: } + { + \xeCJK_class_group_end: + \@@_nobreak_zero_glue: + } + } +\cs_new_protected_nopar:Npn \@@_nobreak_zero_glue: + { + \tex_penalty:D \c_@@_ten_thousand_int + \skip_horizontal:N \c_zero_skip } \cs_new_protected_nopar:Npn \@@_zero_glue: { \skip_horizontal:N \c_zero_skip } @@ -4128,7 +4122,7 @@ Copyright and Licence { \tl_set_eq:NN \l_@@_alignii_tl \c_@@_left_tl \group_begin: \exp_args:NNc \group_end: \cs_if_exist_use:NTF - { @@_bound_type_ \int_use:N \etex_lastnodetype:D _glue:Nn } + { @@_bound_type_ \int_use:N \tex_lastnodetype:D _glue:Nn } {#1} { \use:n } { \@@_punct_glue:NN \c_@@_left_tl #1 } @@ -4153,7 +4147,7 @@ Copyright and Licence \cs_new_protected_nopar:cpn { @@_bound_type_ 1 _glue:Nn } #1#2 { \box_set_to_last:N \l_@@_tmp_box - \int_compare:nNnTF \etex_lastnodetype:D = { -1 } + \int_compare:nNnTF \tex_lastnodetype:D = { -1 } { \dim_compare:nNnTF { \box_wd:N \l_@@_tmp_box } = \tex_parindent:D @@ -4194,9 +4188,9 @@ Copyright and Licence \skip_if_eq:nnTF { \l_@@_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_@@_last_skip } { \skip_horizontal:N \l_@@_last_skip #1 } } @@ -4231,12 +4225,12 @@ Copyright and Licence \@@_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} } @@ -4303,10 +4297,10 @@ Copyright and Licence \cs_new_protected_nopar:Npn \xeCJK_if_last_punct:TF { \bool_set_false:N \l_@@_last_penalty_bool - \int_compare:nNnTF \etex_lastnodetype:D = \c_eleven + \int_compare:nNnTF \tex_lastnodetype:D = { 11 } { \@@_if_last_punct_glue:TF } { - \int_compare:nNnTF \etex_lastnodetype:D = \c_thirteen + \int_compare:nNnTF \tex_lastnodetype:D = { 13 } { \@@_if_last_punct_penalty:TF } { \use_ii:nn } } @@ -4322,7 +4316,7 @@ Copyright and Licence { \skip_set_eq:NN \l_@@_last_skip \tex_lastskip:D \tex_unskip:D - \int_compare:nNnTF \tex_lastpenalty:D = \c_ten_thousand + \int_compare:nNnTF \tex_lastpenalty:D = { 1000 } { \@@_if_last_punct_auxi:TF { \use_i:nn } } { \xeCJK_if_last_node:TF @@ -4342,7 +4336,7 @@ Copyright and Licence { \skip_set_eq:NN \l_@@_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_@@_punct_skip_prop { \skip_use:N \tex_lastskip:D } \l_@@_tmp_tl @@ -4357,7 +4351,7 @@ Copyright and Licence \int_set_eq:NN \l_@@_last_penalty_int \tex_lastpenalty:D \tex_unpenalty:D \bool_set_true:N \l_@@_last_penalty_bool - \int_compare:nNnTF \etex_lastnodetype:D = \c_eleven + \int_compare:nNnTF \tex_lastnodetype:D = { 11 } { \@@_if_last_punct_glue:TF { \use_i:nn } } { \use:n } { \tex_penalty:D \l_@@_last_penalty_int \use_ii:nn } @@ -4368,7 +4362,7 @@ Copyright and Licence \bool_if:NF \l_@@_last_penalty_bool { \bool_set_true:N \l_@@_last_penalty_bool - \int_set_eq:NN \l_@@_last_penalty_int \c_ten_thousand + \int_set:Nn \l_@@_last_penalty_int { 1000 } } \xeCJK_if_last_node:TF { \@@_if_last_punct_auxii:TF { \use_i:nn } } @@ -4383,7 +4377,7 @@ Copyright and Licence } \cs_new_protected_nopar:Npn \@@_if_last_punct_auxiii:TF { - \int_case:nnTF { \xetex_charclass:D \l_@@_last_kern_dim } + \int_case:nnTF { \tex_XeTeXcharclass:D \l_@@_last_kern_dim } { { \xeCJK_class_num:n { FullRight } } { \tl_set_eq:NN \l_@@_aligni_tl \c_@@_right_tl } @@ -4399,7 +4393,7 @@ Copyright and Licence \xeCJK_if_last_node:TF { \tl_gset:Nx \g_@@_last_punct_tl - { \utex_char:D \l_@@_tmp_dim } + { \tex_Uchar:D \l_@@_tmp_dim } \dim_set_eq:NN \l_@@_last_bound_dim \l_@@_last_kern_dim \use_i:nn } @@ -4417,11 +4411,11 @@ Copyright and Licence % \begin{macrocode} \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_@@_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_@@_last_kern_dim } { \tex_unkern:D #1 } @@ -4649,7 +4643,7 @@ Copyright and Licence \NewDocumentCommand \xeCJKnobreak { } { \bool_set_true:N \l_@@_tmp_bool - \int_while_do:nNnn \etex_lastnodetype:D = \c_eleven + \int_while_do:nNnn \tex_lastnodetype:D = { 11 } { \bool_if:NTF \l_@@_tmp_bool { @@ -4664,7 +4658,7 @@ Copyright and Licence \dim_set_eq:NN \l_@@_tmp_dim \l_@@_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 } @@ -4717,7 +4711,7 @@ Copyright and Licence \keys_define:nn { xeCJK / options } { WidowPenalty .int_set:N = \l_@@_widow_penalty_int , - WidowPenalty .default:n = { \c_ten_thousand } + WidowPenalty .default:n = { 1000 } } % \end{macrocode} % \end{macro} @@ -4912,13 +4906,13 @@ Copyright and Licence % \begin{macrocode} \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_@@_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 } % \end{macrocode} % \end{macro} % @@ -5125,11 +5119,11 @@ Copyright and Licence % \tn{XeTeXglyphbounds} 可以得到一个字符的左右边距,用于标点压缩。如果它不可用,则 % 在文档中只能使用 |plain| 这一标点格式原样输出标点。 % \begin{macrocode} -\cs_if_exist:NF \xetex_glyphbounds:D +\cs_if_exist:NF \tex_XeTeXglyphbounds:D { \@@_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. } @@ -5362,11 +5356,11 @@ Copyright and Licence % % 定义标点处理模板。 % \begin{macrocode} -\DeclareObjectType { xeCJK / punctuation } { \c_zero } +\DeclareObjectType { xeCJK / punctuation } { 0 } % \end{macrocode} % % \begin{macrocode} -\DeclareTemplateInterface { xeCJK / punctuation } { basic } { \c_zero } +\DeclareTemplateInterface { xeCJK / punctuation } { basic } { 0 } { enabled-global-setting : boolean = true , fixed-punct-width : length = \c_max_dim , @@ -5405,7 +5399,7 @@ Copyright and Licence % \end{macrocode} % % \begin{macrocode} -\DeclareTemplateCode { xeCJK / punctuation } { basic } { \c_zero } +\DeclareTemplateCode { xeCJK / punctuation } { basic } { 0 } { enabled-global-setting = \l_@@_enabled_global_setting_bool , fixed-punct-width = \l_@@_fixed_punct_width_dim , @@ -5589,7 +5583,7 @@ Copyright and Licence { ( \l_@@_tmp_dim - ( \@@_use_punct_dim:nN { dimen } #2 ) - ) / \c_two + ) / 2 } { \bool_if:NTF \l_@@_optimize_margin_bool @@ -5624,7 +5618,7 @@ Copyright and Licence \@@_punct_if_middle:NTF #2 { ( \@@_use_punct_dim:nN { width } #2 - - \@@_use_punct_dim:nN { dimen } #2 ) / \c_two + \@@_use_punct_dim:nN { dimen } #2 ) / 2 - \l_@@_tmp_dim } { \l_@@_bound_dim - \l_@@_tmp_dim } @@ -5664,8 +5658,8 @@ Copyright and Licence { \l_@@_middle_margin_width_dim } { \fp_use:N \l_@@_middle_margin_ratio_fp - \etex_dimexpr:D - ( \l_@@_bound_dim + \l_@@_reverse_bound_dim ) / \c_two + \tex_dimexpr:D + ( \l_@@_bound_dim + \l_@@_reverse_bound_dim ) / 2 \scan_stop: } } @@ -5744,7 +5738,7 @@ Copyright and Licence { \c_max_dim } { \fp_use:c { l_@@_#1_punct_ratio_fp } - \etex_dimexpr:D \@@_use_punct_dim:nN { width } #2 \scan_stop: + \tex_dimexpr:D \@@_use_punct_dim:nN { width } #2 \scan_stop: } } } @@ -5759,7 +5753,7 @@ Copyright and Licence { \use:c { l_@@_#1_margin_width_dim } } { \fp_use:c { l_@@_#1_margin_ratio_fp } - \etex_dimexpr:D \l_@@_bound_dim \scan_stop: + \tex_dimexpr:D \l_@@_bound_dim \scan_stop: } \bool_if:NT \l_@@_add_min_bound_to_margin_bool { + \dim_min:nn \l_@@_bound_dim \l_@@_reverse_bound_dim } @@ -5927,7 +5921,7 @@ Copyright and Licence \@@_calc_kerning_margin:nNN { \fp_use:N \l_@@_kerning_total_ratio_fp - \etex_dimexpr:D + \tex_dimexpr:D \@@_use_punct_dim:nN { width } #1 + \@@_use_punct_dim:nN { width } #2 \scan_stop: @@ -6005,11 +5999,11 @@ Copyright and Licence \cs_new_protected_nopar:Npn \xeCJK_calc_punct_dimen:N #1 { \@@_save_punct_dim:nNNn { bound } \c_@@_left_tl #1 - { \xeCJK_glyph_bounds:NN \c_one #1 } + { \xeCJK_glyph_bounds:NN 1 #1 } \@@_save_punct_dim:nNNn { bound } \c_@@_right_tl #1 - { \xeCJK_glyph_bounds:NN \c_three #1 } + { \xeCJK_glyph_bounds:NN 3 #1 } \@@_save_punct_dim:nNn { width } #1 - { \etex_fontcharwd:D \tex_font:D `#1 } + { \tex_fontcharwd:D \tex_font:D `#1 } \@@_save_punct_dim:nNn { dimen } #1 { ( \@@_use_punct_dim:nN { width } #1 ) - @@ -6024,7 +6018,7 @@ Copyright and Licence % 用 \tn{XeTeXglyphbounds} 取得标点符号的上下左右空白。 % \begin{macrocode} \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: } % \end{macrocode} % \end{macro} % @@ -6184,10 +6178,10 @@ Copyright and Licence \cs_new_protected_nopar:Npn \xeCJK_aftergroup_reset_Boundary:N #1 { \tl_set:Nx \l_@@_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_@@_aftergroup_Boundary_tl - { \tex_the:D \xetex_interchartoks:D \l_@@_tmp_tl } - \xetex_interchartoks:D \l_@@_tmp_tl = { \prg_do_nothing: } + { \tex_the:D \tex_XeTeXinterchartoks:D \l_@@_tmp_tl } + \tex_XeTeXinterchartoks:D \l_@@_tmp_tl = { \prg_do_nothing: } \group_insert_after:N \g_@@_aftergroup_Boundary_tl } \tl_new:N \g_@@_aftergroup_Boundary_tl @@ -6215,7 +6209,7 @@ Copyright and Licence { \xeCJK_fallback_loop:No #1 { \l_xeCJK_family_tl/FallBack } } } { - \str_if_eq_x:nnTF { \CJKfamilydefault } { \l_@@_fallback_family_tl } + \str_if_eq:eeTF { \CJKfamilydefault } { \l_@@_fallback_family_tl } { \@@_warning:nxxx { missing-glyph } { \l_xeCJK_family_tl } {#1} @@ -6331,10 +6325,12 @@ Copyright and Licence \tl_if_blank:nTF {##1} { \prop_clear:N \l_@@_sub_key_prop - \tl_put_right:Nn \l_@@_family_name_tl { /#1 } + \tl_set:Nx \l_@@_sub_family_name_tl + { \l_@@_family_name_tl /#1 } \clist_remove_all:Nn \l_@@_font_options_clist {#1} } { + \tl_clear:N \l_@@_sub_family_name_tl \str_if_eq:nnTF {##1} { * } { \prop_put:Nnn \l_@@_sub_key_prop {#1} { \q_no_value } } { \@@_get_sub_features:nn {#1} {##1} } @@ -6450,6 +6446,7 @@ Copyright and Licence \prop_clear:N \l_@@_sub_key_prop \tl_clear:N \l_@@_font_name_bf_tl \tl_clear:N \l_@@_font_name_it_tl + \tl_clear:N \l_@@_sub_family_name_tl \clist_clear:N \l_@@_fontspec_options_clist \bool_set_eq:NN \l_@@_auto_fake_bold_bool \g_@@_auto_fake_bold_bool \bool_set_eq:NN \l_@@_auto_fake_slant_bool \g_@@_auto_fake_slant_bool @@ -6478,9 +6475,9 @@ Copyright and Licence \tl_set:Nn \l_@@_font_name_tl {#3} \clist_concat:NNN \l_@@_font_options_clist \g_@@_default_features_clist \l_@@_font_options_clist - \@@_remove_duplicate_keys:N \l_@@_font_options_clist \keys_set_known:nVN { xeCJK / features } \l_@@_font_options_clist \l_@@_fontspec_options_clist + \@@_binding_sub_family: \@@_parse_font_shape: \@@_check_family:V \l_@@_family_name_tl \@@_gset_family_cs:x { \l_@@_family_name_tl } @@ -6495,30 +6492,15 @@ Copyright and Licence % \end{macrocode} % \end{macro} % -% \begin{macro}{\@@_remove_duplicate_keys:N} +% \changes{v3.7.2}{2019/03/27}{删除定义新字体族时过滤重复选项的功能。} +% +% \begin{macro}{\@@_binding_sub_family:} % \begin{macrocode} -\cs_new_protected_nopar:Npn \@@_remove_duplicate_keys:N #1 +\cs_new_protected_nopar:Npn \@@_binding_sub_family: { - \prop_clear:N \l_@@_font_options_prop - \keyval_parse:NNV \@@_prop_put_aux:n \@@_prop_put_aux:nn #1 - \clist_clear:N #1 - \prop_map_inline:Nn \l_@@_font_options_prop - { - \tl_set:No \l_@@_tmp_tl { \use_ii:nn ##2 } - \tl_if_blank:VTF \l_@@_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_@@_tmp_tl } } - } - } + \tl_if_empty:NF \l_@@_sub_family_name_tl + { \tl_set_eq:NN \l_@@_family_name_tl \l_@@_sub_family_name_tl } } -\prop_new:N \l_@@_font_options_prop -\cs_generate_variant:Nn \keyval_parse:NNn { NNV } -\cs_new_protected_nopar:Npn \@@_prop_put_aux:n #1 - { \prop_put:Nnn \l_@@_font_options_prop {#1} { {#1} { } } } -\cs_new_protected_nopar:Npn \@@_prop_put_aux:nn #1#2 - { \prop_put:Nnn \l_@@_font_options_prop {#1} { {#1} {#2} } } % \end{macrocode} % \end{macro} % @@ -6530,16 +6512,17 @@ Copyright and Licence { \group_begin: \exp_not:n { \cs_set_eq:NN \xeCJK@fontfamily \use_none:n } - \exp_not:n { \fontspec_set_family:Nnn \l_@@_fontspec_family_tl } + \exp_not:n { \fontspec_gset_family:Nnn \g_@@_fontspec_family_tl } { \exp_not:V \l_@@_fontspec_options_clist } { \exp_not:V \l_@@_font_name_tl } \@@_gset_family_nfss_cs:xx - {#1} { \exp_not:N \l_@@_fontspec_family_tl } - \exp_not:N \exp_args:NNNo \group_end: - \tl_set:Nn \exp_not:N \l_@@_fontspec_family_tl - { \exp_not:N \l_@@_fontspec_family_tl } + {#1} { \exp_not:N \g_@@_fontspec_family_tl } + \group_end: + \tl_set_eq:NN \exp_not:N \l_@@_fontspec_family_tl + \exp_not:N \g_@@_fontspec_family_tl } } +\tl_new:N \g_@@_fontspec_family_tl \tl_new:N \l_@@_fontspec_family_tl % \end{macrocode} % \end{macro} @@ -6968,7 +6951,7 @@ Copyright and Licence } \cs_new_nopar:Npn \@@_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 } @@ -6979,7 +6962,7 @@ Copyright and Licence } \cs_new_nopar:Npn \@@_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 } @@ -7048,7 +7031,7 @@ Copyright and Licence % % \begin{macro}{\setCJKfamilyfont, \newCJKfontfamily, \CJKfontspec} % \changes{v3.4.3}{2016/11/18}{允许字体属性可选项在后的新语法。} -% 分别用于预声明 CJK 字体和随机调用 CJK 字体。 +% 分别用于预声明 CJK 字体族和声明并马上调用 CJK 字体族。 % \begin{macrocode} \NewDocumentCommand \setCJKfamilyfont { m o m } { @@ -7084,7 +7067,7 @@ Copyright and Licence { \xeCJK_switch_family:o { \l_xeCJK_family_tl } } { \@@_fontspec:xnn - { CJKfontspec ( \int_eval:n { \g_@@_family_int + \c_one } ) } + { CJKfontspec ( \int_eval:n { \g_@@_family_int + 1 } ) } {#1} {#2} } } @@ -7275,7 +7258,7 @@ Copyright and Licence \xeCJK_family_if_exist:xF { \CJKfamilydefault } { \tl_set_eq:NN \l_@@_tmp_tl \CJKfamilydefault - \str_if_eq_x:nnTF { \CJKfamilydefault } { \CJKrmdefault } + \str_if_eq:eeTF { \CJKfamilydefault } { \CJKrmdefault } { \use:n } { \xeCJK_family_if_exist:xTF { \CJKrmdefault } @@ -7474,7 +7457,7 @@ Copyright and Licence } \tex_countdef:D \g_@@_fam_bottom_int = 18 ~ \int_new:N \g_@@_fam_allocation_int -\int_gset_eq:NN \g_@@_fam_allocation_int \c_two_hundred_fifty_five +\int_gset:Nn \g_@@_fam_allocation_int { 255 } \@@_msg_new:nn { fam-exhausted } { No~room~for~a~new~fam. } % \end{macrocode} @@ -7507,7 +7490,7 @@ Copyright and Licence \clist_map_inline:Nn #1 { \@@_set_char_class_aux:Nnw \xeCJK_gset_mathcode:nnnn { ##1 } - { \c_zero } {#2} + { 0 } {#2} } } \cs_generate_variant:Nn \xeCJK_gset_mathcode:Nn { c } @@ -7521,7 +7504,7 @@ Copyright and Licence } } \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 } % \end{macrocode} % \end{macro} % @@ -7554,11 +7537,11 @@ Copyright and Licence \or: \@@_nobreak_skip_zero: \or: - \int_compare:nNnTF \etex_currentgrouptype:D = \c_fourteen + \int_compare:nNnTF \tex_currentgrouptype:D = { 14 } { \xeCJKVerbAddon } { \@@_nobreak_skip: } \or: - \int_compare:nNnTF \etex_currentgrouptype:D = \c_fourteen + \int_compare:nNnTF \tex_currentgrouptype:D = { 14 } { \xeCJKVerbAddon } { \@@_nobreak_skip_zero: } \fi: @@ -7657,13 +7640,13 @@ Copyright and Licence % \begin{macrocode} \NewDocumentCommand \xeCJKVerbAddon { } { - \int_compare:nNnF \etex_currentgrouplevel:D = \c_zero + \int_compare:nNnF \tex_currentgrouplevel:D = \c_zero_int { \bool_if:NF \l_@@_listings_env_bool { \dim_compare:nNnTF - { \tex_fontdimen:D \c_two \tex_font:D } = - { \etex_fontcharwd:D \tex_font:D \c_@@_mono_letter_int } + { \tex_fontdimen:D 2 ~ \tex_font:D } = + { \tex_fontcharwd:D \tex_font:D \c_@@_mono_letter_int } { \@@_set_verb_exspace: \@@_verb_addon: @@ -7736,7 +7719,7 @@ Copyright and Licence { \int_set:Nn \l_@@_tmp_int { \xeCJK_class_num:n {#1} } \clist_map_inline:cn { c_@@_#1_chars_clist } - { \xetex_charclass:D ##1 = \l_@@_tmp_int } + { \tex_XeTeXcharclass:D ##1 = \l_@@_tmp_int } } \bool_new:N \l_@@_verb_addon_bool \cs_new_eq:NN \CJKfixedspacing \xeCJKVerbAddon @@ -7765,9 +7748,9 @@ Copyright and Licence \skip_zero:N \l_@@_verb_exspace_skip } { - \group_begin: \xeCJK_select_font: \exp_after:wN \group_end: - \exp_after:wN \@@_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: + \@@_set_verb_exspace:n + { \dim_use:N \tex_fontcharwd:D \tex_font:D "4E00 ~ } } } } @@ -7781,14 +7764,14 @@ Copyright and Licence \cs_new_protected_nopar:Npn \@@_set_verb_exspace:n #1 { \skip_set:Nn \l_@@_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_@@_verb_exspace_skip < \c_zero_dim { \skip_zero:N \l_@@_verb_exspace_skip \use:x { \@@_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} } } } @@ -7820,7 +7803,7 @@ Copyright and Licence You~may~set~`Scale=#1'~to~CJKfamily~ `\@@_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_@@_scale_factor_fp @@ -7841,9 +7824,9 @@ Copyright and Licence \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 } } @@ -7879,8 +7862,8 @@ Copyright and Licence { \tl_set:Nx \l_@@_current_coor_tl { xeCJK/space/\curr@fontshape/\f@size } - \exp_after:wN \@@_set_visible_space_size:n - \exp_after:wN { \dim_use:N \tex_fontdimen:D \c_two \tex_font:D } + \exp_args:No \@@_set_visible_space_size:n + { \dim_use:N \tex_fontdimen:D 2 ~ \tex_font:D } \xeCJK_font_gset_to_current:c { \l_@@_current_coor_tl } } \cs_new_protected_nopar:Npn \@@_set_visible_space_size:n #1 @@ -7888,14 +7871,14 @@ Copyright and Licence \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 } @@ -8022,7 +8005,7 @@ Copyright and Licence 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 } , @@ -8043,7 +8026,7 @@ Copyright and Licence % 执行宏包选项,并载入 \pkg{fontspec} 宏包。 % \begin{macrocode} \ProcessKeysOptions { xeCJK / options } -\RequirePackage { fontspec } [ 2012/05/01 ] +\RequirePackage { fontspec } [ 2019/03/15 ] % \end{macrocode} % % \begin{variable}{\c_@@_encoding_tl} @@ -8213,9 +8196,10 @@ Copyright and Licence } \cs_new_protected_nopar:Npn \@@_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 \@@_update_block_fam: { @@ -8229,9 +8213,10 @@ Copyright and Licence \cs_new_protected_nopar:Npn \@@_update_block_fam:nn #1#2 { \int_set:Nn \l_@@_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_@@_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_@@_fam_int \tex_the:D \tex_font:D } \@@_after_end_preamble:n { @@ -8298,7 +8283,7 @@ Copyright and Licence } \cs_new_protected_nopar:Npn \@@_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 } { } @@ -8308,7 +8293,7 @@ Copyright and Licence } \cs_new_protected_nopar:Npn \@@_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: { @@ -8430,7 +8415,7 @@ Copyright and Licence } \cs_new_protected_nopar:Npn \@@_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 } } @@ -8467,7 +8452,7 @@ Copyright and Licence % \begin{macrocode} \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 } } @@ -8483,7 +8468,7 @@ Copyright and Licence % \begin{macrocode} \cs_new_protected_nopar:Npn \xeCJK_italic_correction: { - \int_compare:nNnT \etex_lastnodetype:D = \c_twelve + \int_compare:nNnT \tex_lastnodetype:D = { 12 } { \@@_italic_correction: } } \cs_new_protected_nopar:Npn \@@_italic_correction: @@ -8547,9 +8532,8 @@ Copyright and Licence { \c_@@_class_begin_int + \seq_count:N \g_@@_new_class_seq } = { \g_@@_xetex_allocator_int } { - \int_step_inline:nnnn - { \c_@@_class_begin_int + \c_one } - { \c_one } + \int_step_inline:nnn + { \c_@@_class_begin_int + 1 } { \g_@@_xetex_allocator_int } { \seq_if_in:NnF \g_@@_new_class_seq {#1} @@ -8595,12 +8579,12 @@ Copyright and Licence % \end{macro} % % \begin{macro}{\@@_patch_text_command:} -% \begin{variable}{\c_@@_ambigious_char_prop} +% \begin{variable}{\c_@@_ambiguous_char_prop} % 单独处理宽度有分歧的几个标点:包括省略号、破折号、间隔号、引号等中西文混用的 % 符号, 保证其命令形式输出的是西文字体。 % 如果 \pkg{xunicode} 宏包被载入,则通过 \pkg{xunicode-addon} 处理。 % \begin{macrocode} -\prop_const_from_keyval:Nn \c_@@_ambigious_char_prop +\prop_const_from_keyval:Nn \c_@@_ambiguous_char_prop { "00B7 = \textperiodcentered \textcentereddot \textcdot , "2013 = \textendash , @@ -8618,18 +8602,18 @@ Copyright and Licence \cs_new_protected_nopar:Npn \@@_patch_text_command: { \xeCJK_if_package_loaded:nTF { xunicode } - { \@@_patch_xunicode_ambigious_char: } + { \@@_patch_xunicode_ambiguous_char: } { - \exp_args:Nx \@@_patch_tuenc_ambigious_char:n + \exp_args:Nx \@@_patch_tuenc_ambiguous_char:n { \UnicodeEncodingName } \@@_patch_tuenc_accent: \@@_patch_tuenc_composite: } } -\cs_new_protected_nopar:Npn \@@_patch_xunicode_ambigious_char: +\cs_new_protected_nopar:Npn \@@_patch_xunicode_ambiguous_char: { \RequirePackage { xunicode-addon } - \prop_map_inline:Nn \c_@@_ambigious_char_prop + \prop_map_inline:Nn \c_@@_ambiguous_char_prop { \tl_map_inline:nn { ##2 } { @@ -8641,75 +8625,86 @@ Copyright and Licence } \xunadd_append_begin_hook:n { \xeCJK_make_boundary: } } -\cs_new_protected_nopar:Npn \@@_patch_tuenc_ambigious_char:n #1 +\cs_new_protected_nopar:Npn \@@_patch_tuenc_ambiguous_char:n #1 { - \prop_map_inline:Nn \c_@@_ambigious_char_prop + \prop_map_inline:Nn \c_@@_ambiguous_char_prop { \tl_map_inline:nn { ##2 } { \cs_if_exist:NF ####1 { \DeclareTextSymbol ####1 {#1} { ##1 } } - \@@_patch_ambigious_char:nN {#1} ####1 + \@@_patch_ambiguous_char:nN {#1} ####1 } } } -\cs_new_protected_nopar:Npn \@@_patch_ambigious_char:nN #1#2 +\cs_new_protected_nopar:Npn \@@_patch_ambiguous_char:nN #1#2 { - \exp_args:Nx \@@_patch_ambigious_char:n + \exp_args:Nx \@@_patch_ambiguous_char:nn { #1 \token_to_str:N #2 } + { #1 - #2 } } -\cs_new_protected_nopar:Npx \@@_patch_ambigious_char:nNn #1#2#3 +\cs_new_protected_nopar:Npx \@@_patch_ambiguous_char:nNn #1#2#3 { - \exp_args:Nx \exp_not:N \@@_patch_ambigious_char:n + \exp_args:Nx \exp_not:N \@@_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 \@@_patch_ambigious_char:n #1 +\cs_new_protected_nopar:Npn \@@_patch_ambiguous_char:nn #1#2 { \cs_if_free:cF {#1} - { \exp_args:Nc \@@_patch_ambigious_char:N {#1} } + { \exp_args:Nc \@@_patch_ambiguous_char:Nn {#1} {#2} } } -\cs_new_protected_nopar:Npn \@@_patch_ambigious_char:N #1 +\cs_new_protected_nopar:Npn \@@_patch_ambiguous_char:Nn #1#2 { - \cs_set_protected_nopar:Npx #1 + \token_if_chardef:NTF #1 + { + \prop_gput:Nnx \c_@@_ambiguous_slot_prop {#2} + { \int_eval:n {#1} } + \cs_set_protected_nopar:Npx #1 + { \@@_ambiguous_char:n { \tex_Uchar:D #1 } } + } { - \@@_ambigious_char:n - { \token_if_chardef:NTF #1 { \utex_char:D } { \exp_not:o } #1 } + \prop_gput:Nnx \c_@@_ambiguous_slot_prop {#2} + { \int_eval:n { \exp_after:wN ` #1 } } + \cs_set_protected_nopar:Npx #1 + { \@@_ambiguous_char:n { \exp_not:o {#1} } } } } -\cs_new_protected_nopar:Npn \@@_ambigious_char:n #1 +\cs_new_protected_nopar:Npn \@@_ambiguous_char:n #1 { - \int_compare:nNnTF \xetex_interchartokenstate:D > \c_zero + \int_compare:nNnTF \tex_XeTeXinterchartokenstate:D > \c_zero_int { \@@_inactive_group_begin: #1 \@@_inactive_group_end: } {#1} } +\prop_new:N \c_@@_ambiguous_slot_prop % \end{macrocode} % \end{variable} % \end{macro} % % \begin{macro}{\@@_patch_tuenc_composite:} +% \changes{v3.7.2}{2018/05/02}{修复补丁错误。} % \tn{DeclareUnicodeComposite} 具有检查字符是否存在的功能, % 当符号命令紧跟在 CJK 字符类后面时,需要使字体回到西文状态 % \begin{macrocode} -\cs_new_protected_nopar:Npn \xeCJK@composite@patch +\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: } } +% \end{macrocode} +% 注意 \cs{xeCJK_text_composite_patch:} 可能会结束分组,从而导致 |##1| 没有定义时是 +% \tn{undefined} 而不是 \tn{relax},所以不能将它与 \tn{relax} 作比较。 +% \begin{macrocode} \cs_new_protected_nopar:Npn \@@_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 } } % \end{macrocode} @@ -8725,7 +8720,7 @@ Copyright and Licence \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: @@ -8766,18 +8761,18 @@ Copyright and Licence T4 = \B t , T5 = \` \ecircumflex } -\@@_after_end_preamble:n { \@@_patch_middle_dot: } +\@@_at_end_preamble:n { \@@_patch_middle_dot: } \cs_new_protected_nopar:Npn \@@_patch_middle_dot: { \prop_map_inline:Nn \c_@@_middle_dot_prop { \@@_patch_middle_dot:nw { ##1 } ##2 \q_stop } - \@@_patch_ambigious_char:nNn { T5 } \` { \^ - e } + \@@_patch_ambiguous_char:nNn { T5 } \` { \^ - e } } \cs_new_protected_nopar:Npn \@@_patch_middle_dot:nw #1#2#3 \q_stop { \tl_if_empty:nTF {#3} - { \@@_patch_ambigious_char:nN {#1} #2 } - { \@@_patch_ambigious_char:nNn {#1} #2 {#3} } + { \@@_patch_ambiguous_char:nN {#1} #2 } + { \@@_patch_ambiguous_char:nNn {#1} #2 {#3} } } % \end{macrocode} % \pkg{pifont} 宏包的符号 |\ding{183}| 也有冲突。 @@ -8794,6 +8789,35 @@ Copyright and Licence % \end{variable} % \end{macro} % +% \begin{macro}{\@@_patch_microtype_get_slot:} +% 兼容 \pkg{microtype}。 +% \begin{macrocode} +\@@_at_end_preamble:n + { + \cs_if_free:NF \MT@get@slot@ + { \@@_patch_microtype_get_slot: } + } +\cs_new_protected_nopar:Npn \@@_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 + { \@@_get_ambiguous_slot: } + \xeCJK@original@get@slot + } +\cs_new_protected_nopar:Npn \@@_get_ambiguous_slot: + { + \exp_args:NNx \prop_get:NnNT \c_@@_ambiguous_slot_prop + { \MT@encoding - \tex_the:D \MT@toks } \l_@@_tmp_tl + { \cs_set_eq:NN \MT@char \l_@@_tmp_tl } + } +% \end{macrocode} +% \end{macro} +% % 简单处理与 \pkg{hyperref} 宏包的兼容问题。 % \begin{macrocode} \@@_after_end_preamble:n @@ -8895,8 +8919,8 @@ Copyright and Licence \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 @@ -8904,7 +8928,7 @@ Copyright and Licence } } \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: } % \end{macrocode} % \end{macro} % @@ -8944,7 +8968,6 @@ Copyright and Licence % \begin{macrocode} \RequirePackage { xeCJK } \RequirePackage { ulem } -\RequirePackage { environ } % \end{macrocode} % % 虽然我们不再依赖 \pkg{CJKfntef},但基于历史原因,我们仍然载入它。 @@ -9138,12 +9161,11 @@ Copyright and Licence \dim_compare:nNnTF \tex_lastkern:D = \c_zero_dim { \xeCJK_cs_gclear:N \xeCJK_ulem_right_node: } { - \dim_compare:nNnTF \tex_lastkern:D = { 3 sp } + \dim_compare:nNnTF \tex_lastkern:D = { 3sp } { \xeCJK_cs_gclear:N \xeCJK_ulem_right_node: } { - \exp_after:wN \tex_unkern:D - \exp_after:wN \@@_ulem_right_aux:n - \exp_after:wN { \dim_use:N \tex_lastkern:D } + \exp_args:NNo \tex_unkern:D + \@@_ulem_right_aux:n { \dim_use:N \tex_lastkern:D } } } } @@ -9194,17 +9216,17 @@ Copyright and Licence \cs_new_eq:NN \xeCJK_ulem_right_skip: \prg_do_nothing: \cs_new_protected_nopar:Npn \@@_ulem_right_skip: { - \int_case:nn { \etex_lastnodetype:D } + \int_case:nn { \tex_lastnodetype:D } { - { \c_one } { \@@_ulem_right_skip_hbox: } - { \c_eleven } { \@@_ulem_right_skip_glue: } - { \c_thirteen } { \@@_ulem_right_skip_penalty: } + { 1 } { \@@_ulem_right_skip_hbox: } + { 11 } { \@@_ulem_right_skip_glue: } + { 13 } { \@@_ulem_right_skip_penalty: } } } \cs_new_protected_nopar:Npn \@@_ulem_right_skip_hbox: { \box_set_to_last:N \l_@@_tmp_box - \int_compare:nNnTF \etex_lastnodetype:D = \c_twelve + \int_compare:nNnTF \tex_lastnodetype:D = { 12 } { \@@_ulem_right_skip_kern: } { \@@_ulem_right_skip_glue: } \box_use_drop:N \l_@@_tmp_box @@ -9233,7 +9255,7 @@ Copyright and Licence { \int_set_eq:NN \l_@@_tmp_int \tex_lastpenalty:D \tex_unpenalty:D - \int_compare:nNnT \etex_lastnodetype:D = \c_one + \int_compare:nNnT \tex_lastnodetype:D = \c_one_int { \@@_ulem_right_skip_hbox: } \tex_penalty:D \l_@@_tmp_int } @@ -9705,7 +9727,7 @@ Copyright and Licence \tl_if_empty:NTF \l_@@_group_tag_tl { \UL@stop \@@_ulem_hskip:n {#1} \UL@start } { - \str_if_eq_x:nnTF { \l_@@_group_tag_tl } { \c_@@_group_tag_tl } + \str_if_eq:eeTF { \l_@@_group_tag_tl } { \c_@@_group_tag_tl } { \UL@stop \@@_ulem_hskip:n {#1} \UL@start } { \skip_horizontal:n {#1} } } @@ -9717,8 +9739,8 @@ Copyright and Licence \tl_new:N \l_@@_group_tag_tl \tl_const:Nn \c_@@_group_tag_tl { - T \int_use:N \etex_currentgrouptype:D - L \int_use:N \etex_currentgrouplevel:D + T \int_use:N \tex_currentgrouptype:D + L \int_use:N \tex_currentgrouplevel:D } \cs_new_protected_nopar:Npn \@@_ulem_ccglue: { { \skip_set_eq:NN \UL@skip \l_@@_ccglue_skip \UL@leaders } } @@ -10201,7 +10223,7 @@ Copyright and Licence \hbox_to_zero:n { \xeCJK_select_font: - \tex_kern:D \etex_fontcharwd:D \tex_font:D "4E00 \exp_stop_f: + \tex_kern:D \tex_fontcharwd:D \tex_font:D "4E00 \exp_stop_f: \tex_hss:D \box_use:N \l_@@_fntef_box \tex_hss:D } } @@ -10246,6 +10268,8 @@ Copyright and Licence % \end{macrocode} % \end{macro} % +% \changes{v3.7.2}{2019/03/24}{改用 \pkg{xparse} 的新参数类型 \texttt{b} +% 定义 \env{CJKfilltwosides*} 环境,不再依赖 \pkg{environ} 包。} % % \begin{macro}{CJKfilltwosides} % \changes{v3.2.4}{2013/06/26}{改用 \texttt{minipage} 和 \LaTeX 表格(\texttt{tabular})来实现。} @@ -10263,39 +10287,27 @@ Copyright and Licence \endminipage \ignorespacesafterend } -\NewEnviron { CJKfilltwosides* } [ 2 ] [ c ] +\DeclareDocumentEnvironment { CJKfilltwosides* } { O { c } m +b } { \mode_leave_vertical: \cs_set_eq:NN \CJKglue \xeCJK_fntef_hfilll: \tl_set:Nn \arraystretch { 1 } \cs_if_free:NF \extrarowheight { \cs_set_eq:NN \extrarowheight \c_zero_dim } - \use:x { \@@_fill_two_sides:nn {#1} { \dim_eval:n {#2} } } + \use:x { \@@_fill_two_sides:nnn {#1} { \dim_eval:n {#2} } } {#3} } - [ \ignorespacesafterend ] -\cs_new_protected:Npn \@@_fill_two_sides:nn #1#2 + { \ignorespacesafterend } +\cs_new_protected:Npn \@@_fill_two_sides:nnn #1#2#3 { \dim_compare:nNnTF {#2} > \c_zero_dim { \hbox_set:Nn \l_@@_tmp_box - { - \tabular [#1] { @ { } c @ { } } - \BODY - \endtabular - } + { \tabular [#1] { @ { } c @ { } } #3 \endtabular } \dim_compare:nNnTF {#2} > { \box_wd:N \l_@@_tmp_box } - { - \tabular [#1] { @ { } p {#2} @ { } } - \BODY - \endtabular - } + { \tabular [#1] { @ { } p {#2} @ { } } #3 \endtabular } { \box_use:N \l_@@_tmp_box } } - { - \tabular [#1] { @ { } c @ { } } - \BODY - \endtabular - } + { \tabular [#1] { @ { } c @ { } } #3 \endtabular } } % \end{macrocode} % \end{macro} @@ -10399,7 +10411,7 @@ Copyright and Licence } } \xeCJK_inter_class_toks:nnn { Boundary } { CM } - { \@@_listings_process_CM:nN { \c_zero } } + { \@@_listings_process_CM:nN { 0 } } \@@_listings_CJK_toks_hook: } % \end{macrocode} @@ -10432,33 +10444,33 @@ Copyright and Licence \cs_new_protected_nopar:Npn \@@_listings_CJK_toks_hook: { \xeCJK_inter_class_toks:nnn { Boundary } { CJK } - { \@@_listings_process_CJK:nN { \c_two } } + { \@@_listings_process_CJK:nN { 2 } } \xeCJK_inter_class_toks:nnn { Boundary } { FullLeft } - { \@@_listings_process_CJK:nN { \c_two } } + { \@@_listings_process_CJK:nN { 2 } } \xeCJK_inter_class_toks:nnn { Boundary } { FullRight } - { \@@_listings_process_CJK:nN { \c_two } } + { \@@_listings_process_CJK:nN { 2 } } \xeCJK_inter_class_toks:nnn { Boundary } { HangulJamo } - { \@@_listings_process_CJK:nN { \c_two } } + { \@@_listings_process_CJK:nN { 2 } } \seq_map_inline:Nn \g_@@_CJK_sub_class_seq { \xeCJK_inter_class_toks:nnn { Boundary } { CJK/##1 } - { \@@_listings_process_CJK:nN { \c_two } } + { \@@_listings_process_CJK:nN { 2 } } } } \cs_new_protected_nopar:Npn \@@_listings_breaklines_toks: { \xeCJK_inter_class_toks:nnn { Boundary } { CJK } - { \@@_listings_process_breaklines_CJK:nN { \c_two } } + { \@@_listings_process_breaklines_CJK:nN { 2 } } \xeCJK_inter_class_toks:nnn { Boundary } { HangulJamo } - { \@@_listings_process_breaklines_CJK:nN { \c_two } } + { \@@_listings_process_breaklines_CJK:nN { 2 } } \xeCJK_inter_class_toks:nnn { Boundary } { FullLeft } - { \@@_listings_process_FullLeft:nN { \c_two } } + { \@@_listings_process_FullLeft:nN { 2 } } \xeCJK_inter_class_toks:nnn { Boundary } { FullRight } - { \@@_listings_process_FullRight:nN { \c_two } } + { \@@_listings_process_FullRight:nN { 2 } } \seq_map_inline:Nn \g_@@_CJK_sub_class_seq { \xeCJK_inter_class_toks:nnn { Boundary } { CJK/##1 } - { \@@_listings_process_breaklines_CJK:nN { \c_two } } + { \@@_listings_process_breaklines_CJK:nN { 2 } } } } % \end{macrocode} @@ -10516,7 +10528,7 @@ Copyright and Licence % \begin{macrocode} \cs_new_protected_nopar:Npn \@@_listings_append:nN #1#2 { - \int_add:Nn \lst@length { #1 - \c_one } + \int_add:Nn \lst@length { #1 - 1 } \lst@Append #2 } % \end{macrocode} @@ -10567,14 +10579,14 @@ Copyright and Licence \lst@whitespacefalse \bool_if:NTF \l_@@_listings_letter_bool { - \int_compare:nNnF \l_@@_listings_flag_int = \c_two { \lst@Output } + \int_compare:nNnF \l_@@_listings_flag_int = 2 { \lst@Output } \lst@lettertrue } { \lst@ifletter \lst@Output \else: \lst@OutputOther \lst@lettertrue \fi: \bool_set_true:N \l_@@_listings_letter_bool } - \int_set_eq:NN \l_@@_listings_flag_int \c_one + \int_set_eq:NN \l_@@_listings_flag_int \c_one_int \@@_listings_append:nN } \cs_new_protected_nopar:Npn \@@_listings_process_FullLeft:nN #1#2 @@ -10582,9 +10594,9 @@ Copyright and Licence \lst@whitespacefalse \bool_if:NTF \l_@@_listings_letter_bool { - \int_compare:nNnF \l_@@_listings_flag_int = \c_two + \int_compare:nNnF \l_@@_listings_flag_int = 2 { - \int_compare:nNnTF \l_@@_listings_flag_int = \c_three + \int_compare:nNnTF \l_@@_listings_flag_int = 3 { \bool_if:NT \l_@@_punct_breakable_bool { \lst@Output } } { \lst@Output } } @@ -10594,7 +10606,7 @@ Copyright and Licence \lst@ifletter \lst@Output \else: \lst@OutputOther \lst@lettertrue \fi: \bool_set_true:N \l_@@_listings_letter_bool } - \int_set_eq:NN \l_@@_listings_flag_int \c_two + \int_set:Nn \l_@@_listings_flag_int { 2 } \@@_listings_append:nN {#1} #2 } \cs_new_protected_nopar:Npn \@@_listings_process_FullRight:nN #1#2 @@ -10602,7 +10614,7 @@ Copyright and Licence \lst@whitespacefalse \bool_if:NTF \l_@@_listings_letter_bool { - \int_compare:nNnT \l_@@_listings_flag_int < \c_two + \int_compare:nNnT \l_@@_listings_flag_int < 2 { \@@_punct_if_long:NT #2 { \lst@Output } } \lst@lettertrue } @@ -10610,7 +10622,7 @@ Copyright and Licence \lst@ifletter \lst@Output \else: \lst@OutputOther \lst@lettertrue \fi: \bool_set_true:N \l_@@_listings_letter_bool } - \int_set_eq:NN \l_@@_listings_flag_int \c_three + \int_set:Nn \l_@@_listings_flag_int { 3 } \@@_listings_append:nN {#1} #2 } \int_new:N \l_@@_listings_flag_int @@ -10722,7 +10734,7 @@ Copyright and Licence \cs_new_protected_nopar:Npn \@@_listings_inline_group:w { \exp_after:wN \@@_listings_inline_group:n - \exp_after:wN { \if_int_compare:w `} = \c_zero \fi: + \exp_after:wN { \if_int_compare:w `} = \c_zero_int \fi: } \cs_set_eq:NN \lst@InlineGJ \@@_listings_inline_group:w \cs_new_protected:Npn \@@_listings_inline_group:n #1 @@ -10959,7 +10971,7 @@ Copyright and Licence % \begin{macrocode} \prg_new_conditional:Npnn \@@_glyph_if_exist:n #1 { p , T , F , TF } { - \etex_iffontchar:D \tex_font:D \etex_numexpr:D #1 \scan_stop: + \tex_iffontchar:D \tex_font:D \tex_numexpr:D #1 \scan_stop: \prg_return_true: \else: \prg_return_false: \fi: } % \end{macrocode} @@ -11069,7 +11081,7 @@ Copyright and Licence % \end{macro} % % \begin{macro}{\@@_declare_character:Nnn} -% 通过 \cs{utex_char:D} 直接由 Unicode |#3| 得到编码 |#2| 下的符号命令 +% 通过 \cs{tex_Uchar:D} 直接由 Unicode |#3| 得到编码 |#2| 下的符号命令 % |#1| 对应的实际字符。\tn{DeclareUTFSymbol} 的参数格式与 \tn{DeclareTextSymbol} % 完全一致。 % \begin{macrocode} @@ -11077,7 +11089,7 @@ Copyright and Licence { \@@_provide_text_command_default:N #1 \exp_after:wN \@@_declare_character:NNxn - \utex_char:D \@@_check_slot:n {#3} \exp_stop_f: + \tex_Uchar:D \@@_check_slot:n {#3} \exp_stop_f: #1 { \token_to_str:N #1 } {#2} } \cs_generate_variant:Nn \@@_declare_character:Nnn { c } @@ -11194,7 +11206,7 @@ Copyright and Licence \q_stop } \cs_new_protected:Npn \@@_chardef:Nn #1#2 - { \tex_chardef:D #1 = \etex_numexpr:D #2 \scan_stop: } + { \tex_chardef:D #1 = \tex_numexpr:D #2 \scan_stop: } \cs_generate_variant:Nn \@@_chardef:Nn { c } \cs_generate_variant:Nn \@@_declare_composite:Nnnn { c } % \end{macrocode} @@ -11331,13 +11343,13 @@ Copyright and Licence % \end{macro} % % \begin{macro}{\@@_declare_encoded:NNnnn} -% 通过 \cs{utex_char:D} 直接由重音符号的 Unicode 得到实际字符。 +% 通过 \cs{tex_Uchar:D} 直接由重音符号的 Unicode 得到实际字符。 % \begin{macrocode} \cs_new_protected:Npn \@@_declare_encoded:NNnnn #1#2#3#4#5 { \exp_after:wN \@@_declare_encoded:NNNNxx - \utex_char:D \@@_check_slot:n {#4} \exp_after:wN \exp_stop_f: - \utex_char:D \@@_check_slot:n {#5} \exp_stop_f: + \tex_Uchar:D \@@_check_slot:n {#4} \exp_after:wN \exp_stop_f: + \tex_Uchar:D \@@_check_slot:n {#5} \exp_stop_f: #1 #2 { \token_to_str:N #2 } {#3} } \cs_new_protected:Npn \@@_declare_encoded:NNNNnn #1#2#3#4#5#6 @@ -11581,6 +11593,7 @@ Copyright and Licence % 设置在符号命令前后使用的钩子,可选参数用于指定单个符号命名。可以用 |#1| % 引用带参数的组合符号命令的参数或者符号命令对应的符号。 % \changes{v3.2.6}{2013/08/15}{可以指定特定符号命令使用的钩子。} +% \changes{v3.7.1}{2018/04/30}{修复代码重构而引入的新错误。} % \begin{macrocode} \NewDocumentCommand \AtBeginUTFCommand { s O { } +m } { @@ -11671,9 +11684,8 @@ Copyright and Licence } \cs_new_protected:Npn \@@_text_tipa_command:nnn #1#2#3 { - \exp_after:wN \@@_check_for_tipa:NNn - \cs:w \use_none:n #2 \exp_after:wN \cs_end: - \cs:w UTF/#1#2 \cs_end: {#3} + \exp_args:Ncc \@@_check_for_tipa:NNn + { \use_none:n #2 } { UTF/#1#2 } {#3} } \cs_new_protected:Npn \@@_check_for_tipa:NNn #1#2#3 { @@ -11687,6 +11699,88 @@ Copyright and Licence % \end{macrocode} % \end{macro} % +% \begin{macro}[int]{\xunadd_get_slot:nn} +% |#1| 是编码,|#2| 是诸如 \tn{textendash} 或 |\v C| 等形式的文本命令,取得他们对应的字符编码。 +% \begin{macrocode} +\cs_new_protected:Npn \xunadd_get_slot:nn #1#2 + { \@@_get_slot:wn #2 \q_nil \q_stop {#1} } +\cs_new_protected:Npn \@@_get_slot:wn #1#2#3 \q_stop #4 + { + \int_set:Nn \l_xunadd_slot_int { -1 } + \bool_set_false:N \l_xunadd_rest_bool + \group_begin: \exp_args:Nccc \group_end: + { @@_get_slot:NNnn } + { #4 \token_to_str:N #1 } + { \@@_composite_cs:Nnn #1 {#4} {#2} } + {#2} + {#3} + } +\int_new:N \l_xunadd_slot_int +\bool_new:N \l_xunadd_rest_bool +\cs_new_protected:Npn \@@_get_slot:NNnn #1#2#3#4 + { + \cs_if_free:NF #1 + { + \cs_if_exist:NTF #2 + { \@@_get_composite_slot:Nn #2 {#4} } + { \@@_get_character_slot:Nn #1 { #3 #4 } } + } + } +\cs_new_protected:Npn \@@_get_composite_slot:Nn #1#2 + { + \token_if_chardef:NT #1 + { + \int_set:Nn \l_xunadd_slot_int {#1} + \quark_if_nil:nF {#2} + { \bool_set_true:N \l_xunadd_rest_bool } + } + } +\cs_new_protected:Npn \@@_get_character_slot:Nn #1 + { + \exp_after:wN \@@_get_character_slot_aux:wn #1 + \@@_text_character:nN \q_nil \q_nil \q_stop + } +\cs_new_protected:Npn \@@_get_character_slot_aux:wn + #1 \@@_text_character:nN #2#3#4 \q_stop #5 + { + \quark_if_nil:nF {#2} + { + \int_set:Nn \l_xunadd_slot_int { `#3 } + \quark_if_nil:nF {#5} + { \bool_set_true:N \l_xunadd_rest_bool } + } + } +% \end{macrocode} +% \end{macro} +% +% \changes{v3.7.2}{2018/05/12}{解决与 \pkg{microtype} 宏包的兼容问题。} +% +% \begin{macro}[int]{\xunadd@microtype@is@charx} +% \pkg{microtype} 宏包中使用的函数,我们通过对 \tn{MT@is@charx} 打补丁来实现功能。 +% \begin{macrocode} +\cs_new_protected:Npn \xunadd@microtype@is@charx #1 \relax + { + \use:x + { \xunadd_get_slot:nn { \MT@encoding } { \tex_the:D \MT@toks } } + \int_compare:nNnTF \l_xunadd_slot_int < \c_zero_int + { \xunadd@original@is@charx #1 \relax } + { + \cs_set_nopar:Npx \MT@char@ { \int_use:N \l_xunadd_slot_int } + \bool_if:NT \l_xunadd_rest_bool { \MT@norestfalse } + } + } +\AtBeginDocument + { + \cs_if_free:NF \MT@is@charx + { + \cs_new_eq:NN \xunadd@original@is@charx \MT@is@charx + \cs_set_eq:NN \MT@is@charx \xunadd@microtype@is@charx + \cs_set_eq:NN \MT@warn@unknown@once \use_none:n + } + } +% \end{macrocode} +% \end{macro} +% % \changes{v3.2.8}{2013/12/05}{启用 \pkg{xunicode} 中的带圈数字和字母设置。} % % \begin{macrocode} @@ -13861,10 +13955,10 @@ int main() \makeatletter \ExplSyntaxOn \cs_new_protected_nopar:Npx \@@_restore_catcode: - { \char_set_catcode:nn { \c_zero } { \char_value_catcode:n { \c_zero } } } + { \char_set_catcode:nn { 0 } { \char_value_catcode:n { 0 } } } \file_if_exist:nTF { xunicode-commands.tex } - { \char_set_catcode_comment:n { \c_zero } } - { \char_set_catcode_ignore:n { \c_zero } } + { \char_set_catcode_comment:n { 0 } } + { \char_set_catcode_ignore:n { 0 } } ^^@ \tl_new:N \l_@@_command_tl ^^@ \int_new:N \l_@@_command_int ^^@ \iow_new:N \g_@@_command_iow @@ -13971,7 +14065,7 @@ int main() \int_gincr:N \g_@@_symbol_int \use_none:n #1 & \scan_stop: - \reverse_if:N \etex_iffontchar:D \tex_font:D #1 \exp_stop_f: \falllbackfont \fi: + \reverse_if:N \tex_iffontchar:D \tex_font:D #1 \exp_stop_f: \falllbackfont \fi: \tex_char:D #1 \exp_stop_f: & \tl_set:Nn \l_tmpa_clist {#2} \clist_use:Nn \l_tmpa_clist { \par } diff --git a/Master/texmf-dist/source/xelatex/xecjk/xeCJK.ins b/Master/texmf-dist/source/xelatex/xecjk/xeCJK.ins index 7f71a7a934b..cd7ad3d3740 100644 --- a/Master/texmf-dist/source/xelatex/xecjk/xeCJK.ins +++ b/Master/texmf-dist/source/xelatex/xecjk/xeCJK.ins @@ -7,8 +7,8 @@ %% xeCJK.dtx (with options: `install') %% %% Copyright (C) 2007--2010 by Wenchang Sun <sunwch@nankai.edu.cn> -%% Copyright (C) 2009--2018 by Leo Liu <leoliu.pku@gmail.com> -%% Copyright (C) 2012--2018 by Qing Lee <sobenlee@gmail.com> +%% Copyright (C) 2009--2019 by Leo Liu <leoliu.pku@gmail.com> +%% Copyright (C) 2012--2019 by Qing Lee <sobenlee@gmail.com> %% ---------------------------------------------------------------------- %% %% This work may be distributed and/or modified under the @@ -33,8 +33,8 @@ \preamble Copyright (C) 2007--2010 by Wenchang Sun <sunwch@nankai.edu.cn> - Copyright (C) 2009--2018 by Leo Liu <leoliu.pku@gmail.com> - Copyright (C) 2012--2018 by Qing Lee <sobenlee@gmail.com> + Copyright (C) 2009--2019 by Leo Liu <leoliu.pku@gmail.com> + Copyright (C) 2012--2019 by Qing Lee <sobenlee@gmail.com> ---------------------------------------------------------------------- This work may be distributed and/or modified under the |