diff options
-rw-r--r-- | Master/texmf-dist/doc/xelatex/xecjk/xeCJK.pdf | bin | 1277907 -> 1284858 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/xelatex/xecjk/xunicode-commands.tex | 2 | ||||
-rw-r--r-- | Master/texmf-dist/doc/xelatex/xecjk/xunicode-symbols.pdf | bin | 351803 -> 351724 bytes | |||
-rw-r--r-- | Master/texmf-dist/source/xelatex/xecjk/xeCJK.dtx | 561 | ||||
-rw-r--r-- | Master/texmf-dist/tex/xelatex/xecjk/xeCJK-listings.sty | 4 | ||||
-rw-r--r-- | Master/texmf-dist/tex/xelatex/xecjk/xeCJK.cfg | 4 | ||||
-rw-r--r-- | Master/texmf-dist/tex/xelatex/xecjk/xeCJK.sty | 361 | ||||
-rw-r--r-- | Master/texmf-dist/tex/xelatex/xecjk/xeCJKfntef.sty | 4 | ||||
-rw-r--r-- | Master/texmf-dist/tex/xelatex/xecjk/xunicode-addon.sty | 84 | ||||
-rw-r--r-- | Master/texmf-dist/tex/xelatex/xecjk/xunicode-extra.def | 6 |
10 files changed, 612 insertions, 414 deletions
diff --git a/Master/texmf-dist/doc/xelatex/xecjk/xeCJK.pdf b/Master/texmf-dist/doc/xelatex/xecjk/xeCJK.pdf Binary files differindex ba364570a49..d98b93a7948 100644 --- a/Master/texmf-dist/doc/xelatex/xecjk/xeCJK.pdf +++ b/Master/texmf-dist/doc/xelatex/xecjk/xeCJK.pdf diff --git a/Master/texmf-dist/doc/xelatex/xecjk/xunicode-commands.tex b/Master/texmf-dist/doc/xelatex/xecjk/xunicode-commands.tex index 8688f11ff18..e3dc53a6a35 100644 --- a/Master/texmf-dist/doc/xelatex/xecjk/xunicode-commands.tex +++ b/Master/texmf-dist/doc/xelatex/xecjk/xunicode-commands.tex @@ -1379,6 +1379,7 @@ \UnicodeTextSymbol{"2022}{\textbullet}{BULLET} \UnicodeTextSymbol{"2025}{\texthdotfor}{TWO DOT LEADER} \UnicodeTextSymbol{"2026}{\textellipsis}{HORIZONTAL ELLIPSIS} +\UnicodeTextSymbol{"2027}{\texthyphenationpoint}{HYPHENATION POINT} \UnicodeTextSymbol{"2030}{\textperthousand}{PER MILLE SIGN} \UnicodeTextSymbol{"2031}{\textpertenthousand,\textpermille}{PER TEN THOUSAND SIGN} \UnicodeTextSymbol{"2032}{\textprime}{PRIME} @@ -2180,6 +2181,7 @@ \UnicodeTextSymbol{"2E13}{\textslashdiv}{DOTTED OBELOS} \UnicodeTextSymbol{"2E18}{\textinterrobangdown}{INVERTED INTERROBANG} \UnicodeTextSymbol{"2E2D}{\textfivedots}{FIVE DOT MARK} +\UnicodeTextSymbol{"2E3A}{\texttwoemdash}{TWO-EM DASH} \UnicodeTextSymbol{"3251}{\textcircled{21}}{CIRCLED NUMBER TWENTY ONE} \UnicodeTextSymbol{"3252}{\textcircled{22}}{CIRCLED NUMBER TWENTY TWO} \UnicodeTextSymbol{"3253}{\textcircled{23}}{CIRCLED NUMBER TWENTY THREE} diff --git a/Master/texmf-dist/doc/xelatex/xecjk/xunicode-symbols.pdf b/Master/texmf-dist/doc/xelatex/xecjk/xunicode-symbols.pdf Binary files differindex fb3dc2a8fd0..749d9f10d52 100644 --- a/Master/texmf-dist/doc/xelatex/xecjk/xunicode-symbols.pdf +++ b/Master/texmf-dist/doc/xelatex/xecjk/xunicode-symbols.pdf diff --git a/Master/texmf-dist/source/xelatex/xecjk/xeCJK.dtx b/Master/texmf-dist/source/xelatex/xecjk/xeCJK.dtx index 47ffa072f5a..7b529c66f37 100644 --- a/Master/texmf-dist/source/xelatex/xecjk/xeCJK.dtx +++ b/Master/texmf-dist/source/xelatex/xecjk/xeCJK.dtx @@ -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 25e85c2 2018-02-27 02:44:39 +0800 Qing Lee <sobenlee@gmail.com> $ +%<+!driver>\GetIdInfo$Id: xeCJK.dtx 2041e49 2018-04-07 17:31:56 +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.6.1}{\ExplFileDescription} +%<!driver> {\ExplFileDate}{3.7.0}{\ExplFileDescription} %</package|config|fntef|listings|xunicode|xunextra> %<*driver> \documentclass{ctxdoc} @@ -280,7 +280,7 @@ Copyright and Licence % \changes{v3.6.0}{2018/01/13}{同步 \LaTeXiii{} 2017/12/16。} % \changes{v3.6.1}{2018/02/27}{减少 \texttt{bool} 运算。} % -% \CheckSum{10801} +% \CheckSum{10889} % \GetFileId{xeCJK.sty} % % \title{\bfseries\pkg{xeCJK} 宏包} @@ -2120,6 +2120,14 @@ Copyright and Licence % \end{macrocode} % \end{macro} % +% \begin{macro}[int]{\xeCJK_make_boundary:} +% 利用 \cs{scan_stop:} 结束 CJK 分组,用于恢复字体等。 +% \begin{macrocode} +\cs_new_protected_nopar:Npn \xeCJK_make_boundary: + { \bool_if:NT \l_@@_CJK_group_bool { \scan_stop: } } +% \end{macrocode} +% \end{macro} +% % \subsection{功能开关} % % \begin{macro}{xeCJKactive} @@ -3857,7 +3865,7 @@ Copyright and Licence \cs_new_protected_nopar:Npn \@@_punct_bound_kern_aux:NNN #1#2 { \str_if_eq:nnTF {#1} {#2} - { \@@_punct_bound_kern:N } + { \@@_nobreak_hskip:N } { \@@_punct_if_long:NTF #1 { \skip_horizontal:N } @@ -5444,65 +5452,112 @@ Copyright and Licence \tl_if_exist:cF { \@@_punct_csname:n { dim/glue/#1/#2 } } { \@@_get_punct_bounds_aux:NN #1 #2 } } -\cs_new_protected_nopar:Npn \@@_get_punct_bounds_aux:NN #1#2 +\cs_new_protected_nopar:Npn \@@_get_punct_bounds_aux:NN { \tl_if_eq:NNTF \l_xeCJK_punct_style_tl \c_@@_punct_style_plain_tl - { - \@@_save_punct_dim:nNNn { rule } #1 #2 { \c_zero_dim } - \@@_save_punct_dim:nNNn { glue } #1 #2 { \c_zero_dim } - \@@_save_punct_dim:nNNn { offset } #1 #2 { \c_zero_dim } - \@@_save_punct_dim:nNNn { bound } \c_@@_left_tl {#2} { \c_zero_dim } - \@@_save_punct_dim:nNNn { bound } \c_@@_right_tl {#2} { \c_zero_dim } - \@@_save_punct_skip:nNNn { glue } #1 #2 { \c_zero_skip } - } - { - { \xeCJK_select_punct_font: \xeCJK_calc_punct_dimen:N #2 } - \dim_set:Nn \l_@@_bound_dim - { \@@_use_punct_dim:nNN { bound } #1 #2 } - \dim_set:Nn \l_@@_reverse_bound_dim - { - \tl_if_eq:NNTF #1 \c_@@_left_tl - { \@@_use_punct_dim:nNN { bound } \c_@@_right_tl } - { \@@_use_punct_dim:nNN { bound } \c_@@_left_tl } - #2 - } - \UseInstance { xeCJK / punctuation } { \l_xeCJK_punct_style_tl } - \xeCJK_punct_margin_process:NN #1 #2 - \xeCJK_punct_offset_process:NN #1 #2 - } + { \@@_save_punct_margin_plain:NN } + { \@@_save_punct_margin:NN } } \cs_new_protected_nopar:Npn \xeCJK_get_punct_bounds:No { \exp_last_unbraced:NNo \xeCJK_get_punct_bounds:NN } +\cs_new_protected_nopar:Npn \@@_save_punct_margin_plain:NN #1#2 + { + \@@_save_punct_dim:nNNn { rule } #1 #2 { \c_zero_dim } + \@@_save_punct_dim:nNNn { glue } #1 #2 { \c_zero_dim } + \@@_save_punct_dim:nNNn { offset } #1 #2 { \c_zero_dim } + \@@_save_punct_dim:nNNn { bound } \c_@@_left_tl {#2} { \c_zero_dim } + \@@_save_punct_dim:nNNn { bound } \c_@@_right_tl {#2} { \c_zero_dim } + \@@_save_punct_skip:nNNn { glue } #1 #2 { \c_zero_skip } + } +\cs_new_protected_nopar:Npn \@@_save_punct_margin:NN #1#2 + { + \group_begin: + \xeCJK_select_punct_font: + \xeCJK_calc_punct_dimen:N #2 + \group_end: + \dim_set:Nn \l_@@_bound_dim + { \@@_use_punct_dim:nNN { bound } #1 #2 } + \dim_set:Nn \l_@@_reverse_bound_dim + { + \tl_if_eq:NNTF #1 \c_@@_left_tl + { \@@_use_punct_dim:nNN { bound } \c_@@_right_tl } + { \@@_use_punct_dim:nNN { bound } \c_@@_left_tl } + #2 + } + \UseInstance { xeCJK / punctuation } { \l_xeCJK_punct_style_tl } + \xeCJK_punct_margin_process:NN #1 #2 + \xeCJK_punct_offset_process:NN #1 #2 + \@@_punct_if_long:NT #2 + { \@@_long_punct_kerning:N #2 } + } \dim_new:N \l_@@_bound_dim \dim_new:N \l_@@_reverse_bound_dim % \end{macrocode} % \end{macro} % +% \changes{v3.7.0}{2018/03/12}{修正长标点被隔开时的压缩处理错误。} +% +% \begin{macro}[int]{\@@_long_punct_kerning:N} +% \changes{v3.4.3}{2016/10/27}{考虑破折号边界为负值的情况。} +% 相同长标点压缩。对于破折号,计算两标点之间的空白,保证它中间不被断开。 +% 注意,破折号的边界可能为负值(比如方正新书宋),此时不必压缩。 +% \begin{macrocode} +\cs_new_protected_nopar:Npn \@@_long_punct_kerning:N #1 + { + \dim_set:Nn \l_@@_tmp_dim + { + \dim_max:nn + { \l_@@_bound_dim + \l_@@_reverse_bound_dim } + { \c_zero_dim } + } + \@@_save_punct_dim:nNNn { bound_width } #1 #1 { \l_@@_tmp_dim } + \dim_set:Nn \l_@@_tmp_dim + { + \str_case:nnTF {#1} + { { ^^^^2025 } { } { ^^^^2026 } { } } + { \c_zero_dim } + { -\l_@@_tmp_dim } + } + \@@_save_punct_dim:nNNn { kern } #1 #1 { \l_@@_tmp_dim } + \@@_save_punct_skip:nNNn { kern } #1 #1 { \l_@@_tmp_dim } + \dim_add:Nn \l_@@_tmp_dim + { \dim_max:nn { \l_@@_bound_dim } { \c_zero_dim } } + \@@_save_punct_dim:nNNn { bound_kern } #1 #1 { \l_@@_tmp_dim } + \@@_save_punct_skip:nNNn { bound_kern } #1 #1 { \l_@@_tmp_dim } + } +% \end{macrocode} +% \end{macro} +% % \begin{macro}[int]{\xeCJK_get_punct_kerning:NN} -% 标点挤压。 +% 标点压缩。 % \begin{macrocode} \cs_new_protected_nopar:Npn \xeCJK_get_punct_kerning:NN #1#2 { \tl_if_exist:cF { \@@_punct_csname:n { dim/kern/#1/#2 } } { \tl_if_eq:NNTF \l_xeCJK_punct_style_tl \c_@@_punct_style_plain_tl - { - \@@_save_punct_dim:nNNn { kern } #1 #2 { \c_zero_dim } - \@@_save_punct_dim:nNNn { break_kern } #1 #2 { \c_zero_dim } - \@@_save_punct_dim:nNNn { bound_kern } #1 #2 { \c_zero_dim } - \@@_save_punct_dim:nNNn { bound_width } #1 #2 { \c_zero_dim } - \@@_save_punct_skip:nNNn { kern } #1 #2 { \c_zero_skip } - \@@_save_punct_skip:nNNn { break_kern } #1 #2 { \c_zero_skip } - \@@_save_punct_skip:nNNn { bound_kern } #1 #2 { \c_zero_skip } - } - { - \UseInstance { xeCJK / punctuation } { \l_xeCJK_punct_style_tl } - \xeCJK_punct_kerning_process:NN #1 #2 - } + { \@@_save_punct_kerning_plain:NN } + { \@@_save_punct_kerning:NN } + #1 #2 } } \cs_new_protected_nopar:Npn \xeCJK_get_punct_kerning:oN { \exp_after:wN \xeCJK_get_punct_kerning:NN } +\cs_new_protected_nopar:Npn \@@_save_punct_kerning_plain:NN #1#2 + { + \@@_save_punct_dim:nNNn { kern } #1 #2 { \c_zero_dim } + \@@_save_punct_dim:nNNn { break_kern } #1 #2 { \c_zero_dim } + \@@_save_punct_dim:nNNn { bound_kern } #1 #2 { \c_zero_dim } + \@@_save_punct_dim:nNNn { bound_width } #1 #2 { \c_zero_dim } + \@@_save_punct_skip:nNNn { kern } #1 #2 { \c_zero_skip } + \@@_save_punct_skip:nNNn { break_kern } #1 #2 { \c_zero_skip } + \@@_save_punct_skip:nNNn { bound_kern } #1 #2 { \c_zero_skip } + } +\cs_new_protected_nopar:Npn \@@_save_punct_kerning:NN + { + \UseInstance { xeCJK / punctuation } { \l_xeCJK_punct_style_tl } + \xeCJK_punct_kerning_process:NN + } % \end{macrocode} % \end{macro} % @@ -5945,9 +6000,7 @@ Copyright and Licence % \end{macro} % % \begin{macro}[int]{\xeCJK_calc_punct_dimen:N} -% \changes{v3.4.3}{2016/10/27}{考虑破折号边界为负值的情况。} -% 计算标点的左右实际边距和实际尺寸。对于破折号,计算两标点之间的空白,保证它中间 -% 不被断开。注意,破折号的边界可能为负值(比如方正新书宋),此时不必压缩。 +% 计算标点的左右实际边距和实际尺寸。 % \begin{macrocode} \cs_new_protected_nopar:Npn \xeCJK_calc_punct_dimen:N #1 { @@ -5955,26 +6008,13 @@ Copyright and Licence { \xeCJK_glyph_bounds:NN \c_one #1 } \@@_save_punct_dim:nNNn { bound } \c_@@_right_tl #1 { \xeCJK_glyph_bounds:NN \c_three #1 } - \dim_set:Nn \l_@@_tmp_dim - { - ( \@@_use_punct_dim:nNN { bound } \c_@@_left_tl #1 ) + - ( \@@_use_punct_dim:nNN { bound } \c_@@_right_tl #1 ) - } \@@_save_punct_dim:nNn { width } #1 { \etex_fontcharwd:D \tex_font:D `#1 } \@@_save_punct_dim:nNn { dimen } #1 - { \@@_use_punct_dim:nN { width } #1 - \l_@@_tmp_dim } - \@@_punct_if_long:NT #1 { - \dim_set:Nn \l_@@_tmp_dim - { - \str_case:nnTF {#1} - { { ^^^^2025 } { } { ^^^^2026 } { } } - { \c_zero_dim } - { \dim_min:nn { - \l_@@_tmp_dim } { \c_zero_dim } } - } - \@@_save_punct_dim:nNNn { kern } #1 #1 { \l_@@_tmp_dim } - \@@_save_punct_skip:nNNn { kern } #1 #1 { \l_@@_tmp_dim } + ( \@@_use_punct_dim:nN { width } #1 ) - + ( \@@_use_punct_dim:nNN { bound } \c_@@_left_tl #1 ) - + ( \@@_use_punct_dim:nNN { bound } \c_@@_right_tl #1 ) } } % \end{macrocode} @@ -7797,7 +7837,7 @@ Copyright and Licence % \begin{macrocode} \cs_new_protected_nopar:Npn \xeCJK_visible_space: { - \bool_if:NT \l_@@_CJK_group_bool { \scan_stop: } + \xeCJK_make_boundary: \xeCJK_glyph_if_exist:NTF { ^^^^2423 } { ^^^^2423 } { @@ -7998,11 +8038,12 @@ Copyright and Licence \xeCJKsetwidth { ^^^^2013 } { 0.5 em } % \end{macrocode} % -% 执行宏包选项,并载入 \pkg{fontspec} 宏包和 \pkg{xunicode-addon}。 +% \changes{v3.7.0}{2018/03/16}{不再默认引入 \pkg{xunicode} 宏包。} +% +% 执行宏包选项,并载入 \pkg{fontspec} 宏包。 % \begin{macrocode} \ProcessKeysOptions { xeCJK / options } \RequirePackage { fontspec } [ 2012/05/01 ] -\RequirePackage { xunicode-addon } % \end{macrocode} % % \begin{variable}{\c_@@_encoding_tl} @@ -8323,21 +8364,10 @@ Copyright and Licence % \changes{v3.2.5}{2013/07/25}{解决 \pkg{fixltx2e} 和 \pkg{amsthm} 的冲突。} % \changes{v3.3.1}{2015/04/15}{删去 \pkg{fixltx2e} 和 \pkg{amsthm} 的冲突补丁。} % -% \begin{macro}[int]{\nobreakspace} % \changes{v3.1.2}{2013/01/01} % {修正非 \tn{UTFencname} 编码下面 \pkg{xunicode} 重定义的 \tn{nobreakspace} 会失效的问题。} % \changes{v3.2.5}{2013/07/18}{恢复 \tn{nobreakspace} 的原始定义。} -% 空格在 \TeX 中是特殊的记号,似乎不应该把它定义为字体中的符号(\texttt{U+00A0})。 -% \begin{macrocode} -\UndeclareTextCommand \nobreakspace { \UTFencname } -\RenewDocumentCommand \nobreakspace { } { \leavevmode \nobreak \ } -% \end{macrocode} -% \end{macro} -% -% 当符号命令紧跟在 CJK 字符类后面时,强制发生状态转移,使字体回到西文状态。 -% \begin{macrocode} -\AtBeginUTFCommand { \bool_if:NT \l_@@_CJK_group_bool { \scan_stop: } } -% \end{macrocode} +% \changes{v3.7.0}{2018/03/18}{对 \tn{nobreakspace} 的恢复放到 \pkg{xunicode-addon} 中处理。} % % \changes{v3.1.1}{2012/12/13}{对于与 \pkg{xltxtra} 的冲突给出错误警告。} % 比较老版本的 \pkg{realscripts} 定义了 \cs{dim_max:nn} 和 \cs{dim_min:nn},这与 @@ -8555,33 +8585,155 @@ Copyright and Licence % \end{macrocode} % \end{macro} % -% \begin{macro}{\@@_group_begin:,\@@_group_end:} +% \begin{macro}{\@@_inactive_group_begin:,\@@_inactive_group_end:} % 用于保护下面歧义宽度标点的分组。 % \begin{macrocode} -\cs_new_eq:NN \@@_group_begin: \group_begin: -\cs_new_eq:NN \@@_group_end: \group_end: +\cs_new_protected_nopar:Npn \@@_inactive_group_begin: + { \group_begin: \makexeCJKinactive } +\cs_new_eq:NN \@@_inactive_group_end: \group_end: % \end{macrocode} % \end{macro} % -% \begin{macro}[int]{\textellipsis} +% \begin{macro}{\@@_patch_text_command:} +% \begin{variable}{\c_@@_ambigious_char_prop} % 单独处理宽度有分歧的几个标点:包括省略号、破折号、间隔号、引号等中西文混用的 % 符号, 保证其命令形式输出的是西文字体。 +% 如果 \pkg{xunicode} 宏包被载入,则通过 \pkg{xunicode-addon} 处理。 % \begin{macrocode} -\tl_map_inline:nn +\prop_const_from_keyval:Nn \c_@@_ambigious_char_prop { - \textellipsis \textendash \textemdash \textperiodcentered - \textcentereddot \textquoteleft \textquoteright \textquotedblleft - \textquotedblright \textcdot \textgrq \textgrqq + "00B7 = \textperiodcentered \textcentereddot \textcdot , + "2013 = \textendash , + "2014 = \textemdash , + "2018 = \textquoteleft \textgrq , + "2019 = \textquoteright , + "201C = \textquotedblleft \textgrqq , + "201D = \textquotedblright , + "2025 = \texthdotfor , + "2026 = \textellipsis , + "2027 = \texthyphenationpoint , + "2E3A = \texttwoemdash } +\@@_at_end_preamble:n { \@@_patch_text_command: } +\cs_new_protected_nopar:Npn \@@_patch_text_command: { - \AtBeginUTFCommand [#1] { \@@_group_begin: \makexeCJKinactive } - \AtEndUTFCommand [#1] { \@@_group_end: } + \xeCJK_if_package_loaded:nTF { xunicode } + { \@@_patch_xunicode_ambigious_char: } + { + \exp_args:Nx \@@_patch_tuenc_ambigious_char:n + { \UnicodeEncodingName } + \@@_patch_tuenc_accent: + \@@_patch_tuenc_composite: + } + } +\cs_new_protected_nopar:Npn \@@_patch_xunicode_ambigious_char: + { + \RequirePackage { xunicode-addon } + \prop_map_inline:Nn \c_@@_ambigious_char_prop + { + \tl_map_inline:nn { ##2 } + { + \xunadd_set_begin_hook:nn { ####1 } + { \@@_inactive_group_begin: } + \xunadd_set_end_hook:nn { ####1 } + { \@@_inactive_group_end: } + } + } + \xunadd_append_begin_hook:n { \xeCJK_make_boundary: } + } +\cs_new_protected_nopar:Npn \@@_patch_tuenc_ambigious_char:n #1 + { + \prop_map_inline:Nn \c_@@_ambigious_char_prop + { + \tl_map_inline:nn { ##2 } + { + \cs_if_exist:NF ####1 + { \DeclareTextSymbol ####1 {#1} { ##1 } } + \@@_patch_ambigious_char:nN {#1} ####1 + } + } + } +\cs_new_protected_nopar:Npn \@@_patch_ambigious_char:nN #1#2 + { + \exp_args:Nx \@@_patch_ambigious_char:n + { #1 \token_to_str:N #2 } + } +\cs_new_protected_nopar:Npx \@@_patch_ambigious_char:nNn #1#2#3 + { + \exp_args:Nx \exp_not:N \@@_patch_ambigious_char:n + { + \c_backslash_str #1 + \exp_not:N \token_to_str:N #2 - + \exp_not:N \token_to_str:N #3 + } + } +\cs_new_protected_nopar:Npn \@@_patch_ambigious_char:n #1 + { + \cs_if_free:cF {#1} + { \exp_args:Nc \@@_patch_ambigious_char:N {#1} } + } +\cs_new_protected_nopar:Npn \@@_patch_ambigious_char:N #1 + { + \cs_set_protected_nopar:Npx #1 + { + \@@_ambigious_char:n + { \token_if_chardef:NTF #1 { \utex_char:D } { \exp_not:o } #1 } + } + } +\cs_new_protected_nopar:Npn \@@_ambigious_char:n #1 + { + \int_compare:nNnTF \xetex_interchartokenstate:D > \c_zero + { \@@_inactive_group_begin: #1 \@@_inactive_group_end: } + {#1} + } +% \end{macrocode} +% \end{variable} +% \end{macro} +% +% \begin{macro}{\@@_patch_tuenc_composite:} +% \tn{DeclareUnicodeComposite} 具有检查字符是否存在的功能, +% 当符号命令紧跟在 CJK 字符类后面时,需要使字体回到西文状态 +% \begin{macrocode} +\cs_new_protected_nopar:Npn \xeCJK@composite@patch + { + \str_if_eq_x:nnT { \f@encoding } { \UnicodeEncodingName } + { \xeCJK_make_boundary: } + } +\cs_new_protected_nopar:Npn \@@_patch_tuenc_composite: + { + \cs_set_nopar:Npn \@text@composite@x ##1 + { + \xeCJK@composite@patch + \ifx ##1 \relax + \expandafter \@secondoftwo + \else + \expandafter \@firstoftwo + \fi + ##1 + } } % \end{macrocode} % \end{macro} % -% \begin{macro}{\@@_patch_Bxii:n} -% \begin{variable}{\l_@@_patch_Bxii_tl} +% \begin{macro}{\@@_patch_tuenc_accent:} +% \tn{add@unicode@accent} 定义最后用于截断数字展开的 \tn{relax} 会造成边界,可能会影响组合标记。 +% \begin{macrocode} +\group_begin: +\char_set_catcode_other:n { "A0 } +\cs_new_protected_nopar:Npn \@@_patch_tuenc_accent: + { + \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: + } + } +\group_end: +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_patch_middle_dot:} +% \begin{variable}{\c_@@_middle_dot_prop} % \changes{v3.2.9}{2013/12/08} % {完整处理 \file{encguide.pdf} 的编码符号表中,与旧编码的 \texttt{U+00B7} 冲突。} % 常被用作中文间隔号的 \texttt{U+00B7} 与 T1 等旧字体编码下定义的符号命令冲突。 @@ -8600,78 +8752,36 @@ Copyright and Licence % \DeclareTextSymbol{\textperiodcentered}{LY1}{183} % \end{verbatim} % LGR 编码的符号表有 \texttt{183} 号字符,但在 \file{lgrenc.def} 中未找到相应的 -% 符号命令,它的输入方式为 |>`w| 或者 |\accpsilivaria{w}|。前者比较特殊,如果 -% 与 \pkg{xeCJK} 一起使用,\XeTeX\ 会出现如下错误。 -% \begin{verbatim} -% ! Cannot use \xetex_glyphbounds:D with grmn1000; not a native platform font. -% \xeCJK_glyph_bounds:NN ...use:N \xetex_glyphbounds:D -% #1 \xetex_charglyph:D \xeCJK_... -% \end{verbatim} -% 这个不好处理,只修改后者。 +% 符号命令。 % \begin{macrocode} -\@@_after_end_preamble:n { \l_@@_patch_Bxii_tl } -\tl_new:N \l_@@_patch_Bxii_tl -\cs_new_protected_nopar:Npn \@@_patch_Bxii:nN #1#2 +\prop_const_from_keyval:Nn \c_@@_middle_dot_prop { - \tl_put_right:Nx \l_@@_patch_Bxii_tl - { \@@_patch_Bxii:n { #1 \token_to_str:N #2 } } + T2A = \cyrchvcrs , + T2B = \cyrchldsc , + T2C = \cyrabhha , + X2 = \cyrchldsc , + TS1 = \textperiodcentered , + LY1 = \textperiodcentered , + T1 = \r u , + T4 = \B t , + T5 = \` \ecircumflex } -\group_begin: -\cs_set:Npn \@@_tmp:w #1 +\@@_after_end_preamble:n { \@@_patch_middle_dot: } +\cs_new_protected_nopar:Npn \@@_patch_middle_dot: { - \group_end: - \cs_new_protected_nopar:Npn \@@_patch_Bxii:nNN ##1##2##3 - { - \tl_put_right:Nx \l_@@_patch_Bxii_tl - { - \@@_patch_Bxii:Nnn - #1 { ##1 \token_to_str:N ##2 } { \token_to_str:N ##3 } - } - } - } -\use:n - { - \char_set_catcode_other:N \\ - \@@_tmp:w + \prop_map_inline:Nn \c_@@_middle_dot_prop + { \@@_patch_middle_dot:nw { ##1 } ##2 \q_stop } + \@@_patch_ambigious_char:nNn { T5 } \` { \^ - e } } - { \ } -\cs_new_protected_nopar:Npn \@@_patch_Bxii:n #1 - { \cs_if_free:cF {#1} { \cs_gset_eq:cN {#1} \@@_Default_Bxii: } } -\cs_new_protected_nopar:Npn \@@_patch_Bxii:Nnn #1#2#3 - { \cs_if_free:cF {#2} { \cs_gset_eq:cN { #1#2 - #3 } \@@_Default_Bxii: } } -\group_begin: -\char_set_catcode_other:n { 183 } -\cs_new_protected_nopar:Npn \@@_Default_Bxii: +\cs_new_protected_nopar:Npn \@@_patch_middle_dot:nw #1#2#3 \q_stop { - \int_compare:nNnTF \xetex_interchartokenstate:D > \c_zero - { \@@_group_begin: \makexeCJKinactive ^^b7 \@@_group_end: } - { ^^b7 } - } -\group_end: -\clist_map_inline:nn - { - { T3 } \textvibyy , - { T2A } \cyrchvcrs , - { T2B } \cyrchldsc , - { T2C } \cyrabhha , - { X2 } \cyrchldsc , - { TS1 } \textperiodcentered , - { LY1 } \textperiodcentered - } - { \@@_patch_Bxii:nN #1 } -\clist_map_inline:nn - { - { T1 } \r u , - { T4 } \B t , - { T5 } \` \ecircumflex , - { LGR } \accpsilivaria w - } - { \@@_patch_Bxii:nNN #1 } -\tl_put_right:Nx \l_@@_patch_Bxii_tl - { - \@@_patch_Bxii:n - { \token_to_str:N \T 5 \token_to_str:N \` - \token_to_str:N \^ - e } + \tl_if_empty:nTF {#3} + { \@@_patch_ambigious_char:nN {#1} #2 } + { \@@_patch_ambigious_char:nNn {#1} #2 {#3} } } +% \end{macrocode} +% \pkg{pifont} 宏包的符号 |\ding{183}| 也有冲突。 +% \begin{macrocode} \@@_after_end_preamble:n { \xeCJK_if_package_loaded:nT { pifont } @@ -8688,15 +8798,15 @@ Copyright and Licence % \begin{macrocode} \@@_after_end_preamble:n { - \xeCJK_if_package_loaded:nT { hyperref } + \cs_if_exist_use:NT \pdfstringdefDisableCommands { - \pdfstringdefDisableCommands - { - \@@_gobble_CJKfamily: - \xeCJK_cs_clear:N \makexeCJKinactive - \xeCJK_cs_clear:N \@@_group_begin: - \xeCJK_cs_clear:N \@@_group_end: - } + { + \@@_gobble_CJKfamily: + \xeCJK_cs_clear:N \@@_inactive_group_begin: + \xeCJK_cs_clear:N \@@_inactive_group_end: + \xeCJK_cs_clear:N \makexeCJKinactive + \xeCJK_cs_clear:N \xeCJK@composite@patch + } } } % \end{macrocode} @@ -8781,39 +8891,20 @@ Copyright and Licence \str_if_eq:nnT {#1} { \CJK@UnicodeEnc } { \group_begin: - \cs_set_eq:NN \Unicode \@@_calc_unicode:nn - \cs_set_eq:NN \def \xeCJK_char_from_charcode:Nn + \cs_set_eq:NN \Unicode \xeCJK_unicode_char:nn + \cs_set_eq:NN \def \xdef #2 \group_end: - \tl_gset:Nn \CJK@tenthousand { ^^^^4e07 } - \tl_gset:Nn \CJK@hundredmillion { ^^^^4ebf } + \str_gset:Nx \CJK@tenthousand { ^^^^4e07 } + \str_gset:Nx \CJK@hundredmillion { ^^^^4ebf } \tl_if_exist:NF \CJK@UnicodeEnc { \tl_const:Nn \CJK@UnicodeEnc { UTF8 } } \cs_if_exist:NF \Unicode { \cs_new_eq:NN \Unicode \xeCJK_unicode_char:nn } } } -\cs_if_exist:NTF \utex_charcat:D - { - \cs_new_protected_nopar:Npn \xeCJK_char_from_charcode:Nn #1#2 - { \tl_const:Nx #1 { \char_generate:nn {#2} { \c_eleven } } } - } - { - \cs_new_protected_nopar:Npn \xeCJK_char_from_charcode:Nn #1#2 - { - \group_begin: - \char_set_lccode:nn { "4E00 } {#2} - \tex_lowercase:D - { - \group_end: - \tl_const:Nn #1 { ^^^^4e00 } - } - } - } -\cs_new_nopar:Npn \@@_calc_unicode:nn #1#2 - { (#1) * \c_two_hundred_fifty_six + (#2) } -\cs_new_protected_nopar:Npn \xeCJK_unicode_char:nn #1#2 - { \tex_char:D \etex_numexpr:D \@@_calc_unicode:nn {#1} {#2} \scan_stop: } +\cs_new_nopar:Npn \xeCJK_unicode_char:nn #1#2 + { \utex_char:D \etex_numexpr:D (#1) * 256 + (#2) \scan_stop: } % \end{macrocode} % \end{macro} % @@ -10744,8 +10835,8 @@ Copyright and Licence { \clist_get:NNF \g_@@_encname_clist \UTFencname { - \file_if_exist:nTF { tuenc.def } - { \tl_set:Nn \UTFencname { TU } } + \cs_if_exist:NTF \UnicodeEncodingName + { \tl_set:Nx \UTFencname { \UnicodeEncodingName } } { \sys_if_engine_xetex:TF { \tl_set:Nn \UTFencname { EU1 } } @@ -10939,8 +11030,8 @@ Copyright and Licence % \begin{macrocode} \RenewDocumentCommand \DeclareUTFcharacter { O { \UTFencname } m m } { - \str_if_eq:nnTF {#3} { \hbar } - { \@@_restore_hbar: } + \cs_if_exist_use:cF + { @@_restore_ \tl_to_str:n {#3} : } { \@@_if_csname:nTF {#3} { \@@_declare_character:Nnn #3 } @@ -10951,38 +11042,42 @@ Copyright and Licence % \end{macrocode} % \end{macro} % -% \begin{macro}{\@@_restore_hbar:} -% 恢复 \tn{hbar} 为原本定义。 +% \begin{macro}{\@@_restore_cmd:N} +% 恢复 \tn{hbar} 和 \tn{nobreakspace} 为原本定义。 % \begin{macrocode} -\cs_new_protected_nopar:Npn \@@_restore_hbar: +\cs_new_protected_nopar:cpn + { @@_restore_ \tl_to_str:n { \hbar } : } + { \@@_restore_cmd:N \hbar } +\cs_new_protected_nopar:cpn + { @@_restore_ \tl_to_str:n { \nobreakspace } : } + { \@@_restore_cmd:N \nobreakspace } +\cs_new_protected_nopar:Npn \@@_restore_cmd:N #1 + { \@@_restore_cmd:Nx #1 { ? - \token_to_str:N #1 } } +\cs_new_protected_nopar:Npn \@@_restore_cmd:Nn #1#2 { - \cs_if_free:cF { ? - \token_to_str:N \hbar } - { \@@_restore_hbar:c { ? - \token_to_str:N \hbar } } + \cs_if_free:cF {#2} + { \@@_restore_cmd:Nc #1 {#2} } } -\cs_new_protected_nopar:Npn \@@_restore_hbar:N #1 +\cs_new_protected_nopar:Npn \@@_restore_cmd:NN #1#2 { - \cs_gset_eq:NN \hbar #1 - \cs_undefine:N #1 + \cs_gset_eq:NN #1 #2 + \cs_undefine:N #2 } -\cs_generate_variant:Nn \@@_restore_hbar:N { c } +\cs_generate_variant:Nn \@@_restore_cmd:Nn { Nx } +\cs_generate_variant:Nn \@@_restore_cmd:NN { Nc } % \end{macrocode} % \end{macro} % % \begin{macro}{\@@_declare_character:Nnn} -% 通过 \texttt{lowercase} 技巧,直接由 Unicode |#3| 得到编码 |#2| 下的符号命令 +% 通过 \cs{utex_char:D} 直接由 Unicode |#3| 得到编码 |#2| 下的符号命令 % |#1| 对应的实际字符。\tn{DeclareUTFSymbol} 的参数格式与 \tn{DeclareTextSymbol} % 完全一致。 % \begin{macrocode} \cs_new_protected:Npn \@@_declare_character:Nnn #1#2#3 { \@@_provide_text_command_default:N #1 - \group_begin: - \char_set_lccode:nn { `0 } { \@@_check_slot:n {#3} } - \tex_lowercase:D - { - \group_end: - \@@_declare_character:NNxn 0 - } + \exp_after:wN \@@_declare_character:NNxn + \utex_char:D \@@_check_slot:n {#3} \exp_stop_f: #1 { \token_to_str:N #1 } {#2} } \cs_generate_variant:Nn \@@_declare_character:Nnn { c } @@ -11236,18 +11331,13 @@ Copyright and Licence % \end{macro} % % \begin{macro}{\@@_declare_encoded:NNnnn} -% 通过 \texttt{lowercase} 技巧,直接由重音符号的 Unicode 得到实际字符。 +% 通过 \cs{utex_char:D} 直接由重音符号的 Unicode 得到实际字符。 % \begin{macrocode} \cs_new_protected:Npn \@@_declare_encoded:NNnnn #1#2#3#4#5 { - \group_begin: - \char_set_lccode:nn { `4 } { \@@_check_slot:n {#4} } - \char_set_lccode:nn { `5 } { \@@_check_slot:n {#5} } - \tex_lowercase:D - { - \group_end: - \@@_declare_encoded:NNNNxx 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: #1 #2 { \token_to_str:N #2 } {#3} } \cs_new_protected:Npn \@@_declare_encoded:NNNNnn #1#2#3#4#5#6 @@ -11497,28 +11587,39 @@ Copyright and Licence \tl_if_blank:nTF {#2} { \IfBooleanTF {#1} - { \tl_set:Nn \l_@@_begin_hook_tl {#3} } - { \tl_put_right:Nn \l_@@_begin_hook_tl {#3} } + { \xunadd_set_begin_hook:n } + { \xunadd_append_begin_hook:n } } - { \@@_set_cmd_hook:nnn { begin } {#2} {#3} } + { \xunadd_set_begin_hook:nn {#2} } } \NewDocumentCommand \AtEndUTFCommand { s O { } +m } { \tl_if_blank:nTF {#2} { \IfBooleanTF {#1} - { \tl_set:Nn \l_@@_end_hook_tl {#3} } - { \tl_put_right:Nn \l_@@_end_hook_tl {#3} } + { \xunadd_set_end_hook:n } + { \xunadd_append_end_hook:n } } - { \@@_set_cmd_hook:nnn { end } {#2} {#3} } + { \xunadd_set_begin_hook:nn {#2} } + {#3} } -\tl_new:N \l_@@_begin_hook_tl -\tl_new:N \l_@@_end_hook_tl % \end{macrocode} % \end{macro} % -% \begin{macro}{\@@_set_cmd_hook:nnn} +% \begin{macro}[int]{\xunadd_set_begin_hook:n,\xunadd_set_end_hook:n} % \begin{macrocode} +\cs_new_protected_nopar:Npn \xunadd_set_begin_hook:n + { \tl_set:Nn \l_@@_begin_hook_tl } +\cs_new_protected_nopar:Npn \xunadd_append_begin_hook:n + { \tl_put_right:Nn \l_@@_begin_hook_tl } +\cs_new_protected_nopar:Npn \xunadd_set_end_hook:n + { \tl_set:Nn \l_@@_end_hook_tl } +\cs_new_protected_nopar:Npn \xunadd_append_end_hook:n + { \tl_put_right:Nn \l_@@_end_hook_tl } +\cs_new_protected_nopar:Npn \xunadd_set_begin_hook:nn + { \@@_set_cmd_hook:nnn { begin } } +\cs_new_protected_nopar:Npn \xunadd_set_end_hook:nn + { \@@_set_cmd_hook:nnn { end } } \cs_new_protected:Npn \@@_set_cmd_hook:nnn #1#2#3 { \cs_set_protected:cpn @@ -11533,6 +11634,8 @@ Copyright and Licence { \use:c { @@_#3_csname:n } { \token_to_str:N #1 - \tl_to_str:n {#2} } } \cs_new_nopar:Npn \@@_begin_csname:n #1 { @@_begin_#1_hook:n } \cs_new_nopar:Npn \@@_end_csname:n #1 { @@_end_#1_hook:n } +\tl_new:N \l_@@_begin_hook_tl +\tl_new:N \l_@@_end_hook_tl % \end{macrocode} % \end{macro} % @@ -11590,6 +11693,14 @@ Copyright and Licence %<*xunextra> % \end{macrocode} % +% \changes{v3.7.0}{2018/03/16}{补充定义 \tn{texthyphenationpoint} 和 \tn{texttwoemdash}。} +% +% 我们补充定义 HYPHENATION POINT 和 TWO-EM DASH,他们默认被归入 CJK 标点符号。 +% \begin{macrocode} +\DeclareUTFSymbol\texthyphenationpoint{"2027} +\DeclareUTFSymbol\texttwoemdash{"2E3A} +% \end{macrocode} +% % 以下内容选自 \pkg{xunicode},并做了适当修改。 % \begin{macrocode} \DeclareUTFComposite\textsuperscript diff --git a/Master/texmf-dist/tex/xelatex/xecjk/xeCJK-listings.sty b/Master/texmf-dist/tex/xelatex/xecjk/xeCJK-listings.sty index 8b2070d3e4c..0c847aee915 100644 --- a/Master/texmf-dist/tex/xelatex/xecjk/xeCJK-listings.sty +++ b/Master/texmf-dist/tex/xelatex/xecjk/xeCJK-listings.sty @@ -29,10 +29,10 @@ %% \NeedsTeXFormat{LaTeX2e} \RequirePackage{expl3} -\GetIdInfo$Id: xeCJK.dtx 25e85c2 2018-02-27 02:44:39 +0800 Qing Lee <sobenlee@gmail.com> $ +\GetIdInfo$Id: xeCJK.dtx 2041e49 2018-04-07 17:31:56 +0800 Qing Lee <sobenlee@gmail.com> $ {xeCJK patch file for listings} \ProvidesExplPackage{xeCJK-listings} - {\ExplFileDate}{3.6.1}{\ExplFileDescription} + {\ExplFileDate}{3.7.0}{\ExplFileDescription} \DeclareOption* { \PassOptionsToPackage { \CurrentOption } { xeCJK } } \ProcessOptions \scan_stop: \RequirePackage { xeCJK } diff --git a/Master/texmf-dist/tex/xelatex/xecjk/xeCJK.cfg b/Master/texmf-dist/tex/xelatex/xecjk/xeCJK.cfg index e2cda61d1df..12d2815a4a8 100644 --- a/Master/texmf-dist/tex/xelatex/xecjk/xeCJK.cfg +++ b/Master/texmf-dist/tex/xelatex/xecjk/xeCJK.cfg @@ -6,10 +6,10 @@ %% %% xeCJK.dtx (with options: `config') %% -\GetIdInfo$Id: xeCJK.dtx 25e85c2 2018-02-27 02:44:39 +0800 Qing Lee <sobenlee@gmail.com> $ +\GetIdInfo$Id: xeCJK.dtx 2041e49 2018-04-07 17:31:56 +0800 Qing Lee <sobenlee@gmail.com> $ {Configuration file for xeCJK package} \ProvidesExplFile{\ExplFileName.cfg} - {\ExplFileDate}{3.6.1}{\ExplFileDescription} + {\ExplFileDate}{3.7.0}{\ExplFileDescription} %% %% diff --git a/Master/texmf-dist/tex/xelatex/xecjk/xeCJK.sty b/Master/texmf-dist/tex/xelatex/xecjk/xeCJK.sty index 69bea63c023..39ddda3be71 100644 --- a/Master/texmf-dist/tex/xelatex/xecjk/xeCJK.sty +++ b/Master/texmf-dist/tex/xelatex/xecjk/xeCJK.sty @@ -29,10 +29,10 @@ %% \NeedsTeXFormat{LaTeX2e} \RequirePackage{expl3} -\GetIdInfo$Id: xeCJK.dtx 25e85c2 2018-02-27 02:44:39 +0800 Qing Lee <sobenlee@gmail.com> $ +\GetIdInfo$Id: xeCJK.dtx 2041e49 2018-04-07 17:31:56 +0800 Qing Lee <sobenlee@gmail.com> $ {Typesetting CJK scripts with XeLaTeX} \ProvidesExplPackage{\ExplFileName} - {\ExplFileDate}{3.6.1}{\ExplFileDescription} + {\ExplFileDate}{3.7.0}{\ExplFileDescription} \msg_new:nnn { xeCJK } { Require-XeTeX } { The~xeCJK~package~requires~XeTeX~to~function.\\\\ @@ -383,6 +383,8 @@ \xeCJK_token_value_class:N #2 \exp_stop_f: \prg_return_true: \else: \prg_return_false: \fi: } +\cs_new_protected_nopar:Npn \xeCJK_make_boundary: + { \bool_if:NT \l__xeCJK_CJK_group_bool { \scan_stop: } } \keys_define:nn { xeCJK / options } { xeCJKactive .choice: , @@ -1317,7 +1319,7 @@ \cs_new_protected_nopar:Npn \__xeCJK_punct_bound_kern_aux:NNN #1#2 { \str_if_eq:nnTF {#1} {#2} - { \__xeCJK_punct_bound_kern:N } + { \__xeCJK_nobreak_hskip:N } { \__xeCJK_punct_if_long:NTF #1 { \skip_horizontal:N } @@ -2436,59 +2438,96 @@ \tl_if_exist:cF { \__xeCJK_punct_csname:n { dim/glue/#1/#2 } } { \__xeCJK_get_punct_bounds_aux:NN #1 #2 } } -\cs_new_protected_nopar:Npn \__xeCJK_get_punct_bounds_aux:NN #1#2 +\cs_new_protected_nopar:Npn \__xeCJK_get_punct_bounds_aux:NN { \tl_if_eq:NNTF \l_xeCJK_punct_style_tl \c__xeCJK_punct_style_plain_tl - { - \__xeCJK_save_punct_dim:nNNn { rule } #1 #2 { \c_zero_dim } - \__xeCJK_save_punct_dim:nNNn { glue } #1 #2 { \c_zero_dim } - \__xeCJK_save_punct_dim:nNNn { offset } #1 #2 { \c_zero_dim } - \__xeCJK_save_punct_dim:nNNn { bound } \c__xeCJK_left_tl {#2} { \c_zero_dim } - \__xeCJK_save_punct_dim:nNNn { bound } \c__xeCJK_right_tl {#2} { \c_zero_dim } - \__xeCJK_save_punct_skip:nNNn { glue } #1 #2 { \c_zero_skip } - } - { - { \xeCJK_select_punct_font: \xeCJK_calc_punct_dimen:N #2 } - \dim_set:Nn \l__xeCJK_bound_dim - { \__xeCJK_use_punct_dim:nNN { bound } #1 #2 } - \dim_set:Nn \l__xeCJK_reverse_bound_dim - { - \tl_if_eq:NNTF #1 \c__xeCJK_left_tl - { \__xeCJK_use_punct_dim:nNN { bound } \c__xeCJK_right_tl } - { \__xeCJK_use_punct_dim:nNN { bound } \c__xeCJK_left_tl } - #2 - } - \UseInstance { xeCJK / punctuation } { \l_xeCJK_punct_style_tl } - \xeCJK_punct_margin_process:NN #1 #2 - \xeCJK_punct_offset_process:NN #1 #2 - } + { \__xeCJK_save_punct_margin_plain:NN } + { \__xeCJK_save_punct_margin:NN } } \cs_new_protected_nopar:Npn \xeCJK_get_punct_bounds:No { \exp_last_unbraced:NNo \xeCJK_get_punct_bounds:NN } +\cs_new_protected_nopar:Npn \__xeCJK_save_punct_margin_plain:NN #1#2 + { + \__xeCJK_save_punct_dim:nNNn { rule } #1 #2 { \c_zero_dim } + \__xeCJK_save_punct_dim:nNNn { glue } #1 #2 { \c_zero_dim } + \__xeCJK_save_punct_dim:nNNn { offset } #1 #2 { \c_zero_dim } + \__xeCJK_save_punct_dim:nNNn { bound } \c__xeCJK_left_tl {#2} { \c_zero_dim } + \__xeCJK_save_punct_dim:nNNn { bound } \c__xeCJK_right_tl {#2} { \c_zero_dim } + \__xeCJK_save_punct_skip:nNNn { glue } #1 #2 { \c_zero_skip } + } +\cs_new_protected_nopar:Npn \__xeCJK_save_punct_margin:NN #1#2 + { + \group_begin: + \xeCJK_select_punct_font: + \xeCJK_calc_punct_dimen:N #2 + \group_end: + \dim_set:Nn \l__xeCJK_bound_dim + { \__xeCJK_use_punct_dim:nNN { bound } #1 #2 } + \dim_set:Nn \l__xeCJK_reverse_bound_dim + { + \tl_if_eq:NNTF #1 \c__xeCJK_left_tl + { \__xeCJK_use_punct_dim:nNN { bound } \c__xeCJK_right_tl } + { \__xeCJK_use_punct_dim:nNN { bound } \c__xeCJK_left_tl } + #2 + } + \UseInstance { xeCJK / punctuation } { \l_xeCJK_punct_style_tl } + \xeCJK_punct_margin_process:NN #1 #2 + \xeCJK_punct_offset_process:NN #1 #2 + \__xeCJK_punct_if_long:NT #2 + { \__xeCJK_long_punct_kerning:N #2 } + } \dim_new:N \l__xeCJK_bound_dim \dim_new:N \l__xeCJK_reverse_bound_dim +\cs_new_protected_nopar:Npn \__xeCJK_long_punct_kerning:N #1 + { + \dim_set:Nn \l__xeCJK_tmp_dim + { + \dim_max:nn + { \l__xeCJK_bound_dim + \l__xeCJK_reverse_bound_dim } + { \c_zero_dim } + } + \__xeCJK_save_punct_dim:nNNn { bound_width } #1 #1 { \l__xeCJK_tmp_dim } + \dim_set:Nn \l__xeCJK_tmp_dim + { + \str_case:nnTF {#1} + { { ^^^^2025 } { } { ^^^^2026 } { } } + { \c_zero_dim } + { -\l__xeCJK_tmp_dim } + } + \__xeCJK_save_punct_dim:nNNn { kern } #1 #1 { \l__xeCJK_tmp_dim } + \__xeCJK_save_punct_skip:nNNn { kern } #1 #1 { \l__xeCJK_tmp_dim } + \dim_add:Nn \l__xeCJK_tmp_dim + { \dim_max:nn { \l__xeCJK_bound_dim } { \c_zero_dim } } + \__xeCJK_save_punct_dim:nNNn { bound_kern } #1 #1 { \l__xeCJK_tmp_dim } + \__xeCJK_save_punct_skip:nNNn { bound_kern } #1 #1 { \l__xeCJK_tmp_dim } + } \cs_new_protected_nopar:Npn \xeCJK_get_punct_kerning:NN #1#2 { \tl_if_exist:cF { \__xeCJK_punct_csname:n { dim/kern/#1/#2 } } { \tl_if_eq:NNTF \l_xeCJK_punct_style_tl \c__xeCJK_punct_style_plain_tl - { - \__xeCJK_save_punct_dim:nNNn { kern } #1 #2 { \c_zero_dim } - \__xeCJK_save_punct_dim:nNNn { break_kern } #1 #2 { \c_zero_dim } - \__xeCJK_save_punct_dim:nNNn { bound_kern } #1 #2 { \c_zero_dim } - \__xeCJK_save_punct_dim:nNNn { bound_width } #1 #2 { \c_zero_dim } - \__xeCJK_save_punct_skip:nNNn { kern } #1 #2 { \c_zero_skip } - \__xeCJK_save_punct_skip:nNNn { break_kern } #1 #2 { \c_zero_skip } - \__xeCJK_save_punct_skip:nNNn { bound_kern } #1 #2 { \c_zero_skip } - } - { - \UseInstance { xeCJK / punctuation } { \l_xeCJK_punct_style_tl } - \xeCJK_punct_kerning_process:NN #1 #2 - } + { \__xeCJK_save_punct_kerning_plain:NN } + { \__xeCJK_save_punct_kerning:NN } + #1 #2 } } \cs_new_protected_nopar:Npn \xeCJK_get_punct_kerning:oN { \exp_after:wN \xeCJK_get_punct_kerning:NN } +\cs_new_protected_nopar:Npn \__xeCJK_save_punct_kerning_plain:NN #1#2 + { + \__xeCJK_save_punct_dim:nNNn { kern } #1 #2 { \c_zero_dim } + \__xeCJK_save_punct_dim:nNNn { break_kern } #1 #2 { \c_zero_dim } + \__xeCJK_save_punct_dim:nNNn { bound_kern } #1 #2 { \c_zero_dim } + \__xeCJK_save_punct_dim:nNNn { bound_width } #1 #2 { \c_zero_dim } + \__xeCJK_save_punct_skip:nNNn { kern } #1 #2 { \c_zero_skip } + \__xeCJK_save_punct_skip:nNNn { break_kern } #1 #2 { \c_zero_skip } + \__xeCJK_save_punct_skip:nNNn { bound_kern } #1 #2 { \c_zero_skip } + } +\cs_new_protected_nopar:Npn \__xeCJK_save_punct_kerning:NN + { + \UseInstance { xeCJK / punctuation } { \l_xeCJK_punct_style_tl } + \xeCJK_punct_kerning_process:NN + } \cs_new_protected_nopar:Npn \xeCJK_punct_margin_process:NN #1#2 { \dim_set:Nn \l__xeCJK_tmp_dim @@ -2858,26 +2897,13 @@ { \xeCJK_glyph_bounds:NN \c_one #1 } \__xeCJK_save_punct_dim:nNNn { bound } \c__xeCJK_right_tl #1 { \xeCJK_glyph_bounds:NN \c_three #1 } - \dim_set:Nn \l__xeCJK_tmp_dim - { - ( \__xeCJK_use_punct_dim:nNN { bound } \c__xeCJK_left_tl #1 ) + - ( \__xeCJK_use_punct_dim:nNN { bound } \c__xeCJK_right_tl #1 ) - } \__xeCJK_save_punct_dim:nNn { width } #1 { \etex_fontcharwd:D \tex_font:D `#1 } \__xeCJK_save_punct_dim:nNn { dimen } #1 - { \__xeCJK_use_punct_dim:nN { width } #1 - \l__xeCJK_tmp_dim } - \__xeCJK_punct_if_long:NT #1 { - \dim_set:Nn \l__xeCJK_tmp_dim - { - \str_case:nnTF {#1} - { { ^^^^2025 } { } { ^^^^2026 } { } } - { \c_zero_dim } - { \dim_min:nn { - \l__xeCJK_tmp_dim } { \c_zero_dim } } - } - \__xeCJK_save_punct_dim:nNNn { kern } #1 #1 { \l__xeCJK_tmp_dim } - \__xeCJK_save_punct_skip:nNNn { kern } #1 #1 { \l__xeCJK_tmp_dim } + ( \__xeCJK_use_punct_dim:nN { width } #1 ) - + ( \__xeCJK_use_punct_dim:nNN { bound } \c__xeCJK_left_tl #1 ) - + ( \__xeCJK_use_punct_dim:nNN { bound } \c__xeCJK_right_tl #1 ) } } \cs_new_nopar:Npn \xeCJK_glyph_bounds:NN #1#2 @@ -4219,7 +4245,7 @@ \prop_new:N \g__xeCJK_scale_family_prop \cs_new_protected_nopar:Npn \xeCJK_visible_space: { - \bool_if:NT \l__xeCJK_CJK_group_bool { \scan_stop: } + \xeCJK_make_boundary: \xeCJK_glyph_if_exist:NTF { ^^^^2423 } { ^^^^2423 } { @@ -4362,7 +4388,6 @@ \xeCJKsetwidth { ^^^^2013 } { 0.5 em } \ProcessKeysOptions { xeCJK / options } \RequirePackage { fontspec } [ 2012/05/01 ] -\RequirePackage { xunicode-addon } \tl_const:Nx \c__xeCJK_encoding_tl { \g_fontspec_encoding_tl } \keys_define:nn { xeCJK / options } { @@ -4562,9 +4587,6 @@ \__xeCJK_math_robust:N \endmath } \__xeCJK_math_robust:N \ensuremath -\UndeclareTextCommand \nobreakspace { \UTFencname } -\RenewDocumentCommand \nobreakspace { } { \leavevmode \nobreak \ } -\AtBeginUTFCommand { \bool_if:NT \l__xeCJK_CJK_group_bool { \scan_stop: } } \__xeCJK_msg_new:nn { conflict-package } { The~`#1'~package~is~too~old. \\ @@ -4708,80 +4730,148 @@ } } } -\cs_new_eq:NN \__xeCJK_group_begin: \group_begin: -\cs_new_eq:NN \__xeCJK_group_end: \group_end: -\tl_map_inline:nn +\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 { - \textellipsis \textendash \textemdash \textperiodcentered - \textcentereddot \textquoteleft \textquoteright \textquotedblleft - \textquotedblright \textcdot \textgrq \textgrqq + "00B7 = \textperiodcentered \textcentereddot \textcdot , + "2013 = \textendash , + "2014 = \textemdash , + "2018 = \textquoteleft \textgrq , + "2019 = \textquoteright , + "201C = \textquotedblleft \textgrqq , + "201D = \textquotedblright , + "2025 = \texthdotfor , + "2026 = \textellipsis , + "2027 = \texthyphenationpoint , + "2E3A = \texttwoemdash } +\__xeCJK_at_end_preamble:n { \__xeCJK_patch_text_command: } +\cs_new_protected_nopar:Npn \__xeCJK_patch_text_command: { - \AtBeginUTFCommand [#1] { \__xeCJK_group_begin: \makexeCJKinactive } - \AtEndUTFCommand [#1] { \__xeCJK_group_end: } + \xeCJK_if_package_loaded:nTF { xunicode } + { \__xeCJK_patch_xunicode_ambigious_char: } + { + \exp_args:Nx \__xeCJK_patch_tuenc_ambigious_char:n + { \UnicodeEncodingName } + \__xeCJK_patch_tuenc_accent: + \__xeCJK_patch_tuenc_composite: + } } -\__xeCJK_after_end_preamble:n { \l__xeCJK_patch_Bxii_tl } -\tl_new:N \l__xeCJK_patch_Bxii_tl -\cs_new_protected_nopar:Npn \__xeCJK_patch_Bxii:nN #1#2 +\cs_new_protected_nopar:Npn \__xeCJK_patch_xunicode_ambigious_char: { - \tl_put_right:Nx \l__xeCJK_patch_Bxii_tl - { \__xeCJK_patch_Bxii:n { #1 \token_to_str:N #2 } } + \RequirePackage { xunicode-addon } + \prop_map_inline:Nn \c__xeCJK_ambigious_char_prop + { + \tl_map_inline:nn { ##2 } + { + \xunadd_set_begin_hook:nn { ####1 } + { \__xeCJK_inactive_group_begin: } + \xunadd_set_end_hook:nn { ####1 } + { \__xeCJK_inactive_group_end: } + } + } + \xunadd_append_begin_hook:n { \xeCJK_make_boundary: } } -\group_begin: -\cs_set:Npn \__xeCJK_tmp:w #1 +\cs_new_protected_nopar:Npn \__xeCJK_patch_tuenc_ambigious_char:n #1 { - \group_end: - \cs_new_protected_nopar:Npn \__xeCJK_patch_Bxii:nNN ##1##2##3 + \prop_map_inline:Nn \c__xeCJK_ambigious_char_prop { - \tl_put_right:Nx \l__xeCJK_patch_Bxii_tl + \tl_map_inline:nn { ##2 } { - \__xeCJK_patch_Bxii:Nnn - #1 { ##1 \token_to_str:N ##2 } { \token_to_str:N ##3 } + \cs_if_exist:NF ####1 + { \DeclareTextSymbol ####1 {#1} { ##1 } } + \__xeCJK_patch_ambigious_char:nN {#1} ####1 } } } -\use:n +\cs_new_protected_nopar:Npn \__xeCJK_patch_ambigious_char:nN #1#2 { - \char_set_catcode_other:N \\ - \__xeCJK_tmp:w + \exp_args:Nx \__xeCJK_patch_ambigious_char:n + { #1 \token_to_str:N #2 } } - { \ } -\cs_new_protected_nopar:Npn \__xeCJK_patch_Bxii:n #1 - { \cs_if_free:cF {#1} { \cs_gset_eq:cN {#1} \__xeCJK_Default_Bxii: } } -\cs_new_protected_nopar:Npn \__xeCJK_patch_Bxii:Nnn #1#2#3 - { \cs_if_free:cF {#2} { \cs_gset_eq:cN { #1#2 - #3 } \__xeCJK_Default_Bxii: } } -\group_begin: -\char_set_catcode_other:n { 183 } -\cs_new_protected_nopar:Npn \__xeCJK_Default_Bxii: +\cs_new_protected_nopar:Npx \__xeCJK_patch_ambigious_char:nNn #1#2#3 + { + \exp_args:Nx \exp_not:N \__xeCJK_patch_ambigious_char:n + { + \c_backslash_str #1 + \exp_not:N \token_to_str:N #2 - + \exp_not:N \token_to_str:N #3 + } + } +\cs_new_protected_nopar:Npn \__xeCJK_patch_ambigious_char:n #1 + { + \cs_if_free:cF {#1} + { \exp_args:Nc \__xeCJK_patch_ambigious_char:N {#1} } + } +\cs_new_protected_nopar:Npn \__xeCJK_patch_ambigious_char:N #1 + { + \cs_set_protected_nopar:Npx #1 + { + \__xeCJK_ambigious_char:n + { \token_if_chardef:NTF #1 { \utex_char:D } { \exp_not:o } #1 } + } + } +\cs_new_protected_nopar:Npn \__xeCJK_ambigious_char:n #1 { \int_compare:nNnTF \xetex_interchartokenstate:D > \c_zero - { \__xeCJK_group_begin: \makexeCJKinactive ^^b7 \__xeCJK_group_end: } - { ^^b7 } + { \__xeCJK_inactive_group_begin: #1 \__xeCJK_inactive_group_end: } + {#1} + } +\cs_new_protected_nopar:Npn \xeCJK@composite@patch + { + \str_if_eq_x:nnT { \f@encoding } { \UnicodeEncodingName } + { \xeCJK_make_boundary: } + } +\cs_new_protected_nopar:Npn \__xeCJK_patch_tuenc_composite: + { + \cs_set_nopar:Npn \@text@composite@x ##1 + { + \xeCJK@composite@patch + \ifx ##1 \relax + \expandafter \@secondoftwo + \else + \expandafter \@firstoftwo + \fi + ##1 + } + } +\group_begin: +\char_set_catcode_other:n { "A0 } +\cs_new_protected_nopar:Npn \__xeCJK_patch_tuenc_accent: + { + \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: + } } \group_end: -\clist_map_inline:nn +\prop_const_from_keyval:Nn \c__xeCJK_middle_dot_prop { - { T3 } \textvibyy , - { T2A } \cyrchvcrs , - { T2B } \cyrchldsc , - { T2C } \cyrabhha , - { X2 } \cyrchldsc , - { TS1 } \textperiodcentered , - { LY1 } \textperiodcentered + T2A = \cyrchvcrs , + T2B = \cyrchldsc , + T2C = \cyrabhha , + X2 = \cyrchldsc , + TS1 = \textperiodcentered , + LY1 = \textperiodcentered , + T1 = \r u , + T4 = \B t , + T5 = \` \ecircumflex } - { \__xeCJK_patch_Bxii:nN #1 } -\clist_map_inline:nn +\__xeCJK_after_end_preamble:n { \__xeCJK_patch_middle_dot: } +\cs_new_protected_nopar:Npn \__xeCJK_patch_middle_dot: { - { T1 } \r u , - { T4 } \B t , - { T5 } \` \ecircumflex , - { LGR } \accpsilivaria w + \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_Bxii:nNN #1 } -\tl_put_right:Nx \l__xeCJK_patch_Bxii_tl +\cs_new_protected_nopar:Npn \__xeCJK_patch_middle_dot:nw #1#2#3 \q_stop { - \__xeCJK_patch_Bxii:n - { \token_to_str:N \T 5 \token_to_str:N \` - \token_to_str:N \^ - e } + \tl_if_empty:nTF {#3} + { \__xeCJK_patch_ambigious_char:nN {#1} #2 } + { \__xeCJK_patch_ambigious_char:nNn {#1} #2 {#3} } } \__xeCJK_after_end_preamble:n { @@ -4793,15 +4883,15 @@ } \__xeCJK_after_end_preamble:n { - \xeCJK_if_package_loaded:nT { hyperref } + \cs_if_exist_use:NT \pdfstringdefDisableCommands { - \pdfstringdefDisableCommands - { - \__xeCJK_gobble_CJKfamily: - \xeCJK_cs_clear:N \makexeCJKinactive - \xeCJK_cs_clear:N \__xeCJK_group_begin: - \xeCJK_cs_clear:N \__xeCJK_group_end: - } + { + \__xeCJK_gobble_CJKfamily: + \xeCJK_cs_clear:N \__xeCJK_inactive_group_begin: + \xeCJK_cs_clear:N \__xeCJK_inactive_group_end: + \xeCJK_cs_clear:N \makexeCJKinactive + \xeCJK_cs_clear:N \xeCJK@composite@patch + } } } \__xeCJK_after_end_preamble:n @@ -4848,39 +4938,20 @@ \str_if_eq:nnT {#1} { \CJK@UnicodeEnc } { \group_begin: - \cs_set_eq:NN \Unicode \__xeCJK_calc_unicode:nn - \cs_set_eq:NN \def \xeCJK_char_from_charcode:Nn + \cs_set_eq:NN \Unicode \xeCJK_unicode_char:nn + \cs_set_eq:NN \def \xdef #2 \group_end: - \tl_gset:Nn \CJK@tenthousand { ^^^^4e07 } - \tl_gset:Nn \CJK@hundredmillion { ^^^^4ebf } + \str_gset:Nx \CJK@tenthousand { ^^^^4e07 } + \str_gset:Nx \CJK@hundredmillion { ^^^^4ebf } \tl_if_exist:NF \CJK@UnicodeEnc { \tl_const:Nn \CJK@UnicodeEnc { UTF8 } } \cs_if_exist:NF \Unicode { \cs_new_eq:NN \Unicode \xeCJK_unicode_char:nn } } } -\cs_if_exist:NTF \utex_charcat:D - { - \cs_new_protected_nopar:Npn \xeCJK_char_from_charcode:Nn #1#2 - { \tl_const:Nx #1 { \char_generate:nn {#2} { \c_eleven } } } - } - { - \cs_new_protected_nopar:Npn \xeCJK_char_from_charcode:Nn #1#2 - { - \group_begin: - \char_set_lccode:nn { "4E00 } {#2} - \tex_lowercase:D - { - \group_end: - \tl_const:Nn #1 { ^^^^4e00 } - } - } - } -\cs_new_nopar:Npn \__xeCJK_calc_unicode:nn #1#2 - { (#1) * \c_two_hundred_fifty_six + (#2) } -\cs_new_protected_nopar:Npn \xeCJK_unicode_char:nn #1#2 - { \tex_char:D \etex_numexpr:D \__xeCJK_calc_unicode:nn {#1} {#2} \scan_stop: } +\cs_new_nopar:Npn \xeCJK_unicode_char:nn #1#2 + { \utex_char:D \etex_numexpr:D (#1) * 256 + (#2) \scan_stop: } \bool_if:NT \g__xeCJK_config_bool { \ExplSyntaxOff diff --git a/Master/texmf-dist/tex/xelatex/xecjk/xeCJKfntef.sty b/Master/texmf-dist/tex/xelatex/xecjk/xeCJKfntef.sty index 8949d43ddd3..5495f6ba4ce 100644 --- a/Master/texmf-dist/tex/xelatex/xecjk/xeCJKfntef.sty +++ b/Master/texmf-dist/tex/xelatex/xecjk/xeCJKfntef.sty @@ -29,10 +29,10 @@ %% \NeedsTeXFormat{LaTeX2e} \RequirePackage{expl3} -\GetIdInfo$Id: xeCJK.dtx 25e85c2 2018-02-27 02:44:39 +0800 Qing Lee <sobenlee@gmail.com> $ +\GetIdInfo$Id: xeCJK.dtx 2041e49 2018-04-07 17:31:56 +0800 Qing Lee <sobenlee@gmail.com> $ {xeCJK font effect} \ProvidesExplPackage{xeCJKfntef} - {\ExplFileDate}{3.6.1}{\ExplFileDescription} + {\ExplFileDate}{3.7.0}{\ExplFileDescription} \PassOptionsToPackage { normalem } { ulem } \DeclareOption* { \PassOptionsToPackage { \CurrentOption } { ulem } } \ProcessOptions \scan_stop: diff --git a/Master/texmf-dist/tex/xelatex/xecjk/xunicode-addon.sty b/Master/texmf-dist/tex/xelatex/xecjk/xunicode-addon.sty index e0c95aaa605..44f922d7dbd 100644 --- a/Master/texmf-dist/tex/xelatex/xecjk/xunicode-addon.sty +++ b/Master/texmf-dist/tex/xelatex/xecjk/xunicode-addon.sty @@ -29,10 +29,10 @@ %% \NeedsTeXFormat{LaTeX2e} \RequirePackage{expl3} -\GetIdInfo$Id: xeCJK.dtx 25e85c2 2018-02-27 02:44:39 +0800 Qing Lee <sobenlee@gmail.com> $ +\GetIdInfo$Id: xeCJK.dtx 2041e49 2018-04-07 17:31:56 +0800 Qing Lee <sobenlee@gmail.com> $ {addon file for xunicode} \ProvidesExplPackage{xunicode-addon} - {\ExplFileDate}{3.6.1}{\ExplFileDescription} + {\ExplFileDate}{3.7.0}{\ExplFileDescription} \bool_lazy_or:nnF { \sys_if_engine_xetex_p: } { \sys_if_engine_luatex_p: } @@ -56,8 +56,8 @@ { \clist_get:NNF \g__xunadd_encname_clist \UTFencname { - \file_if_exist:nTF { tuenc.def } - { \tl_set:Nn \UTFencname { TU } } + \cs_if_exist:NTF \UnicodeEncodingName + { \tl_set:Nx \UTFencname { \UnicodeEncodingName } } { \sys_if_engine_xetex:TF { \tl_set:Nn \UTFencname { EU1 } } @@ -198,8 +198,8 @@ } \RenewDocumentCommand \DeclareUTFcharacter { O { \UTFencname } m m } { - \str_if_eq:nnTF {#3} { \hbar } - { \__xunadd_restore_hbar: } + \cs_if_exist_use:cF + { __xunadd_restore_ \tl_to_str:n {#3} : } { \__xunadd_if_csname:nTF {#3} { \__xunadd_declare_character:Nnn #3 } @@ -207,27 +207,31 @@ {#1} {#2} } } -\cs_new_protected_nopar:Npn \__xunadd_restore_hbar: +\cs_new_protected_nopar:cpn + { __xunadd_restore_ \tl_to_str:n { \hbar } : } + { \__xunadd_restore_cmd:N \hbar } +\cs_new_protected_nopar:cpn + { __xunadd_restore_ \tl_to_str:n { \nobreakspace } : } + { \__xunadd_restore_cmd:N \nobreakspace } +\cs_new_protected_nopar:Npn \__xunadd_restore_cmd:N #1 + { \__xunadd_restore_cmd:Nx #1 { ? - \token_to_str:N #1 } } +\cs_new_protected_nopar:Npn \__xunadd_restore_cmd:Nn #1#2 { - \cs_if_free:cF { ? - \token_to_str:N \hbar } - { \__xunadd_restore_hbar:c { ? - \token_to_str:N \hbar } } + \cs_if_free:cF {#2} + { \__xunadd_restore_cmd:Nc #1 {#2} } } -\cs_new_protected_nopar:Npn \__xunadd_restore_hbar:N #1 +\cs_new_protected_nopar:Npn \__xunadd_restore_cmd:NN #1#2 { - \cs_gset_eq:NN \hbar #1 - \cs_undefine:N #1 + \cs_gset_eq:NN #1 #2 + \cs_undefine:N #2 } -\cs_generate_variant:Nn \__xunadd_restore_hbar:N { c } +\cs_generate_variant:Nn \__xunadd_restore_cmd:Nn { Nx } +\cs_generate_variant:Nn \__xunadd_restore_cmd:NN { Nc } \cs_new_protected:Npn \__xunadd_declare_character:Nnn #1#2#3 { \__xunadd_provide_text_command_default:N #1 - \group_begin: - \char_set_lccode:nn { `0 } { \__xunadd_check_slot:n {#3} } - \tex_lowercase:D - { - \group_end: - \__xunadd_declare_character:NNxn 0 - } + \exp_after:wN \__xunadd_declare_character:NNxn + \utex_char:D \__xunadd_check_slot:n {#3} \exp_stop_f: #1 { \token_to_str:N #1 } {#2} } \cs_generate_variant:Nn \__xunadd_declare_character:Nnn { c } @@ -341,14 +345,9 @@ \cs_generate_variant:Nn \__xunadd_text_composite:Nnn { c } \cs_new_protected:Npn \__xunadd_declare_encoded:NNnnn #1#2#3#4#5 { - \group_begin: - \char_set_lccode:nn { `4 } { \__xunadd_check_slot:n {#4} } - \char_set_lccode:nn { `5 } { \__xunadd_check_slot:n {#5} } - \tex_lowercase:D - { - \group_end: - \__xunadd_declare_encoded:NNNNxx 4 5 - } + \exp_after:wN \__xunadd_declare_encoded:NNNNxx + \utex_char:D \__xunadd_check_slot:n {#4} \exp_after:wN \exp_stop_f: + \utex_char:D \__xunadd_check_slot:n {#5} \exp_stop_f: #1 #2 { \token_to_str:N #2 } {#3} } \cs_new_protected:Npn \__xunadd_declare_encoded:NNNNnn #1#2#3#4#5#6 @@ -529,23 +528,34 @@ \tl_if_blank:nTF {#2} { \IfBooleanTF {#1} - { \tl_set:Nn \l__xunadd_begin_hook_tl {#3} } - { \tl_put_right:Nn \l__xunadd_begin_hook_tl {#3} } + { \xunadd_set_begin_hook:n } + { \xunadd_append_begin_hook:n } } - { \__xunadd_set_cmd_hook:nnn { begin } {#2} {#3} } + { \xunadd_set_begin_hook:nn {#2} } } \NewDocumentCommand \AtEndUTFCommand { s O { } +m } { \tl_if_blank:nTF {#2} { \IfBooleanTF {#1} - { \tl_set:Nn \l__xunadd_end_hook_tl {#3} } - { \tl_put_right:Nn \l__xunadd_end_hook_tl {#3} } + { \xunadd_set_end_hook:n } + { \xunadd_append_end_hook:n } } - { \__xunadd_set_cmd_hook:nnn { end } {#2} {#3} } + { \xunadd_set_begin_hook:nn {#2} } + {#3} } -\tl_new:N \l__xunadd_begin_hook_tl -\tl_new:N \l__xunadd_end_hook_tl +\cs_new_protected_nopar:Npn \xunadd_set_begin_hook:n + { \tl_set:Nn \l__xunadd_begin_hook_tl } +\cs_new_protected_nopar:Npn \xunadd_append_begin_hook:n + { \tl_put_right:Nn \l__xunadd_begin_hook_tl } +\cs_new_protected_nopar:Npn \xunadd_set_end_hook:n + { \tl_set:Nn \l__xunadd_end_hook_tl } +\cs_new_protected_nopar:Npn \xunadd_append_end_hook:n + { \tl_put_right:Nn \l__xunadd_end_hook_tl } +\cs_new_protected_nopar:Npn \xunadd_set_begin_hook:nn + { \__xunadd_set_cmd_hook:nnn { begin } } +\cs_new_protected_nopar:Npn \xunadd_set_end_hook:nn + { \__xunadd_set_cmd_hook:nnn { end } } \cs_new_protected:Npn \__xunadd_set_cmd_hook:nnn #1#2#3 { \cs_set_protected:cpn @@ -560,6 +570,8 @@ { \use:c { __xunadd_#3_csname:n } { \token_to_str:N #1 - \tl_to_str:n {#2} } } \cs_new_nopar:Npn \__xunadd_begin_csname:n #1 { __xunadd_begin_#1_hook:n } \cs_new_nopar:Npn \__xunadd_end_csname:n #1 { __xunadd_end_#1_hook:n } +\tl_new:N \l__xunadd_begin_hook_tl +\tl_new:N \l__xunadd_end_hook_tl \cs_new_protected:Npn \__xunadd_begin_hook:nn #1#2 { \tl_use:N \l__xunadd_begin_hook_tl diff --git a/Master/texmf-dist/tex/xelatex/xecjk/xunicode-extra.def b/Master/texmf-dist/tex/xelatex/xecjk/xunicode-extra.def index 1195a70754e..c4505af2773 100644 --- a/Master/texmf-dist/tex/xelatex/xecjk/xunicode-extra.def +++ b/Master/texmf-dist/tex/xelatex/xecjk/xunicode-extra.def @@ -27,10 +27,12 @@ %% %% ---------------------------------------------------------------------- %% -\GetIdInfo$Id: xeCJK.dtx 25e85c2 2018-02-27 02:44:39 +0800 Qing Lee <sobenlee@gmail.com> $ +\GetIdInfo$Id: xeCJK.dtx 2041e49 2018-04-07 17:31:56 +0800 Qing Lee <sobenlee@gmail.com> $ {extra definition for xunicode} \ProvidesExplFile{xunicode-extra.def} - {\ExplFileDate}{3.6.1}{\ExplFileDescription} + {\ExplFileDate}{3.7.0}{\ExplFileDescription} +\DeclareUTFSymbol\texthyphenationpoint{"2027} +\DeclareUTFSymbol\texttwoemdash{"2E3A} \DeclareUTFComposite\textsuperscript \DeclareUTFComposite\textsubscript \DeclareUTFEncodedAccent\textsbleftarrow{"20EE}{"20FF} |