texlive[50852] Master/texmf-dist: xecjk (7apr19)

commits+karl at tug.org commits+karl at tug.org
Sun Apr 7 23:28:36 CEST 2019


Revision: 50852
          http://tug.org/svn/texlive?view=revision&revision=50852
Author:   karl
Date:     2019-04-07 23:28:36 +0200 (Sun, 07 Apr 2019)
Log Message:
-----------
xecjk (7apr19)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/xelatex/xecjk/README.md
    trunk/Master/texmf-dist/doc/xelatex/xecjk/xeCJK.pdf
    trunk/Master/texmf-dist/doc/xelatex/xecjk/xunicode-symbols.pdf
    trunk/Master/texmf-dist/doc/xelatex/xecjk/xunicode-symbols.tex
    trunk/Master/texmf-dist/fonts/misc/xetex/fontmapping/xecjk/han-simp.map
    trunk/Master/texmf-dist/fonts/misc/xetex/fontmapping/xecjk/han-simp.tec
    trunk/Master/texmf-dist/fonts/misc/xetex/fontmapping/xecjk/han-trad.map
    trunk/Master/texmf-dist/fonts/misc/xetex/fontmapping/xecjk/han-trad.tec
    trunk/Master/texmf-dist/source/xelatex/xecjk/xeCJK.dtx
    trunk/Master/texmf-dist/source/xelatex/xecjk/xeCJK.ins
    trunk/Master/texmf-dist/tex/xelatex/xecjk/xeCJK-listings.sty
    trunk/Master/texmf-dist/tex/xelatex/xecjk/xeCJK.cfg
    trunk/Master/texmf-dist/tex/xelatex/xecjk/xeCJK.sty
    trunk/Master/texmf-dist/tex/xelatex/xecjk/xeCJKfntef.sty
    trunk/Master/texmf-dist/tex/xelatex/xecjk/xunicode-addon.sty
    trunk/Master/texmf-dist/tex/xelatex/xecjk/xunicode-extra.def

Modified: trunk/Master/texmf-dist/doc/xelatex/xecjk/README.md
===================================================================
--- trunk/Master/texmf-dist/doc/xelatex/xecjk/README.md	2019-04-07 21:28:18 UTC (rev 50851)
+++ trunk/Master/texmf-dist/doc/xelatex/xecjk/README.md	2019-04-07 21:28:36 UTC (rev 50852)
@@ -20,8 +20,8 @@
 ---------------------
 
     Copyright (C) 2007--2010 by Wenchang Sun <sunwch at nankai.edu.cn>
-    Copyright (C) 2009--2018 by Leo Liu <leoliu.pku at gmail.com>
-    Copyright (C) 2012--2018 by Qing Lee <sobenlee at gmail.com>
+    Copyright (C) 2009--2019 by Leo Liu <leoliu.pku at gmail.com>
+    Copyright (C) 2012--2019 by Qing Lee <sobenlee at gmail.com>
     ----------------------------------------------------------------------
 
     This work may be distributed and/or modified under the

Modified: trunk/Master/texmf-dist/doc/xelatex/xecjk/xeCJK.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/xelatex/xecjk/xunicode-symbols.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/xelatex/xecjk/xunicode-symbols.tex
===================================================================
--- trunk/Master/texmf-dist/doc/xelatex/xecjk/xunicode-symbols.tex	2019-04-07 21:28:18 UTC (rev 50851)
+++ trunk/Master/texmf-dist/doc/xelatex/xecjk/xunicode-symbols.tex	2019-04-07 21:28:36 UTC (rev 50852)
@@ -19,10 +19,10 @@
 \makeatletter
 \ExplSyntaxOn
 \cs_new_protected_nopar:Npx \__xunsym_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__xunsym_command_tl
 ^^@ \int_new:N \l__xunsym_command_int
 ^^@ \iow_new:N \g__xunsym_command_iow
@@ -129,7 +129,7 @@
     \int_gincr:N \g__xunsym_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 }

Modified: trunk/Master/texmf-dist/fonts/misc/xetex/fontmapping/xecjk/han-simp.map
===================================================================
--- trunk/Master/texmf-dist/fonts/misc/xetex/fontmapping/xecjk/han-simp.map	2019-04-07 21:28:18 UTC (rev 50851)
+++ trunk/Master/texmf-dist/fonts/misc/xetex/fontmapping/xecjk/han-simp.map	2019-04-07 21:28:36 UTC (rev 50852)
@@ -2,8 +2,8 @@
 ; from the Unicode Unihan database: <http://www.unicode.org/Public/UNIDATA/Unihan.zip>
 ;
 ; Unihan_Variants.txt
-; Date: 2017-05-14 07:01:48 GMT [JHJ]
-; Unicode version: 10.0.0
+; Date: 2018-11-09 21:36:19 GMT [JHJ]
+; Unicode version: 12.0.0
 ;
 
 LHSName "traditional"
@@ -1125,6 +1125,7 @@
 U+7A60 <> U+79FE
 U+7A61 <> U+7A51
 U+7A62 <> U+79FD
+U+7A68 <> U+2C4FC
 U+7A69 <> U+7A33
 U+7A6B <> U+83B7
 U+7A6D <> U+7A06
@@ -1251,6 +1252,7 @@
 U+7D90 <> U+433C
 U+7D93 <> U+7ECF
 U+7D9C <> U+7EFC
+U+7D9D <> U+2C62D
 U+7D9E <> U+7F0D
 U+7DA0 <> U+7EFF
 U+7DA2 <> U+7EF8
@@ -1757,6 +1759,7 @@
 U+8B4A <> U+2B362
 U+8B4E <> U+8C32
 U+8B4F <> U+8BA5
+U+8B54 <> U+2C925
 U+8B56 <> U+8C2E
 U+8B58 <> U+8BC6
 U+8B59 <> U+8C2F
@@ -2081,6 +2084,7 @@
 U+925E <> U+94BA
 U+9264 <> U+94A9
 U+9266 <> U+94B2
+U+9268 <> U+9FED
 U+926C <> U+94BC
 U+926D <> U+94BD
 U+9276 <> U+94CF
@@ -2269,6 +2273,7 @@
 U+943A <> U+94DB
 U+943F <> U+9571
 U+9444 <> U+94F8
+U+9448 <> U+9FED
 U+944A <> U+956C
 U+944C <> U+9554
 U+9452 <> U+9274
@@ -2354,6 +2359,7 @@
 U+968E <> U+9636
 U+9695 <> U+9668
 U+969B <> U+9645
+U+96A4 <> U+2CBCE
 U+96A8 <> U+968F
 U+96AA <> U+9669
 U+96B1 <> U+9690
@@ -2741,6 +2747,7 @@
 U+9C6D <> U+9C9A
 U+9C6E <> U+2B688
 U+9C6F <> U+9CE0
+U+9C72 <> U+2B6AD
 U+9C77 <> U+9CC4
 U+9C78 <> U+9C88
 U+9C7A <> U+9CA1
@@ -2811,6 +2818,7 @@
 U+9DAA <> U+4D17
 U+9DAC <> U+9E27
 U+9DAF <> U+83BA
+U+9DB1 <> U+2CE23
 U+9DB2 <> U+9E5F
 U+9DB4 <> U+9E64
 U+9DB9 <> U+9E60
@@ -2959,7 +2967,6 @@
 U+27717 <> U+461E
 U+27735 <> U+464A
 U+2775E <> U+461B
-U+27835 <> U+2C88D
 U+27A59 <> U+4725
 U+27CDF <> U+27CD5
 U+27D73 <> U+478C

Modified: trunk/Master/texmf-dist/fonts/misc/xetex/fontmapping/xecjk/han-simp.tec
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/fonts/misc/xetex/fontmapping/xecjk/han-trad.map
===================================================================
--- trunk/Master/texmf-dist/fonts/misc/xetex/fontmapping/xecjk/han-trad.map	2019-04-07 21:28:18 UTC (rev 50851)
+++ trunk/Master/texmf-dist/fonts/misc/xetex/fontmapping/xecjk/han-trad.map	2019-04-07 21:28:36 UTC (rev 50852)
@@ -2,8 +2,8 @@
 ; from the Unicode Unihan database: <http://www.unicode.org/Public/UNIDATA/Unihan.zip>
 ;
 ; Unihan_Variants.txt
-; Date: 2017-05-14 07:01:48 GMT [JHJ]
-; Unicode version: 10.0.0
+; Date: 2018-11-09 21:36:19 GMT [JHJ]
+; Unicode version: 12.0.0
 ;
 
 LHSName "simplified"
@@ -2688,6 +2688,7 @@
 U+9FCF <> U+4951
 U+9FD3 <> U+9FD2
 U+9FD4 <> U+93B6
+U+9FED <> U+9268
 U+201B2 <> U+5123
 U+201BF <> U+20325
 U+20242 <> U+3493
@@ -3028,9 +3029,14 @@
 U+2B694 <> U+9BB0
 U+2B695 <> U+9C24
 U+2B699 <> U+9BC6
+U+2B6AD <> U+9C72
 U+2B6DB <> U+9CF7
 U+2B6DE <> U+9D03
 U+2B6E2 <> U+9E0B
 U+2B6F6 <> U+9D92
 U+2B6F8 <> U+9D97
-U+2C88D <> U+27835
+U+2C4FC <> U+7A68
+U+2C62D <> U+7D9D
+U+2C925 <> U+8B54
+U+2CBCE <> U+96A4
+U+2CE23 <> U+9DB1

Modified: trunk/Master/texmf-dist/fonts/misc/xetex/fontmapping/xecjk/han-trad.tec
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/source/xelatex/xecjk/xeCJK.dtx
===================================================================
--- trunk/Master/texmf-dist/source/xelatex/xecjk/xeCJK.dtx	2019-04-07 21:28:18 UTC (rev 50851)
+++ trunk/Master/texmf-dist/source/xelatex/xecjk/xeCJK.dtx	2019-04-07 21:28:36 UTC (rev 50852)
@@ -26,8 +26,8 @@
 ---------------------
 
     Copyright (C) 2007--2010 by Wenchang Sun <sunwch at nankai.edu.cn>
-    Copyright (C) 2009--2018 by Leo Liu <leoliu.pku at gmail.com>
-    Copyright (C) 2012--2018 by Qing Lee <sobenlee at gmail.com>
+    Copyright (C) 2009--2019 by Leo Liu <leoliu.pku at gmail.com>
+    Copyright (C) 2012--2019 by Qing Lee <sobenlee at gmail.com>
     ----------------------------------------------------------------------
 
     This work may be distributed and/or modified under the
@@ -92,8 +92,8 @@
 \preamble
 
     Copyright (C) 2007--2010 by Wenchang Sun <sunwch at nankai.edu.cn>
-    Copyright (C) 2009--2018 by Leo Liu <leoliu.pku at gmail.com>
-    Copyright (C) 2012--2018 by Qing Lee <sobenlee at gmail.com>
+    Copyright (C) 2009--2019 by Leo Liu <leoliu.pku at gmail.com>
+    Copyright (C) 2012--2019 by Qing Lee <sobenlee at gmail.com>
 ----------------------------------------------------------------------
 
     This work may be distributed and/or modified under the
@@ -194,7 +194,7 @@
 %<*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 at gmail.com> $
+%<+!driver>\GetIdInfo$Id: xeCJK.dtx 8be031f 2019-04-07 23:30:14 +0800 Qing Lee <sobenlee at gmail.com> $
 %<package>  {Typesetting CJK scripts with XeLaTeX}
 %<config>  {Configuration file for xeCJK package}
 %<fntef>  {xeCJK font effect}
@@ -207,7 +207,7 @@
 %<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 @@
             \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 @@
 % 进行最小化运算(\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 @@
 %     \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 @@
 %   \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 @@
     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 @@
 % \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 @@
 %    \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 @@
 %    \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 @@
 %    \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,7 +1876,7 @@
             \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
@@ -1881,14 +1883,14 @@
                   {
                     \_@@_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 @@
                     \_@@_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 @@
     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 @@
 \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 @@
 %    \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 @@
 % 的显性或隐性记号。
 %    \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 @@
 % \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 @@
 % \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 @@
 \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 @@
     \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 @@
   {
     \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 @@
 \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 @@
 %    \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 @@
 %    \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 @@
     \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 @@
   {
     \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 @@
   { \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 @@
   { \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 @@
 %    \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 @@
         { \@@_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 @@
 \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 @@
             \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 @@
       { 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 @@
 % \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,10 +3529,6 @@
     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: }
       } ,
@@ -3536,10 +3535,6 @@
     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 @@
           {
             \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 @@
   }
 \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 @@
       {
         \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 @@
       {
         \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 @@
   {
     \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 @@
 %    \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 @@
 %
 % \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,8 +4011,16 @@
         \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 }
 %    \end{macrocode}
@@ -4128,7 +4122,7 @@
   {
     \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 @@
 \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 @@
         \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 @@
     \@@_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 @@
 \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 @@
   {
     \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 @@
   {
     \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 @@
     \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 @@
     \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 @@
   }
 \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 @@
     \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 @@
 %    \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 @@
 \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 @@
         \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 @@
 \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 @@
 %    \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 @@
 % \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 @@
 %
 % 定义标点处理模板。
 %    \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 @@
 %    \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 @@
                   {
                     (   \l_@@_tmp_dim
                       - ( \@@_use_punct_dim:nN { dimen } #2 )
-                    ) / \c_two
+                    ) / 2
                   }
                   {
                     \bool_if:NTF \l_@@_optimize_margin_bool
@@ -5624,7 +5618,7 @@
         \@@_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 @@
           { \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 @@
           { \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 @@
       { \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 @@
             \@@_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 @@
 \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 @@
 % 用 \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 @@
 \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 @@
           { \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 @@
             \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 @@
     \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 @@
     \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 @@
 %    \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 @@
       {
         \group_begin:
         \exp_not:n { \cs_set_eq:NN \xeCJK at 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 @@
   }
 \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 @@
   }
 \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 @@
 %
 % \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 @@
       { \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 @@
     \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 @@
   }
 \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 @@
     \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 @@
       }
   }
 \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 @@
     \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 @@
 %    \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 @@
   {
     \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 @@
             \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,7 +7764,7 @@
 \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
@@ -7788,7 +7771,7 @@
         \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 @@
     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 at family \ttdefault
+    `\str_if_eq:eeTF \f at family \ttdefault
       { \token_to_str:N \ttdefault } { \f at family }'.
   }
 \fp_new:N \l_@@_scale_factor_fp
@@ -7841,9 +7824,9 @@
     \xeCJK_glyph_if_exist:NTF { ^^^^2423 }
       { ^^^^2423 }
       {
-        \int_compare:nNnTF { \xetex_fonttype:D \tex_font:D } = \c_zero
+        \int_compare:nNnTF { \tex_XeTeXfonttype:D \tex_font:D } = \c_zero_int
           {
-            \str_if_eq_x:nnTF { \f at family } { \ttdefault }
+            \str_if_eq:eeTF { \f at family } { \ttdefault }
               { \c_catcode_other_space_tl }
               { \textvisiblespace }
           }
@@ -7879,8 +7862,8 @@
   {
     \tl_set:Nx \l_@@_current_coor_tl
       { xeCJK/space/\curr at fontshape/\f at 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,7 +7871,7 @@
     \fontencoding { \g_fontspec_encoding_tl }
     \tl_set:Nx \f at 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
           {
@@ -7895,7 +7878,7 @@
             \dim_eval:n
               {
                 \f at 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 at baselineskip }
@@ -8022,7 +8005,7 @@
     PunctStyle      = quanjiao ,
     NewLineCS       = { \par \[ } ,
     EnvCS           = { \begin \end } ,
-    WidowPenalty    = \c_ten_thousand ,
+    WidowPenalty    = 1000 ,
     NoBreakCS       = { \footnote \footnotemark \nobreak } ,
     KaiMingPunct    = { ^^^^3002 ^^^^ff0e ^^^^ff1f ^^^^ff01 } ,
     LongPunct       = { ^^^^2014 ^^^^2e3a ^^^^2025 ^^^^2026 } ,
@@ -8043,7 +8026,7 @@
 % 执行宏包选项,并载入 \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 @@
   }
 \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 @@
 \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 @@
   }
 \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 at protect #1 \protect #2 } { }
         { \protect #2 } { }
@@ -8308,7 +8293,7 @@
   }
 \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 @@
   }
 \cs_new_protected_nopar:Npn \@@_update_family_aux:
   {
-    \str_case_x:nn { \f at family }
+    \str_case_e:nn { \f at family }
       {
         { \rmdefault }     { \xeCJK_switch_family:x { \CJKrmdefault } }
         { \sfdefault }     { \xeCJK_switch_family:x { \CJKsfdefault } }
@@ -8467,7 +8452,7 @@
 %    \begin{macrocode}
 \cs_new_protected_nopar:Npn \xeCJK at 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 @@
 %    \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 @@
       { \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 @@
 % \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 @@
 \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 @@
       }
     \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
       {
-        \@@_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 {#1} }
+        \cs_set_protected_nopar:Npx #1
+          { \@@_ambiguous_char:n { \tex_Uchar:D #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 at composite@patch
+\cs_new_protected_nopar:Npn \xeCJK_text_composite_patch:
   {
-    \str_if_eq_x:nnT { \f at encoding } { \UnicodeEncodingName }
+    \str_if_eq:eeT { \f at 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 at composite@x ##1
+    \cs_set_nopar:Npn \@text at composite@x
       {
-        \xeCJK at 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 @@
     \cs_set_protected_nopar:Npn \add at 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 @@
     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 @@
 % \end{variable}
 % \end{macro}
 %
+% \begin{macro}{\@@_patch_microtype_get_slot:}
+% 兼容 \pkg{microtype}。
+%    \begin{macrocode}
+\@@_at_end_preamble:n
+  {
+    \cs_if_free:NF \MT at get@slot@
+      { \@@_patch_microtype_get_slot: }
+  }
+\cs_new_protected_nopar:Npn \@@_patch_microtype_get_slot:
+  {
+    \cs_new_eq:NN \xeCJK at original@get at slot \MT at get@slot@
+    \cs_set_eq:NN \MT at get@slot@ \xeCJK at microtype@get at slot
+    \cs_set_eq:NN \MT at warn@unknown at once \use_none:n
+  }
+\cs_new_protected_nopar:Npn \xeCJK at microtype@get at slot
+  {
+    \int_compare:nNnT \MT at char < \c_zero_int
+      { \@@_get_ambiguous_slot: }
+    \xeCJK at original@get at slot
+  }
+\cs_new_protected_nopar:Npn \@@_get_ambiguous_slot:
+  {
+    \exp_args:NNx \prop_get:NnNT \c_@@_ambiguous_slot_prop
+      { \MT at encoding - \tex_the:D \MT at toks } \l_@@_tmp_tl
+      { \cs_set_eq:NN \MT at char \l_@@_tmp_tl }
+  }
+%    \end{macrocode}
+% \end{macro}
+%
 % 简单处理与 \pkg{hyperref} 宏包的兼容问题。
 %    \begin{macrocode}
 \@@_after_end_preamble:n
@@ -8895,8 +8919,8 @@
           \cs_set_eq:NN \def \xdef
           #2
         \group_end:
-        \str_gset:Nx \CJK at tenthousand    { ^^^^4e07 }
-        \str_gset:Nx \CJK at hundredmillion { ^^^^4ebf }
+        \str_gset:Nn \CJK at tenthousand    { ^^^^4e07 }
+        \str_gset:Nn \CJK at hundredmillion { ^^^^4ebf }
         \tl_if_exist:NF \CJK at UnicodeEnc
           { \tl_const:Nn \CJK at UnicodeEnc { UTF8 } }
         \cs_if_exist:NF \Unicode
@@ -8904,7 +8928,7 @@
       }
   }
 \cs_new_nopar:Npn \xeCJK_unicode_char:nn #1#2
-  { \utex_char:D \etex_numexpr:D (#1) * 256 + (#2) \scan_stop: }
+  { \tex_Uchar:D \tex_numexpr:D (#1) * 256 + (#2) \scan_stop: }
 %    \end{macrocode}
 % \end{macro}
 %
@@ -8944,7 +8968,6 @@
 %    \begin{macrocode}
 \RequirePackage { xeCJK }
 \RequirePackage { ulem }
-\RequirePackage { environ }
 %    \end{macrocode}
 %
 % 虽然我们不再依赖 \pkg{CJKfntef},但基于历史原因,我们仍然载入它。
@@ -9138,12 +9161,11 @@
     \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 @@
 \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 @@
   {
     \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 @@
         \tl_if_empty:NTF \l_@@_group_tag_tl
           { \UL at stop \@@_ulem_hskip:n {#1} \UL at 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 at stop \@@_ulem_hskip:n {#1} \UL at start }
               { \skip_horizontal:n {#1} }
           }
@@ -9717,8 +9739,8 @@
 \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 at skip \l_@@_ccglue_skip \UL at leaders } }
@@ -10201,7 +10223,7 @@
             \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 @@
 %    \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,7 +10287,7 @@
     \endminipage
     \ignorespacesafterend
   }
-\NewEnviron { CJKfilltwosides* } [ 2 ] [ c ]
+\DeclareDocumentEnvironment { CJKfilltwosides* } { O { c } m +b }
   {
     \mode_leave_vertical:
     \cs_set_eq:NN \CJKglue \xeCJK_fntef_hfilll:
@@ -10270,32 +10294,20 @@
     \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 @@
           }
       }
     \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 @@
 \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 @@
 %    \begin{macrocode}
 \cs_new_protected_nopar:Npn \@@_listings_append:nN #1#2
   {
-    \int_add:Nn \lst at length { #1 - \c_one }
+    \int_add:Nn \lst at length { #1 - 1 }
     \lst at Append #2
   }
 %    \end{macrocode}
@@ -10567,7 +10579,7 @@
     \lst at whitespacefalse
     \bool_if:NTF \l_@@_listings_letter_bool
       {
-        \int_compare:nNnF \l_@@_listings_flag_int = \c_two { \lst at Output }
+        \int_compare:nNnF \l_@@_listings_flag_int = 2 { \lst at Output }
         \lst at lettertrue
       }
       {
@@ -10574,7 +10586,7 @@
         \lst at ifletter \lst at Output \else: \lst at OutputOther \lst at 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 @@
     \lst at 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 at Output } }
               { \lst at Output }
           }
@@ -10594,7 +10606,7 @@
         \lst at ifletter \lst at Output \else: \lst at OutputOther \lst at 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 @@
     \lst at 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 at Output } }
         \lst at lettertrue
       }
@@ -10610,7 +10622,7 @@
         \lst at ifletter \lst at Output \else: \lst at OutputOther \lst at 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 @@
 \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 at InlineGJ \@@_listings_inline_group:w
 \cs_new_protected:Npn \@@_listings_inline_group:n #1
@@ -10959,7 +10971,7 @@
 %    \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 @@
 % \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 @@
   {
     \@@_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 @@
     \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 @@
 % \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 @@
 % 设置在符号命令前后使用的钩子,可选参数用于指定单个符号命名。可以用 |#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 @@
   }
 \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 @@
 %    \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 at microtype@is at charx}
+% \pkg{microtype} 宏包中使用的函数,我们通过对 \tn{MT at is@charx} 打补丁来实现功能。
+%    \begin{macrocode}
+\cs_new_protected:Npn \xunadd at microtype@is at charx #1 \relax
+  {
+    \use:x
+      { \xunadd_get_slot:nn { \MT at encoding } { \tex_the:D \MT at toks } }
+    \int_compare:nNnTF \l_xunadd_slot_int < \c_zero_int
+      { \xunadd at original@is at charx #1 \relax }
+      {
+        \cs_set_nopar:Npx \MT at char@ { \int_use:N \l_xunadd_slot_int }
+        \bool_if:NT \l_xunadd_rest_bool { \MT at norestfalse }
+      }
+  }
+\AtBeginDocument
+  {
+    \cs_if_free:NF \MT at is@charx
+      {
+        \cs_new_eq:NN \xunadd at original@is at charx \MT at is@charx
+        \cs_set_eq:NN \MT at is@charx \xunadd at microtype@is at charx
+        \cs_set_eq:NN \MT at warn@unknown at once \use_none:n
+      }
+  }
+%    \end{macrocode}
+% \end{macro}
+%
 % \changes{v3.2.8}{2013/12/05}{启用 \pkg{xunicode} 中的带圈数字和字母设置。}
 %
 %    \begin{macrocode}
@@ -13861,10 +13955,10 @@
 \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_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 }

Modified: trunk/Master/texmf-dist/source/xelatex/xecjk/xeCJK.ins
===================================================================
--- trunk/Master/texmf-dist/source/xelatex/xecjk/xeCJK.ins	2019-04-07 21:28:18 UTC (rev 50851)
+++ trunk/Master/texmf-dist/source/xelatex/xecjk/xeCJK.ins	2019-04-07 21:28:36 UTC (rev 50852)
@@ -7,8 +7,8 @@
 %% xeCJK.dtx  (with options: `install')
 %% 
 %%     Copyright (C) 2007--2010 by Wenchang Sun <sunwch at nankai.edu.cn>
-%%     Copyright (C) 2009--2018 by Leo Liu <leoliu.pku at gmail.com>
-%%     Copyright (C) 2012--2018 by Qing Lee <sobenlee at gmail.com>
+%%     Copyright (C) 2009--2019 by Leo Liu <leoliu.pku at gmail.com>
+%%     Copyright (C) 2012--2019 by Qing Lee <sobenlee at 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 at nankai.edu.cn>
-    Copyright (C) 2009--2018 by Leo Liu <leoliu.pku at gmail.com>
-    Copyright (C) 2012--2018 by Qing Lee <sobenlee at gmail.com>
+    Copyright (C) 2009--2019 by Leo Liu <leoliu.pku at gmail.com>
+    Copyright (C) 2012--2019 by Qing Lee <sobenlee at gmail.com>
 ----------------------------------------------------------------------
 
     This work may be distributed and/or modified under the

Modified: trunk/Master/texmf-dist/tex/xelatex/xecjk/xeCJK-listings.sty
===================================================================
--- trunk/Master/texmf-dist/tex/xelatex/xecjk/xeCJK-listings.sty	2019-04-07 21:28:18 UTC (rev 50851)
+++ trunk/Master/texmf-dist/tex/xelatex/xecjk/xeCJK-listings.sty	2019-04-07 21:28:36 UTC (rev 50852)
@@ -7,8 +7,8 @@
 %% xeCJK.dtx  (with options: `listings')
 %% 
 %%     Copyright (C) 2007--2010 by Wenchang Sun <sunwch at nankai.edu.cn>
-%%     Copyright (C) 2009--2018 by Leo Liu <leoliu.pku at gmail.com>
-%%     Copyright (C) 2012--2018 by Qing Lee <sobenlee at gmail.com>
+%%     Copyright (C) 2009--2019 by Leo Liu <leoliu.pku at gmail.com>
+%%     Copyright (C) 2012--2019 by Qing Lee <sobenlee at gmail.com>
 %% ----------------------------------------------------------------------
 %% 
 %%     This work may be distributed and/or modified under the
@@ -29,10 +29,10 @@
 %% 
 \NeedsTeXFormat{LaTeX2e}
 \RequirePackage{expl3}
-\GetIdInfo$Id: xeCJK.dtx b604170 2018-04-30 10:29:28 +0800 Liu Haiyang <leoliu.pku at gmail.com> $
+\GetIdInfo$Id: xeCJK.dtx 8be031f 2019-04-07 23:30:14 +0800 Qing Lee <sobenlee at gmail.com> $
   {xeCJK patch file for listings}
 \ProvidesExplPackage{xeCJK-listings}
-  {\ExplFileDate}{3.7.1}{\ExplFileDescription}
+  {\ExplFileDate}{3.7.2}{\ExplFileDescription}
 \DeclareOption* { \PassOptionsToPackage { \CurrentOption } { xeCJK } }
 \ProcessOptions \scan_stop:
 \RequirePackage { xeCJK }
@@ -77,7 +77,7 @@
           }
       }
     \xeCJK_inter_class_toks:nnn { Boundary } { CM }
-      { \__xeCJK_listings_process_CM:nN { \c_zero } }
+      { \__xeCJK_listings_process_CM:nN { 0 } }
     \__xeCJK_listings_CJK_toks_hook:
   }
 \cs_new_protected_nopar:Npn \__xeCJK_backup_inter_class_toks:n #1
@@ -98,33 +98,33 @@
 \cs_new_protected_nopar:Npn \__xeCJK_listings_CJK_toks_hook:
   {
     \xeCJK_inter_class_toks:nnn { Boundary } { CJK }
-      { \__xeCJK_listings_process_CJK:nN { \c_two } }
+      { \__xeCJK_listings_process_CJK:nN { 2 } }
     \xeCJK_inter_class_toks:nnn { Boundary } { FullLeft }
-      { \__xeCJK_listings_process_CJK:nN { \c_two } }
+      { \__xeCJK_listings_process_CJK:nN { 2 } }
     \xeCJK_inter_class_toks:nnn { Boundary } { FullRight }
-      { \__xeCJK_listings_process_CJK:nN { \c_two } }
+      { \__xeCJK_listings_process_CJK:nN { 2 } }
     \xeCJK_inter_class_toks:nnn { Boundary } { HangulJamo }
-      { \__xeCJK_listings_process_CJK:nN { \c_two } }
+      { \__xeCJK_listings_process_CJK:nN { 2 } }
     \seq_map_inline:Nn \g__xeCJK_CJK_sub_class_seq
       {
         \xeCJK_inter_class_toks:nnn { Boundary } { CJK/##1 }
-          { \__xeCJK_listings_process_CJK:nN { \c_two } }
+          { \__xeCJK_listings_process_CJK:nN { 2 } }
       }
   }
 \cs_new_protected_nopar:Npn \__xeCJK_listings_breaklines_toks:
   {
     \xeCJK_inter_class_toks:nnn { Boundary } { CJK }
-      { \__xeCJK_listings_process_breaklines_CJK:nN { \c_two } }
+      { \__xeCJK_listings_process_breaklines_CJK:nN { 2 } }
     \xeCJK_inter_class_toks:nnn { Boundary } { HangulJamo }
-      { \__xeCJK_listings_process_breaklines_CJK:nN { \c_two } }
+      { \__xeCJK_listings_process_breaklines_CJK:nN { 2 } }
     \xeCJK_inter_class_toks:nnn { Boundary } { FullLeft }
-      { \__xeCJK_listings_process_FullLeft:nN { \c_two } }
+      { \__xeCJK_listings_process_FullLeft:nN { 2 } }
     \xeCJK_inter_class_toks:nnn { Boundary } { FullRight }
-      { \__xeCJK_listings_process_FullRight:nN { \c_two } }
+      { \__xeCJK_listings_process_FullRight:nN { 2 } }
     \seq_map_inline:Nn \g__xeCJK_CJK_sub_class_seq
       {
         \xeCJK_inter_class_toks:nnn { Boundary } { CJK/##1 }
-          { \__xeCJK_listings_process_breaklines_CJK:nN { \c_two } }
+          { \__xeCJK_listings_process_breaklines_CJK:nN { 2 } }
       }
   }
 \cs_new_protected_nopar:Npn \__xeCJK_listings_process_Default:nN #1#2
@@ -154,7 +154,7 @@
   }
 \cs_new_protected_nopar:Npn \__xeCJK_listings_append:nN #1#2
   {
-    \int_add:Nn \lst at length { #1 - \c_one }
+    \int_add:Nn \lst at length { #1 - 1 }
     \lst at Append #2
   }
 \cs_new_protected_nopar:Npn \__xeCJK_listings_process_letter:nN
@@ -186,7 +186,7 @@
     \lst at whitespacefalse
     \bool_if:NTF \l__xeCJK_listings_letter_bool
       {
-        \int_compare:nNnF \l__xeCJK_listings_flag_int = \c_two { \lst at Output }
+        \int_compare:nNnF \l__xeCJK_listings_flag_int = 2 { \lst at Output }
         \lst at lettertrue
       }
       {
@@ -193,7 +193,7 @@
         \lst at ifletter \lst at Output \else: \lst at OutputOther \lst at lettertrue \fi:
         \bool_set_true:N \l__xeCJK_listings_letter_bool
       }
-    \int_set_eq:NN \l__xeCJK_listings_flag_int \c_one
+    \int_set_eq:NN \l__xeCJK_listings_flag_int \c_one_int
     \__xeCJK_listings_append:nN
   }
 \cs_new_protected_nopar:Npn \__xeCJK_listings_process_FullLeft:nN #1#2
@@ -201,9 +201,9 @@
     \lst at whitespacefalse
     \bool_if:NTF \l__xeCJK_listings_letter_bool
       {
-        \int_compare:nNnF \l__xeCJK_listings_flag_int = \c_two
+        \int_compare:nNnF \l__xeCJK_listings_flag_int = 2
           {
-            \int_compare:nNnTF \l__xeCJK_listings_flag_int = \c_three
+            \int_compare:nNnTF \l__xeCJK_listings_flag_int = 3
               { \bool_if:NT \l__xeCJK_punct_breakable_bool { \lst at Output } }
               { \lst at Output }
           }
@@ -213,7 +213,7 @@
         \lst at ifletter \lst at Output \else: \lst at OutputOther \lst at lettertrue \fi:
         \bool_set_true:N \l__xeCJK_listings_letter_bool
       }
-    \int_set_eq:NN \l__xeCJK_listings_flag_int \c_two
+    \int_set:Nn \l__xeCJK_listings_flag_int { 2 }
     \__xeCJK_listings_append:nN {#1} #2
   }
 \cs_new_protected_nopar:Npn \__xeCJK_listings_process_FullRight:nN #1#2
@@ -221,7 +221,7 @@
     \lst at whitespacefalse
     \bool_if:NTF \l__xeCJK_listings_letter_bool
       {
-        \int_compare:nNnT \l__xeCJK_listings_flag_int < \c_two
+        \int_compare:nNnT \l__xeCJK_listings_flag_int < 2
           { \__xeCJK_punct_if_long:NT #2 { \lst at Output } }
         \lst at lettertrue
       }
@@ -229,7 +229,7 @@
         \lst at ifletter \lst at Output \else: \lst at OutputOther \lst at lettertrue \fi:
         \bool_set_true:N \l__xeCJK_listings_letter_bool
       }
-    \int_set_eq:NN \l__xeCJK_listings_flag_int \c_three
+    \int_set:Nn \l__xeCJK_listings_flag_int { 3 }
     \__xeCJK_listings_append:nN {#1} #2
   }
 \int_new:N \l__xeCJK_listings_flag_int
@@ -305,7 +305,7 @@
 \cs_new_protected_nopar:Npn \__xeCJK_listings_inline_group:w
   {
     \exp_after:wN \__xeCJK_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 at InlineGJ \__xeCJK_listings_inline_group:w
 \cs_new_protected:Npn \__xeCJK_listings_inline_group:n #1

Modified: trunk/Master/texmf-dist/tex/xelatex/xecjk/xeCJK.cfg
===================================================================
--- trunk/Master/texmf-dist/tex/xelatex/xecjk/xeCJK.cfg	2019-04-07 21:28:18 UTC (rev 50851)
+++ trunk/Master/texmf-dist/tex/xelatex/xecjk/xeCJK.cfg	2019-04-07 21:28:36 UTC (rev 50852)
@@ -6,10 +6,10 @@
 %%
 %% xeCJK.dtx  (with options: `config')
 %% 
-\GetIdInfo$Id: xeCJK.dtx b604170 2018-04-30 10:29:28 +0800 Liu Haiyang <leoliu.pku at gmail.com> $
+\GetIdInfo$Id: xeCJK.dtx 8be031f 2019-04-07 23:30:14 +0800 Qing Lee <sobenlee at gmail.com> $
   {Configuration file for xeCJK package}
 \ProvidesExplFile{\ExplFileName.cfg}
-  {\ExplFileDate}{3.7.1}{\ExplFileDescription}
+  {\ExplFileDate}{3.7.2}{\ExplFileDescription}
 
 %% 
 %%

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

Modified: trunk/Master/texmf-dist/tex/xelatex/xecjk/xeCJKfntef.sty
===================================================================
--- trunk/Master/texmf-dist/tex/xelatex/xecjk/xeCJKfntef.sty	2019-04-07 21:28:18 UTC (rev 50851)
+++ trunk/Master/texmf-dist/tex/xelatex/xecjk/xeCJKfntef.sty	2019-04-07 21:28:36 UTC (rev 50852)
@@ -7,8 +7,8 @@
 %% xeCJK.dtx  (with options: `fntef')
 %% 
 %%     Copyright (C) 2007--2010 by Wenchang Sun <sunwch at nankai.edu.cn>
-%%     Copyright (C) 2009--2018 by Leo Liu <leoliu.pku at gmail.com>
-%%     Copyright (C) 2012--2018 by Qing Lee <sobenlee at gmail.com>
+%%     Copyright (C) 2009--2019 by Leo Liu <leoliu.pku at gmail.com>
+%%     Copyright (C) 2012--2019 by Qing Lee <sobenlee at gmail.com>
 %% ----------------------------------------------------------------------
 %% 
 %%     This work may be distributed and/or modified under the
@@ -29,16 +29,15 @@
 %% 
 \NeedsTeXFormat{LaTeX2e}
 \RequirePackage{expl3}
-\GetIdInfo$Id: xeCJK.dtx b604170 2018-04-30 10:29:28 +0800 Liu Haiyang <leoliu.pku at gmail.com> $
+\GetIdInfo$Id: xeCJK.dtx 8be031f 2019-04-07 23:30:14 +0800 Qing Lee <sobenlee at gmail.com> $
   {xeCJK font effect}
 \ProvidesExplPackage{xeCJKfntef}
-  {\ExplFileDate}{3.7.1}{\ExplFileDescription}
+  {\ExplFileDate}{3.7.2}{\ExplFileDescription}
 \PassOptionsToPackage { normalem } { ulem }
 \DeclareOption* { \PassOptionsToPackage { \CurrentOption } { ulem } }
 \ProcessOptions \scan_stop:
 \RequirePackage { xeCJK }
 \RequirePackage { ulem }
-\RequirePackage { environ }
 \file_if_exist:nT { CJKfntef.sty }
   { \RequirePackage { CJKfntef } }
 \addto at hook \UL at hook { \xeCJK_hook_for_ulem: }
@@ -192,12 +191,11 @@
     \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 \__xeCJK_ulem_right_aux:n
-            \exp_after:wN { \dim_use:N \tex_lastkern:D }
+            \exp_args:NNo \tex_unkern:D
+            \__xeCJK_ulem_right_aux:n { \dim_use:N \tex_lastkern:D }
           }
       }
   }
@@ -235,17 +233,17 @@
 \cs_new_eq:NN \xeCJK_ulem_right_skip: \prg_do_nothing:
 \cs_new_protected_nopar:Npn \__xeCJK_ulem_right_skip:
   {
-    \int_case:nn { \etex_lastnodetype:D }
+    \int_case:nn { \tex_lastnodetype:D }
       {
-        { \c_one }      { \__xeCJK_ulem_right_skip_hbox: }
-        { \c_eleven }   { \__xeCJK_ulem_right_skip_glue: }
-        { \c_thirteen } { \__xeCJK_ulem_right_skip_penalty: }
+        { 1 }  { \__xeCJK_ulem_right_skip_hbox: }
+        { 11 } { \__xeCJK_ulem_right_skip_glue: }
+        { 13 } { \__xeCJK_ulem_right_skip_penalty: }
       }
   }
 \cs_new_protected_nopar:Npn \__xeCJK_ulem_right_skip_hbox:
   {
     \box_set_to_last:N \l__xeCJK_tmp_box
-    \int_compare:nNnTF \etex_lastnodetype:D = \c_twelve
+    \int_compare:nNnTF \tex_lastnodetype:D = { 12 }
       { \__xeCJK_ulem_right_skip_kern: }
       { \__xeCJK_ulem_right_skip_glue: }
     \box_use_drop:N \l__xeCJK_tmp_box
@@ -274,7 +272,7 @@
   {
     \int_set_eq:NN \l__xeCJK_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
       { \__xeCJK_ulem_right_skip_hbox: }
     \tex_penalty:D \l__xeCJK_tmp_int
   }
@@ -618,7 +616,7 @@
         \tl_if_empty:NTF \l__xeCJK_group_tag_tl
           { \UL at stop \__xeCJK_ulem_hskip:n {#1} \UL at start }
           {
-            \str_if_eq_x:nnTF { \l__xeCJK_group_tag_tl } { \c__xeCJK_group_tag_tl }
+            \str_if_eq:eeTF { \l__xeCJK_group_tag_tl } { \c__xeCJK_group_tag_tl }
               { \UL at stop \__xeCJK_ulem_hskip:n {#1} \UL at start }
               { \skip_horizontal:n {#1} }
           }
@@ -630,8 +628,8 @@
 \tl_new:N \l__xeCJK_group_tag_tl
 \tl_const:Nn \c__xeCJK_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 \__xeCJK_ulem_ccglue:
   { { \skip_set_eq:NN \UL at skip \l__xeCJK_ccglue_skip \UL at leaders } }
@@ -1013,7 +1011,7 @@
             \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__xeCJK_fntef_box \tex_hss:D
               }
           }
@@ -1051,7 +1049,7 @@
     \endminipage
     \ignorespacesafterend
   }
-\NewEnviron { CJKfilltwosides* } [ 2 ] [ c ]
+\DeclareDocumentEnvironment { CJKfilltwosides* } { O { c } m +b }
   {
     \mode_leave_vertical:
     \cs_set_eq:NN \CJKglue \xeCJK_fntef_hfilll:
@@ -1058,32 +1056,20 @@
     \tl_set:Nn \arraystretch { 1 }
     \cs_if_free:NF \extrarowheight
       { \cs_set_eq:NN \extrarowheight \c_zero_dim }
-    \use:x { \__xeCJK_fill_two_sides:nn {#1} { \dim_eval:n {#2} } }
+    \use:x { \__xeCJK_fill_two_sides:nnn {#1} { \dim_eval:n {#2} } } {#3}
   }
-  [ \ignorespacesafterend ]
-\cs_new_protected:Npn \__xeCJK_fill_two_sides:nn #1#2
+  { \ignorespacesafterend }
+\cs_new_protected:Npn \__xeCJK_fill_two_sides:nnn #1#2#3
   {
     \dim_compare:nNnTF {#2} > \c_zero_dim
       {
         \hbox_set:Nn \l__xeCJK_tmp_box
-          {
-            \tabular [#1] { @ { } c @ { } }
-              \BODY
-            \endtabular
-          }
+          { \tabular [#1] { @ { } c @ { } }      #3 \endtabular }
         \dim_compare:nNnTF {#2} > { \box_wd:N \l__xeCJK_tmp_box }
-          {
-            \tabular [#1] { @ { } p {#2} @ { } }
-              \BODY
-            \endtabular
-          }
+          { \tabular [#1] { @ { } p {#2} @ { } } #3 \endtabular }
           { \box_use:N \l__xeCJK_tmp_box }
       }
-      {
-        \tabular [#1] { @ { } c @ { } }
-          \BODY
-        \endtabular
-      }
+      { \tabular [#1] { @ { } c @ { } }          #3 \endtabular }
   }
 \cs_new_protected_nopar:Npn \xeCJK_fntef_hfilll:
   { \skip_horizontal:N \c__xeCJK_filll_skip }

Modified: trunk/Master/texmf-dist/tex/xelatex/xecjk/xunicode-addon.sty
===================================================================
--- trunk/Master/texmf-dist/tex/xelatex/xecjk/xunicode-addon.sty	2019-04-07 21:28:18 UTC (rev 50851)
+++ trunk/Master/texmf-dist/tex/xelatex/xecjk/xunicode-addon.sty	2019-04-07 21:28:36 UTC (rev 50852)
@@ -7,8 +7,8 @@
 %% xeCJK.dtx  (with options: `xunicode')
 %% 
 %%     Copyright (C) 2007--2010 by Wenchang Sun <sunwch at nankai.edu.cn>
-%%     Copyright (C) 2009--2018 by Leo Liu <leoliu.pku at gmail.com>
-%%     Copyright (C) 2012--2018 by Qing Lee <sobenlee at gmail.com>
+%%     Copyright (C) 2009--2019 by Leo Liu <leoliu.pku at gmail.com>
+%%     Copyright (C) 2012--2019 by Qing Lee <sobenlee at gmail.com>
 %% ----------------------------------------------------------------------
 %% 
 %%     This work may be distributed and/or modified under the
@@ -29,10 +29,10 @@
 %% 
 \NeedsTeXFormat{LaTeX2e}
 \RequirePackage{expl3}
-\GetIdInfo$Id: xeCJK.dtx b604170 2018-04-30 10:29:28 +0800 Liu Haiyang <leoliu.pku at gmail.com> $
+\GetIdInfo$Id: xeCJK.dtx 8be031f 2019-04-07 23:30:14 +0800 Qing Lee <sobenlee at gmail.com> $
   {addon file for xunicode}
 \ProvidesExplPackage{xunicode-addon}
-  {\ExplFileDate}{3.7.1}{\ExplFileDescription}
+  {\ExplFileDate}{3.7.2}{\ExplFileDescription}
 \bool_lazy_or:nnF
   { \sys_if_engine_xetex_p: }
   { \sys_if_engine_luatex_p: }
@@ -159,7 +159,7 @@
   }
 \prg_new_conditional:Npnn \__xunadd_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:
   }
 \RenewDocumentCommand \UndeclareUTFcharacter { O { \UTFencname } m m }
@@ -231,7 +231,7 @@
   {
     \__xunadd_provide_text_command_default:N #1
     \exp_after:wN \__xunadd_declare_character:NNxn
-      \utex_char:D \__xunadd_check_slot:n {#3} \exp_stop_f:
+      \tex_Uchar: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 }
@@ -292,7 +292,7 @@
     \q_stop
   }
 \cs_new_protected:Npn \__xunadd_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 \__xunadd_chardef:Nn { c }
 \cs_generate_variant:Nn \__xunadd_declare_composite:Nnnn { c }
 \NewDocumentCommand \DeclareUTFCompositeCommand { m O { \UTFencname } m m }
@@ -346,8 +346,8 @@
 \cs_new_protected:Npn \__xunadd_declare_encoded:NNnnn #1#2#3#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:
+      \tex_Uchar:D \__xunadd_check_slot:n {#4} \exp_after:wN \exp_stop_f:
+      \tex_Uchar: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
@@ -596,9 +596,8 @@
   }
 \cs_new_protected:Npn \__xunadd_text_tipa_command:nnn #1#2#3
   {
-    \exp_after:wN \__xunadd_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 \__xunadd_check_for_tipa:NNn
+      { \use_none:n #2 } { UTF/#1#2 } {#3}
   }
 \cs_new_protected:Npn \__xunadd_check_for_tipa:NNn #1#2#3
   {
@@ -609,6 +608,74 @@
       }
       { #2 {#3} }
   }
+\cs_new_protected:Npn \xunadd_get_slot:nn #1#2
+  { \__xunadd_get_slot:wn #2 \q_nil \q_stop {#1} }
+\cs_new_protected:Npn \__xunadd_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:
+    { __xunadd_get_slot:NNnn }
+      { #4 \token_to_str:N #1 }
+      { \__xunadd_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 \__xunadd_get_slot:NNnn #1#2#3#4
+  {
+    \cs_if_free:NF #1
+      {
+        \cs_if_exist:NTF #2
+          { \__xunadd_get_composite_slot:Nn #2 {#4} }
+          { \__xunadd_get_character_slot:Nn #1 { #3 #4 } }
+      }
+  }
+\cs_new_protected:Npn \__xunadd_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 \__xunadd_get_character_slot:Nn #1
+  {
+    \exp_after:wN \__xunadd_get_character_slot_aux:wn #1
+      \__xunadd_text_character:nN \q_nil \q_nil \q_stop
+  }
+\cs_new_protected:Npn \__xunadd_get_character_slot_aux:wn
+  #1 \__xunadd_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 }
+      }
+  }
+\cs_new_protected:Npn \xunadd at microtype@is at charx #1 \relax
+  {
+    \use:x
+      { \xunadd_get_slot:nn { \MT at encoding } { \tex_the:D \MT at toks } }
+    \int_compare:nNnTF \l_xunadd_slot_int < \c_zero_int
+      { \xunadd at original@is at charx #1 \relax }
+      {
+        \cs_set_nopar:Npx \MT at char@ { \int_use:N \l_xunadd_slot_int }
+        \bool_if:NT \l_xunadd_rest_bool { \MT at norestfalse }
+      }
+  }
+\AtBeginDocument
+  {
+    \cs_if_free:NF \MT at is@charx
+      {
+        \cs_new_eq:NN \xunadd at original@is at charx \MT at is@charx
+        \cs_set_eq:NN \MT at is@charx \xunadd at microtype@is at charx
+        \cs_set_eq:NN \MT at warn@unknown at once \use_none:n
+      }
+  }
 %% 
 %%     This package consists of the files xeCJK.dtx,
 %%                                        full-stop.map,

Modified: trunk/Master/texmf-dist/tex/xelatex/xecjk/xunicode-extra.def
===================================================================
--- trunk/Master/texmf-dist/tex/xelatex/xecjk/xunicode-extra.def	2019-04-07 21:28:18 UTC (rev 50851)
+++ trunk/Master/texmf-dist/tex/xelatex/xecjk/xunicode-extra.def	2019-04-07 21:28:36 UTC (rev 50852)
@@ -7,8 +7,8 @@
 %% xeCJK.dtx  (with options: `xunextra')
 %% 
 %%     Copyright (C) 2007--2010 by Wenchang Sun <sunwch at nankai.edu.cn>
-%%     Copyright (C) 2009--2018 by Leo Liu <leoliu.pku at gmail.com>
-%%     Copyright (C) 2012--2018 by Qing Lee <sobenlee at gmail.com>
+%%     Copyright (C) 2009--2019 by Leo Liu <leoliu.pku at gmail.com>
+%%     Copyright (C) 2012--2019 by Qing Lee <sobenlee at gmail.com>
 %% ----------------------------------------------------------------------
 %% 
 %%     This work may be distributed and/or modified under the
@@ -27,10 +27,10 @@
 %% 
 %% ----------------------------------------------------------------------
 %% 
-\GetIdInfo$Id: xeCJK.dtx b604170 2018-04-30 10:29:28 +0800 Liu Haiyang <leoliu.pku at gmail.com> $
+\GetIdInfo$Id: xeCJK.dtx 8be031f 2019-04-07 23:30:14 +0800 Qing Lee <sobenlee at gmail.com> $
   {extra definition for xunicode}
 \ProvidesExplFile{xunicode-extra.def}
-  {\ExplFileDate}{3.7.1}{\ExplFileDescription}
+  {\ExplFileDate}{3.7.2}{\ExplFileDescription}
 \DeclareUTFSymbol\texthyphenationpoint{"2027}
 \DeclareUTFSymbol\texttwoemdash{"2E3A}
 \DeclareUTFComposite\textsuperscript



More information about the tex-live-commits mailing list