From 0cab1dfa4f709e056ae6171885b7fc03bd26a3b2 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Tue, 30 Oct 2012 00:35:55 +0000 Subject: xecjk (29oct12) git-svn-id: svn://tug.org/texlive/trunk@28115 c570f23f-e606-0410-a88d-b1316a301751 --- .../xecjk/example/xeCJK-example-CJKecglue.tex | 2 +- .../xecjk/example/xeCJK-example-autofake.tex | 2 +- .../xecjk/example/xeCJK-example-checksingle.tex | 2 +- .../xecjk/example/xeCJK-example-fallback.tex | 2 +- .../xecjk/example/xeCJK-example-subCJKblock.tex | 2 +- Master/texmf-dist/doc/xelatex/xecjk/xeCJK.pdf | Bin 677646 -> 680743 bytes Master/texmf-dist/source/xelatex/xecjk/xeCJK.dtx | 838 +++++++++++---------- Master/texmf-dist/source/xelatex/xecjk/xeCJK.ins | 4 +- Master/texmf-dist/tex/xelatex/xecjk/xeCJK.sty | 653 ++++++++-------- 9 files changed, 823 insertions(+), 682 deletions(-) diff --git a/Master/texmf-dist/doc/xelatex/xecjk/example/xeCJK-example-CJKecglue.tex b/Master/texmf-dist/doc/xelatex/xecjk/example/xeCJK-example-CJKecglue.tex index d872c41d7f6..f9159b4976a 100644 --- a/Master/texmf-dist/doc/xelatex/xecjk/example/xeCJK-example-CJKecglue.tex +++ b/Master/texmf-dist/doc/xelatex/xecjk/example/xeCJK-example-CJKecglue.tex @@ -6,7 +6,7 @@ %% %% xeCJK.dtx (with options: `ex-ecglue') %% -%% $Id: xeCJK.dtx 357 2012-10-16 18:42:20Z sobenlee $ +%% $Id: xeCJK.dtx 358 2012-10-27 11:52:01Z sobenlee $ %% $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ %% ----------------------------------------------------------------- %% Author: diff --git a/Master/texmf-dist/doc/xelatex/xecjk/example/xeCJK-example-autofake.tex b/Master/texmf-dist/doc/xelatex/xecjk/example/xeCJK-example-autofake.tex index 3ea0e701b39..190dfb2883d 100644 --- a/Master/texmf-dist/doc/xelatex/xecjk/example/xeCJK-example-autofake.tex +++ b/Master/texmf-dist/doc/xelatex/xecjk/example/xeCJK-example-autofake.tex @@ -6,7 +6,7 @@ %% %% xeCJK.dtx (with options: `ex-autofake') %% -%% $Id: xeCJK.dtx 357 2012-10-16 18:42:20Z sobenlee $ +%% $Id: xeCJK.dtx 358 2012-10-27 11:52:01Z sobenlee $ %% $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ %% ----------------------------------------------------------------- %% Author: diff --git a/Master/texmf-dist/doc/xelatex/xecjk/example/xeCJK-example-checksingle.tex b/Master/texmf-dist/doc/xelatex/xecjk/example/xeCJK-example-checksingle.tex index 454eac10d98..07b0e4822d6 100644 --- a/Master/texmf-dist/doc/xelatex/xecjk/example/xeCJK-example-checksingle.tex +++ b/Master/texmf-dist/doc/xelatex/xecjk/example/xeCJK-example-checksingle.tex @@ -6,7 +6,7 @@ %% %% xeCJK.dtx (with options: `ex-single') %% -%% $Id: xeCJK.dtx 357 2012-10-16 18:42:20Z sobenlee $ +%% $Id: xeCJK.dtx 358 2012-10-27 11:52:01Z sobenlee $ %% $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ %% ----------------------------------------------------------------- %% Author: diff --git a/Master/texmf-dist/doc/xelatex/xecjk/example/xeCJK-example-fallback.tex b/Master/texmf-dist/doc/xelatex/xecjk/example/xeCJK-example-fallback.tex index 5fef9ab8154..e6d2f36fde5 100644 --- a/Master/texmf-dist/doc/xelatex/xecjk/example/xeCJK-example-fallback.tex +++ b/Master/texmf-dist/doc/xelatex/xecjk/example/xeCJK-example-fallback.tex @@ -6,7 +6,7 @@ %% %% xeCJK.dtx (with options: `ex-fallback') %% -%% $Id: xeCJK.dtx 357 2012-10-16 18:42:20Z sobenlee $ +%% $Id: xeCJK.dtx 358 2012-10-27 11:52:01Z sobenlee $ %% $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ %% ----------------------------------------------------------------- %% Author: diff --git a/Master/texmf-dist/doc/xelatex/xecjk/example/xeCJK-example-subCJKblock.tex b/Master/texmf-dist/doc/xelatex/xecjk/example/xeCJK-example-subCJKblock.tex index 28d7b007be4..00042b473bf 100644 --- a/Master/texmf-dist/doc/xelatex/xecjk/example/xeCJK-example-subCJKblock.tex +++ b/Master/texmf-dist/doc/xelatex/xecjk/example/xeCJK-example-subCJKblock.tex @@ -6,7 +6,7 @@ %% %% xeCJK.dtx (with options: `ex-block') %% -%% $Id: xeCJK.dtx 357 2012-10-16 18:42:20Z sobenlee $ +%% $Id: xeCJK.dtx 358 2012-10-27 11:52:01Z sobenlee $ %% $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ %% ----------------------------------------------------------------- %% Author: diff --git a/Master/texmf-dist/doc/xelatex/xecjk/xeCJK.pdf b/Master/texmf-dist/doc/xelatex/xecjk/xeCJK.pdf index bef9fa2f5eb..4f418136d5a 100644 Binary files a/Master/texmf-dist/doc/xelatex/xecjk/xeCJK.pdf and b/Master/texmf-dist/doc/xelatex/xecjk/xeCJK.pdf differ diff --git a/Master/texmf-dist/source/xelatex/xecjk/xeCJK.dtx b/Master/texmf-dist/source/xelatex/xecjk/xeCJK.dtx index 92a173eabfa..7db4de8d136 100644 --- a/Master/texmf-dist/source/xelatex/xecjk/xeCJK.dtx +++ b/Master/texmf-dist/source/xelatex/xecjk/xeCJK.dtx @@ -59,7 +59,17 @@ CJK scripts fonts (TrueType or OpenType). % %<*internal> \fi -\ifnum\strcmp{\fmtname}{plain}=0 \else +\begingroup +\edef\tempa{\fmtname} +\edef\tempb{plain} +\ifx\tempa\tempb + \endgroup + \expandafter\let\csname ifxeCJKplainTeX\expandafter\endcsname\csname iftrue\endcsname +\else + \endgroup + \expandafter\let\csname ifxeCJKplainTeX\expandafter\endcsname\csname iffalse\endcsname +\fi +\ifxeCJKplainTeX \else \expandafter\begingroup \fi % @@ -70,7 +80,7 @@ CJK scripts fonts (TrueType or OpenType). \askforoverwritefalse \preamble -$Id: xeCJK.dtx 357 2012-10-16 18:42:20Z sobenlee $ +$Id: xeCJK.dtx 358 2012-10-27 11:52:01Z sobenlee $ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ ----------------------------------------------------------------- Author: @@ -124,7 +134,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ \nopreamble\nopostamble \usedir{doc/xelatex/xecjk} \generate{\file{README.txt}{\from{\jobname.dtx}{readme}}} -\ifnum\strcmp{\fmtname}{plain}=0 +\ifxeCJKplainTeX \expandafter\endbatchfile \else \expandafter\endgroup @@ -134,7 +144,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ %<*driver|package> \NeedsTeXFormat{LaTeX2e} \RequirePackage{expl3} -\GetIdInfo$Id: xeCJK.dtx 357 2012-10-16 18:42:20Z sobenlee $ +\GetIdInfo$Id: xeCJK.dtx 358 2012-10-27 11:52:01Z sobenlee $ {package for typesetting CJK scripts with XeLaTeX} %<*driver> \ProvidesExplFile @@ -142,7 +152,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ % %\ProvidesExplPackage % {\ExplFileName} - {\ExplFileDate}{3.0.9}{\ExplFileDescription} + {\ExplFileDate}{3.0.10}{\ExplFileDescription} %<*driver> \ExplSyntaxOff % @@ -184,7 +194,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ \def\TFF{true\orvar\defaultvar{false}} \def\orvar{\char`\|} \let\defaultvar\textbf -\def\argbrace#1{\char`\{#1\char`\}} +\def\argbrace#1{\{#1\}} \@addtoreset{CodelineNo}{section} \def\tokslink#1{\hyperlink{#1}{\ding{51}}} \makeatother @@ -200,7 +210,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ % % \fi % -% \CheckSum{3074} +% \CheckSum{3129} % \DoNotIndex{\T,\F,\C,\J,\K,\O,\U,\Z,\E,\R,\M,\A,\Y,\R,\;,\t,\c,\:,\\,\@} % \GetFileInfo{\jobname.dtx} % @@ -262,8 +272,8 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ % 字体,同时提供了进一步的本地化支持。详细内容参看 \pkg{ctex} 宏包^^A % \footnote{\url{http://mirrors.ctan.org/language/chinese/ctex/}}的说明。 % -% \pkg{xeCJK} 提供了大量选项,可以在宏包调用时作为宏包选项或用 |\xeCJKsetup| -% 命令进行设置,详见 \ref{subsec:opts}~节。除了 |\setCJKmainfont| 命令, +% \pkg{xeCJK} 提供了大量选项,可以在宏包调用时作为宏包选项或用 \cs{xeCJKsetup} +% 命令进行设置,详见 \ref{subsec:opts}~节。除了 \cs{setCJKmainfont} 命令, % \pkg{xeCJK} 还提供了许多其他命令设置和选择中文字体,详见 % \ref{subsec:fontset}~节。其他更详细的功能也都将在下面详细说明。 % @@ -273,7 +283,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ % \label{subsec:opts} % % \pkg{xeCJK} 以 \meta{key}|=|\meta{var} 的形式提供宏包选项,你可以在调用宏包 -% 的时候直接设置这些选项,也可以在调用宏包之后使用 |\xeCJKsetup| 来设置这些选 +% 的时候直接设置这些选项,也可以在调用宏包之后使用 \cs{xeCJKsetup} 来设置这些选 % 项。 % % \begin{function}{\xeCJKsetup} @@ -312,7 +322,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ % CJKnumber = \meta{\TFF} % \end{syntax} % 是否使用 \pkg{CJKnumb} 宏包。请注意,为了与 \pkg{CJKnumb} 兼容,\pkg{xeCJK} 修改了 -% 它的一些内部命令,所以这个选项需要在调用 \pkg{xeCJK} 时设置,而不能通过 |\xeCJKsetup| +% 它的一些内部命令,所以这个选项需要在调用 \pkg{xeCJK} 时设置,而不能通过 \cs{xeCJKsetup} % 来设置它。 % \end{function} % @@ -321,8 +331,8 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ % indentfirst = \meta{\TTF} % \end{syntax} % 跟在章节标题后面的第一段首行是否缩进。这个选项需要在调用 \pkg{xeCJK} 时设置,不能 -% 通过 |\xeCJKsetup| 来设置它。\pkg{xeCJK} 宏包中只有 |indentfirst| 和 |CJKnumber| -% 这两个选项,不能通过 |\xeCJKsetup| 来设置。 +% 通过 \cs{xeCJKsetup} 来设置它。\pkg{xeCJK} 宏包中只有 |indentfirst| 和 |CJKnumber| +% 这两个选项,不能通过 \cs{xeCJKsetup} 来设置。 % \end{function} % % \begin{function}{CJKspace} @@ -380,7 +390,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ % InlineEnv = \argbrace{env1, env2, env3, ...} % \end{syntax} % 在使用 |CheckSingle| 选项的时候,\pkg{xeCJK} 会将 CJK 文字后接着的 \LaTeX 环境的 -% 开始 |\begin{...}| 和结束 |\end{...}| 视为断行的地方,如果有某些特殊 +% 开始 \cs{begin{...}} 和结束 \cs{end{...}} 视为断行的地方,如果有某些特殊 % 的 \LaTeX 环境没有造成断行,可以使用这个选项来声明它,以便 |CheckSingle| 能正确识别。 % \end{function} % @@ -447,7 +457,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ % % \begin{function}[EXP]{LongPunct,LongPunct+,LongPunct-} % \begin{syntax} -% LongPunct = \marg{\defaultvar{ — ‥ … ─ }} +% LongPunct = \marg{\defaultvar{ — ― ─ ‥ … }} % \end{syntax} % 设置长标点,例如破折号“——”与省略号“……”,允许在长标点前后 % 断行,但是禁止在它们之间断行。 @@ -455,7 +465,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ % % \begin{function}[EXP]{MiddlePunct,MiddlePunct+,MiddlePunct-} % \begin{syntax} -% MiddlePunct = \marg{\defaultvar{ · · ・ }} +% MiddlePunct = \marg{\defaultvar{ — ― ─ · · ・ }} % \end{syntax} % 设置居中显示的标点,例如间隔号“\textbf{·}”。对于在 CJK 文字之间的居中标点, % \pkg{xeCJK} 会根据不同的标点处理格式,调整居中标点与前后文字之间的空白,保证 @@ -471,7 +481,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ % 这里设置的 |dimen| 的单位最好用 |em| 等相对距离单位,而不建议使用诸如 |pt| 之类的 % 绝对距离单位。这里的设置对除了 |plain| 以外的所有标点处理格式都有效。同时,这里的 % 设置对所有的 CJK 标点都生效,如果只要设置部分标点,请使用 \ref{subsec:punct} 节的 -% |\xeCJKsetwidth|。 +% \cs{xeCJKsetwidth}。 % \end{function} % % \begin{function}{AllowBreakBetweenPuncts} @@ -489,7 +499,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ % \begin{syntax} % \cs{setCJKmainfont} \oarg{font features} \Arg{font name} % \end{syntax} -% 设置正文罗马族的 CJK 字体,影响 |\rmfamily| 和 |\textrm| 的字体。后面两个 +% 设置正文罗马族的 CJK 字体,影响 \cs{rmfamily} 和 \cs{textrm} 的字体。后面两个 % 参数继承自 \pkg{fontspec} 宏包, \meta{font features} 表示字体属性选项, % \meta{font name} 是字体名。字体名可以是字体族名,也可以是字体的文件名,查 % 找字体名见 \ref{subsubsec:fontsearch}~节;可用的字体属性选项参见 @@ -509,14 +519,14 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ % \begin{syntax} % \cs{setCJKsansfont} \oarg{font features} \Arg{font name} % \end{syntax} -% 设置正文无衬线族的 CJK 字体,影响 |\sffamily| 和 |\textsf| 的字体。 +% 设置正文无衬线族的 CJK 字体,影响 \cs{sffamily} 和 \cs{textsf} 的字体。 % \end{function} % % \begin{function}[EXP]{\setCJKmonofont} % \begin{syntax} % \cs{setCJKmonofont} \oarg{font features} \Arg{font name} % \end{syntax} -% 设置正文等宽族的 CJK 字体,影响 |\ttfamily| 和 |\texttt| 的字体。为了有利于等宽 +% 设置正文等宽族的 CJK 字体,影响 \cs{ttfamily} 和 \cs{texttt} 的字体。为了有利于等宽 % 字体的代码对齐等情形,\pkg{xeCJK} 在 \meta{font features} 里增加了 |Mono| 这个选项。 % \end{function} % @@ -533,9 +543,9 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ % \cs{CJKfixedspacing} % \cs{CJKflexiblespacing} % \end{syntax} -% |\CJKfixedspacing| 命令设置固定字距和不压缩标点格式,符合上面 |Mono=Exspace| 选 -% 项的意义。|\CJKflexiblespacing| 命令恢复可伸缩的字距和标点压缩。抄录 |(verbatim)| -% 环境将自动使用 |\CJKfixedspacing| 的效果。 +% \cs{CJKfixedspacing} 命令设置固定字距和不压缩标点格式,符合上面 |Mono=Exspace| 选 +% 项的意义。\cs{CJKflexiblespacing} 命令恢复可伸缩的字距和标点压缩。抄录 |(verbatim)| +% 环境将自动使用 \cs{CJKfixedspacing} 的效果。 % \end{function} % % \begin{function}{\setCJKmonoscale,\setCJKmonoexspace} @@ -543,7 +553,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ % \cs{setCJKmonoscale} % \cs{setCJKmonoexspace} % \end{syntax} -% |\setCJKmonoscale| 和 |\setCJKmonoexspace| 命令分别计算并设置当前字号下西文等宽 +% \cs{setCJKmonoscale} 和 \cs{setCJKmonoexspace} 命令分别计算并设置当前字号下西文等宽 % 字体与 CJK 字体的放缩比例和字距,以符合上面所说的 |Mono=Scale| 与 |Mono=Exspace| % 选项的意义。在字号改变时,应该使用两个命令之一,重新计算相关参数;但注意两个命令不 % 能同时使用。 @@ -558,9 +568,13 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ % % \begin{function}{\CJKfamily} % \begin{syntax} -% \cs{CJKfamily} \Arg{family} +% \cs{CJKfamily} \Arg{family} +% \cs{CJKfamily+} \Arg{family} +% \cs{CJKfamily-} \Arg{family} % \end{syntax} -% 用于在文档中切换 |CJK| 字体族,\meta{family} 必须预先声明。 +% 用于在文档中切换 |CJK| 字体族,\meta{family} 必须预先声明。\cs{CJKfamily} 仅对 +% CJK 字符类有效,\cs{CJKfamily+} 对所有字符类均有效,\cs{CJKfamily-} 对非 CJK 字 +% 符类有效。当 \cs{CJKfamily+} 和 \cs{CJKfamily-} 的参数为空时,则使用当前的 |CJK| 字体族。 % \end{function} % % \begin{function}[EXP]{\newCJKfontfamily} @@ -569,8 +583,8 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ % \end{syntax} % 声明新的 CJK 字体族 \meta{family} 并指定字体,并定义 \cs{\meta{font-switch}},在 % 文档中可以使用它来切换 CJK 字体族。可以不必指定 \meta{family},这时候 \meta{family} -% 将等于 \meta{font-switch}。事实上,|\newCJKfontfamily| 是 |\setCJKfamilyfont| 和 -% |\CJKfamily| 的合并。例如 +% 将等于 \meta{font-switch}。事实上,\cs{newCJKfontfamily} 是 \cs{setCJKfamilyfont} 和 +% \cs{CJKfamily} 的合并。例如 % \begin{verbatim} % \newCJKfontfamily[song]\songti{SimSun} % \end{verbatim} @@ -614,20 +628,20 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ % \end{function} % % \begin{function}{\CJKrmdefault} -% 保存 |\rmfamily| 所使用的 CJK 字体族,默认值是 |rm|。类似西文字体的 |\rmdefault|。 +% 保存 \cs{rmfamily} 所使用的 CJK 字体族,默认值是 |rm|。类似西文字体的 \cs{rmdefault}。 % \end{function} % % \begin{function}{\CJKsfdefault} -% 保存 |\sffamily| 所使用的 CJK 字体族,默认值是 |sf|。类似西文字体的 |\sfdefault|。 +% 保存 \cs{sffamily} 所使用的 CJK 字体族,默认值是 |sf|。类似西文字体的 \cs{sfdefault}。 % \end{function} % % \begin{function}{\CJKttdefault} -% 保存 |\ttfamily| 所使用的 CJK 字体族,默认值是 |tt|。类似西文字体的 |\ttdefault|。 +% 保存 \cs{ttfamily} 所使用的 CJK 字体族,默认值是 |tt|。类似西文字体的 \cs{ttdefault}。 % \end{function} % % \begin{function}{\CJKfamilydefault} -% 保存 |\normalfont| 所使用的 CJK 字体族,默认值是 |\CJKrmdefault|。类似西文字 -% 体的 |\familydefault|。可以通过更改它来改变文档的默认 CJK 字体族。例如,使用 +% 保存 \cs{normalfont} 所使用的 CJK 字体族,默认值是 \cs{CJKrmdefault}。类似西文字 +% 体的 \cs{familydefault}。可以通过更改它来改变文档的默认 CJK 字体族。例如,使用 % \begin{verbatim} % \renewcommand\familydefault{\sfdefault} % \renewcommand\CJKfamilydefault{\CJKsfdefault} @@ -640,7 +654,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ % \cs{setCJKmathfont} \oarg{font features} \Arg{font name} % \end{syntax} % 设置数学公式中的 CJK 字体族。如果使用了 |CJKmath| 选项,但是没有使用 -% |\setCJKmathfont| 设置数学公式中的 CJK 字体,那么将使用 |\CJKfamilydefault| +% \cs{setCJKmathfont} 设置数学公式中的 CJK 字体,那么将使用 \cs{CJKfamilydefault} % 作为数学公式中的 CJK 字体。 % \end{function} % @@ -684,7 +698,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ % \ ...... % \ \char`\} % \end{syntax} -% |\setCJKfallbackfamilyfont| 还可以用于设置多层的备用字体。例如,使用 +% \cs{setCJKfallbackfamilyfont} 还可以用于设置多层的备用字体。例如,使用 % \begin{verbatim} % \setCJKmainfont[AutoFakeBold,AutoFakeSlant]{KaiTi_GB2312} % \setCJKfallbackfamilyfont{\CJKrmdefault}[AutoFakeSlant] @@ -806,8 +820,8 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ % 设置文档的主字体是 |SimSun|,|SPUA| 分区的字体是 |SunmanPUA|,而 |Ext-B| 分区 % 的字体是 |SimSun-ExtB|。 % -% |\xeCJKDeclareSubCJKBlock| 应该在声明所有的 CJK 字体族之前使用。如果有某个 CJK 字 -% 体族没有设置 \meta{block} 选项,将使用 |\CJKfamilydefault| 的 \meta{block} 选项 +% \cs{xeCJKDeclareSubCJKBlock} 应该在声明所有的 CJK 字体族之前使用。如果有某个 CJK 字 +% 体族没有设置 \meta{block} 选项,将使用 \cs{CJKfamilydefault} 的 \meta{block} 选项 % 作为该 CJK 字体族的 \meta{block} 选项。如果希望在使用某 CJK 字体族时,不在 CJK 主 % 分区与 \meta{block} 之间切换字体,可以使用 \meta{block}|=*| 选项。带星号的命令除了 % 设置 CJK 子分区以外,还重置标点符号所属的字符类。 @@ -885,13 +899,13 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ % \section{已知问题和兼容性} % % 为了与 \pkg{CJKnumb} 和 \pkg{CJKulem} 宏包兼容,\pkg{xeCJK} 使用并重新定义了 -% \pkg{CJK} 宏包的部分宏命令,如 |\CJKfamily|、|\CJKsymbol| 和 |\CJKpunctsymbol| 等。 +% \pkg{CJK} 宏包的部分宏命令,如 \cs{CJKfamily}、\cs{CJKsymbol} 和 \cs{CJKpunctsymbol} 等。 % 需要指出,\pkg{xeCJK} 不需要 \pkg{CJK} 的支持,并且 \pkg{xeCJK} 自动禁止在它之后载入 % \pkg{CJK} 宏包。 % % 可以在 \pkg{xeCJK} 之后载入 \pkg{CJKfntef} 宏包,以实现汉字加点等。 % -% \pkg{xeCJK} 依赖 \XeTeX 的 |\XeTeXinterchartoks| 机制,与使用相同机制的宏包(例如 +% \pkg{xeCJK} 依赖 \XeTeX 的 \cs{XeTeXinterchartoks} 机制,与使用相同机制的宏包(例如 % \pkg{polyglossia})会存在大小不一的冲突。\pkg{xeCJK} 虽然为此作了一些处理,但与它们 % 共同使用时应该小心。 % @@ -946,7 +960,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ \RequirePackage{l3keys2e} % \end{macrocode} % -% |\XeTeXglyphbouds| 可以得到一个字符的左右边距,用于标点压缩。 +% \cs{XeTeXglyphbouds} 可以得到一个字符的左右边距,用于标点压缩。 % \begin{macrocode} \msg_new:nnn { xeCJK } { XeTeX-too-old } { @@ -994,15 +1008,15 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ % \end{macrocode} % \end{macro} % -% \begin{macro}[internal]{\@@_no_break:} +% \begin{macro}[internal]{\xeCJK_no_break:} % \begin{macrocode} -\cs_new_protected_nopar:Npn \@@_no_break: { \tex_penalty:D \c_ten_thousand } +\cs_new_protected_nopar:Npn \xeCJK_no_break: { \tex_penalty:D \c_ten_thousand } % \end{macrocode} % \end{macro} % % \begin{macro}[internal] % {\@@_AtEndPreamble:n,\@@_AfterPreamble:n,\@@_AfterEndPreamble:n} -% 在 |\document| 前后加上各种钩子。 +% 在 \cs{document} 前后加上各种钩子。 % \begin{macrocode} \tl_new:N \g_@@_at_end_preamble_hook_tl \tl_new:N \g_@@_after_preamble_hook_tl @@ -1019,8 +1033,8 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ % \end{macrocode} % \end{macro} % -% \begin{macro}[pTF,internal]{\@@_if_outer_macro:c} -% 判断是否是 |\outer| 宏,输入的是控制序列的名字。 +% \begin{macro}[pTF,internal]{\xeCJK_if_outer_macro:c} +% 判断是否是 \cs{outer} 宏,输入的是控制序列的名字。 % \begin{macrocode} \group_begin: \char_set_lccode:nn { `\Z } { `\t } @@ -1032,14 +1046,14 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ \tl_to_lowercase:n { \group_end: - \prg_new_conditional:Npnn \@@_if_outer_macro:c #1 { p , T , F , TF } + \prg_new_conditional:Npnn \xeCJK_if_outer_macro:c #1 { p , T , F , TF } { \exp_last_unbraced:Nf \@@_if_outer_macro_aux:w { \cs_meaning:c {#1} } OUZER ~ MAYRO ; \q_stop } \cs_new_nopar:Npn \@@_if_outer_macro_aux:w #1 OUZER ~ MAYRO ; #2 \q_stop { - \if_cs_exist:w c_@@_prefix_ #1 _aux_tl \cs_end: + \if_cs_exist:w c_@@_prefix_#1_aux_tl \cs_end: \prg_return_true: \else: \prg_return_false: \fi: } \tl_new:c { c_@@_prefix_/_aux_tl } @@ -1050,12 +1064,12 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ % \end{macrocode} % \end{macro} % -% \begin{macro}[TF,internal]{\@@_peek_catcode_ignore_spaces:N} -% 对 \pkg{l3token} 打的补丁,使 \cs{__xeCJK_peek_catcode_ignore_spaces:NTF} 等可 +% \begin{macro}[TF,internal]{\xeCJK_peek_catcode_ignore_spaces:N} +% 对 \pkg{l3token} 打的补丁,使 \cs{xeCJK_peek_catcode_ignore_spaces:NTF} 等可 % 用于 \cs{outer} 宏。 % \begin{macrocode} \token_new:Nn \l_@@_peek_search_token { ? } -\cs_new_protected:Npn \@@_peek_catcode_ignore_spaces:NTF #1#2#3 +\cs_new_protected:Npn \xeCJK_peek_catcode_ignore_spaces:NTF #1#2#3 { \cs_set_eq:NN \l_@@_peek_search_token #1 \prg_do_nothing: \tl_set:Nn \@@_peek_true:w { \group_align_safe_end: #2 } @@ -1063,10 +1077,10 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ \group_align_safe_begin: \peek_after:Nw \@@_peek_ignore_spaces_execute_branches: } -\cs_new_protected:Npn \@@_peek_catcode_ignore_spaces:NT #1#2 - { \@@_peek_catcode_ignore_spaces:NTF #1 {#2} { } } -\cs_new_protected:Npn \@@_peek_catcode_ignore_spaces:NF #1#2 - { \@@_peek_catcode_ignore_spaces:NTF #1 { } {#2} } +\cs_new_protected:Npn \xeCJK_peek_catcode_ignore_spaces:NT #1#2 + { \xeCJK_peek_catcode_ignore_spaces:NTF #1 {#2} { } } +\cs_new_protected:Npn \xeCJK_peek_catcode_ignore_spaces:NF #1#2 + { \xeCJK_peek_catcode_ignore_spaces:NTF #1 { } {#2} } \cs_new_nopar:Npn \@@_peek_ignore_spaces_execute_branches: { \if_meaning:w \l_peek_token \c_space_token @@ -1089,10 +1103,10 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ % \end{macrocode} % \end{macro} % -% \begin{macro}[pTF,internal]{\@@_if_blank_x:n} +% \begin{macro}[pTF,internal]{\xeCJK_if_blank_x:n} % 判断是否为空或者仅含一个空格。 % \begin{macrocode} -\prg_new_conditional:Npnn \@@_if_blank_x:n #1 { p , T , F , TF } +\prg_new_conditional:Npnn \xeCJK_if_blank_x:n #1 { p , T , F , TF } { \if_int_compare:w \pdftex_strcmp:D { \c_empty_tl } {#1} = \c_zero \prg_return_true: @@ -1104,10 +1118,10 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ % \end{macrocode} % \end{macro} % -% \begin{macro}[pTF,internal]{\@@_if_package_loaded:n} +% \begin{macro}[pTF,internal]{\xeCJK_if_package_loaded:n} % 判断宏包是否载入,可用于文档中。 % \begin{macrocode} -\prg_new_conditional:Npnn \@@_if_package_loaded:n #1 { p , T , F , TF } +\prg_new_conditional:Npnn \xeCJK_if_package_loaded:n #1 { p , T , F , TF } { \tl_if_exist:cTF { ver@ #1 . \c_@@_pkg_extension_tl } { \prg_return_true: } { \prg_return_false: } @@ -1117,8 +1131,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ % \end{macro} % % \begin{macro}[internal] -% {\@@_msg_new:nn ,\@@_error:n,\@@_error:nx, -% \@@_warning:nx,\@@_info:nx,\@@_info:nxx} +% {\@@_msg_new:nn ,\@@_error:n,\@@_error:nx,\@@_warning:nx,\@@_info:nx,\@@_info:nxx} % 各种信息函数的缩略形式。 % \begin{macrocode} \cs_new_nopar:Npn \@@_msg_new:nn { \msg_new:nnn { xeCJK } } @@ -1288,7 +1301,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ \prop_if_in:NVTF \g_@@_CJK_class_prop \l_@@_tmpc_int { \cs_set_eq:NN \@@_set_char_catcode:n \char_set_catcode_other:n } { \cs_set_eq:NN \@@_set_char_catcode:n \use_none:n } - \@@_int_until_do:nn { \l_@@_tmpa_int > \l_@@_tmpb_int } + \xeCJK_int_until_do:nn { \l_@@_tmpa_int > \l_@@_tmpb_int } { \@@_set_char_catcode:n { \l_@@_tmpa_int } \XeTeXcharclass \l_@@_tmpa_int = \l_@@_tmpc_int @@ -1298,10 +1311,10 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ % \end{macrocode} % \end{macro} % -% \begin{macro}[internal]{\@@_int_until_do:nn} +% \begin{macro}[internal]{\xeCJK_int_until_do:nn} % \begin{macro}[aux]{\@@_int_until_do_aux:wn} % \begin{macrocode} -\cs_new_protected:Npn \@@_int_until_do:nn #1#2 +\cs_new_protected:Npn \xeCJK_int_until_do:nn #1#2 { \@@_int_until_do_aux:wn \use_none:n { \reverse_if:N \if_int_compare:w #1#2 } @@ -1319,9 +1332,9 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ % \begin{macrocode} \cs_new_protected_nopar:Npn \@@_check_num_range:nnNN #1#2#3#4 { - \bool_if:nTF { \@@_if_blank_x_p:n {#1} || \@@_if_blank_x_p:n {#2} } + \bool_if:nTF { \xeCJK_if_blank_x_p:n {#1} || \xeCJK_if_blank_x_p:n {#2} } { - \int_set:Nn #3 { \@@_if_blank_x:nTF {#1} {#2} {#1} } + \int_set:Nn #3 { \xeCJK_if_blank_x:nTF {#1} {#2} {#1} } \int_set_eq:NN #3 #4 } { @@ -1350,16 +1363,17 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ } \@@_declare_char_class:nn { FullRight } { - "00B7 , "2019 , "201D , "2014 , "2025 , "2026 , "2030 , "2500 , "3001 , - "3002 , "3005 , "3006 , "3009 , "300B , "300D , "300F , "3011 , "3015 , - "3017 , "3019 , "301B , "301E , "301F , "3041 , "3043 , "3045 , "3047 , - "3049 , "3063 , "3083 , "3085 , "3087 , "308E , "309B , "309C , "309D , - "309E , "30A1 , "30A3 , "30A5 , "30A7 , "30A9 , "30C3 , "30E3 , "30E5 , - "30E7 , "30EE , "30F5 , "30F6 , "30FB , "30FC , "30FD , "30FE , "FE50 , - "FE51 , "FE52 , "FE54 , "FE55 , "FE56 , "FE57 , "FE5A , "FE5C , "FE5E , - "FE6A , "FF01 , "FF05 , "FF09 , "FF0C , "FF0E , "FF1A , "FF1B , "FF1F , - "FF3D , "FF5D , "FF61 , "FF63 , "FF64 , "FF65 , "FF67 , "FF68 , "FF69 , - "FF6A , "FF6B , "FF6C , "FF6D , "FF6E , "FF6F , "FF70 , "FF9E , "FF9F , + "00B7 , "2019 , "201D , "2014 , "2015 , "2025 , "2026 , "2030 , "2500 , + "3001 , "3002 , "3005 , "3006 , "3009 , "300B , "300D , "300F , "3011 , + "3015 , "3017 , "3019 , "301B , "301E , "301F , "3041 , "3043 , "3045 , + "3047 , "3049 , "3063 , "3083 , "3085 , "3087 , "308E , "309B , "309C , + "309D , "309E , "30A1 , "30A3 , "30A5 , "30A7 , "30A9 , "30C3 , "30E3 , + "30E5 , "30E7 , "30EE , "30F5 , "30F6 , "30FB , "30FC , "30FD , "30FE , + "FE50 , "FE51 , "FE52 , "FE54 , "FE55 , "FE56 , "FE57 , "FE5A , "FE5C , + "FE5E , "FE6A , "FF01 , "FF05 , "FF09 , "FF0C , "FF0E , "FF1A , "FF1B , + "FF1F , "FF3D , "FF5D , "FF61 , "FF63 , "FF64 , "FF65 , "FF67 , "FF68 , + "FF69 , "FF6A , "FF6B , "FF6C , "FF6D , "FF6E , "FF6F , "FF70 , "FF9E , + "FF9F , } } % \end{macrocode} @@ -1682,7 +1696,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ } \@@_app_inter_class_toks:nnn {#1} { CJK } { \CJKsymbol } \clist_map_inline:nn { FullLeft, FullRight } - { \@@_app_inter_class_toks:nnc {#1} {##1} { @@_CJK_and_##1:N } } + { \@@_app_inter_class_toks:nnc {#1} {##1} { xeCJK_CJK_and_##1:N } } } % \end{macrocode} % @@ -1701,12 +1715,12 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ { \tex_unskip:D \bool_if:nTF - { \@@_if_last_node_p:n { CJK } || \@@_if_last_node_p:n { CJK_space } } + { \xeCJK_if_last_node_p:n { CJK } || \xeCJK_if_last_node_p:n { CJK_space } } { \CJKecglue } { \c_space_token } } { - \@@_if_last_node:nTF { CJK } { \CJKecglue } - { \@@_if_last_node:nT { CJK_space } { \@@_space_or_xecglue: } } + \xeCJK_if_last_node:nTF { CJK } { \CJKecglue } + { \xeCJK_if_last_node:nT { CJK_space } { \@@_space_or_xecglue: } } } } \str_if_eq_x:nnF {#1} { NormalSpace } @@ -1721,8 +1735,8 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ \@@_inter_class_toks:nnn {#1} { Boundary } { \peek_catcode:NTF \c_space_token - { { \@@_make_node:n { default_space } } } - { { \@@_make_node:n { default } } } + { { \xeCJK_make_node:n { default_space } } } + { { \xeCJK_make_node:n { default } } } } \str_if_eq_x:nnF {#1} { NormalSpace } { \@@_pre_inter_class_toks:nnn {#1} { CJK } { \CJKecglue } } @@ -1731,12 +1745,12 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ % % \hypertarget{bound-cjk}{} % \begin{macrocode} -\@@_inter_class_toks:nnn { Boundary } { CJK } { \@@_Boundary_and_CJK: } +\@@_inter_class_toks:nnn { Boundary } { CJK } { \xeCJK_Boundary_and_CJK: } % \end{macrocode} % -% \begin{macro}[internal]{\@@_Boundary_and_CJK:,\@@_check_for_glue:} +% \begin{macro}[internal]{\xeCJK_Boundary_and_CJK:,\@@_check_for_glue:} % \begin{macrocode} -\cs_new_protected_nopar:Npn \@@_Boundary_and_CJK: +\cs_new_protected_nopar:Npn \xeCJK_Boundary_and_CJK: { { \@@_check_for_glue: } \c_group_begin_token @@ -1747,14 +1761,14 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ \cs_new_protected_nopar:Npn \@@_check_for_glue: { \bool_if:nTF - { \@@_if_last_node_p:n { CJK } || \@@_if_last_node_p:n { CJK_space } } + { \xeCJK_if_last_node_p:n { CJK } || \xeCJK_if_last_node_p:n { CJK_space } } { \CJKglue } { \bool_if:nTF { - \@@_if_last_node_p:n { default } || + \xeCJK_if_last_node_p:n { default } || \int_compare_p:nNn \etex_lastnodetype:D = \c_ten || - \@@_if_last_node_p:n { default_itcorr } + \xeCJK_if_last_node_p:n { default_itcorr } } { \CJKecglue } { @@ -1769,17 +1783,17 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ \tex_unskip:D \bool_if:nTF { - \@@_if_last_node_p:n { default_space } || + \xeCJK_if_last_node_p:n { default_space } || \int_compare_p:nNn \etex_lastnodetype:D = \c_ten || - \@@_if_last_node_p:n { default } || - \@@_if_last_node_p:n { default_itcorr } + \xeCJK_if_last_node_p:n { default } || + \xeCJK_if_last_node_p:n { default_itcorr } } { \CJKecglue } { \bool_if:nTF { - \@@_if_last_node_p:n { CJK } || - \@@_if_last_node_p:n { CJK_space } + \xeCJK_if_last_node_p:n { CJK } || + \xeCJK_if_last_node_p:n { CJK_space } } { \bool_if:NTF \l_@@_space_bool \c_space_token \CJKglue } { \c_space_token } @@ -1802,19 +1816,19 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ \@@_inter_class_toks:nnn { CJK } { Boundary } { \c_group_end_token - { \@@_make_node:n { CJK } } - \@@_ignorespaces: + { \xeCJK_make_node:n { CJK } } + \xeCJK_ignorespaces: } % \end{macrocode} % % \hypertarget{cjk-cjk}{} % \begin{macrocode} -\@@_inter_class_toks:nnn { CJK } { CJK } { \@@_CJK_and_CJK:N } +\@@_inter_class_toks:nnn { CJK } { CJK } { \xeCJK_CJK_and_CJK:N } % \end{macrocode} % -% \begin{macro}[internal]{\@@_CJK_and_CJK:N} +% \begin{macro}[internal]{\xeCJK_CJK_and_CJK:N} % \begin{macrocode} -\cs_new_protected_nopar:Npn \@@_CJK_and_CJK:N #1 { \CJKglue \CJKsymbol {#1} } +\cs_new_protected_nopar:Npn \xeCJK_CJK_and_CJK:N #1 { \CJKglue \CJKsymbol {#1} } % \end{macrocode} % \end{macro} % @@ -1827,7 +1841,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ \c_group_begin_token \@@_clear_CJK_toks: \xeCJK_select_font: - \use:c { @@_CJK_and_#1:N } + \use:c { xeCJK_CJK_and_#1:N } } \@@_inter_class_toks:nnn {#1} { CJK } { \CJKsymbol } \@@_inter_class_toks:nnn {#1} { Boundary } { \c_group_end_token \tex_ignorespaces:D } @@ -1840,8 +1854,8 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ \bool_if:nF { \str_if_eq_x_p:nn {#1} { FullLeft } || \str_if_eq_x_p:nn {#1} { FullRight } } { - \@@_pre_inter_class_toks:nnn { FullLeft } {#1} { \@@_no_break: } - \@@_pre_inter_class_toks:nnn { FullRight } {#1} { \@@_after_FullRight: } + \@@_pre_inter_class_toks:nnn { FullLeft } {#1} { \xeCJK_no_break: } + \@@_pre_inter_class_toks:nnn { FullRight } {#1} { \xeCJK_after_FullRight: } } } % \end{macrocode} @@ -1851,7 +1865,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ \clist_map_inline:nn { CJK, FullLeft, FullRight } { \clist_map_inline:nn { FullLeft, FullRight } - { \@@_inter_class_toks:nnc {#1} {##1} { @@_#1_and_##1:N } } + { \@@_inter_class_toks:nnc {#1} {##1} { xeCJK_#1_and_##1:N } } } % \end{macrocode} % @@ -1897,9 +1911,9 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ % \end{macrocode} % \end{macro} % -% \begin{macro}[internal]{\@@_before_FullLeft:N} +% \begin{macro}[internal]{\xeCJK_before_FullLeft:N} % \begin{macrocode} -\cs_new_protected_nopar:Npn \@@_before_FullLeft:N #1 +\cs_new_protected_nopar:Npn \xeCJK_before_FullLeft:N #1 { \tl_set:Nx \l_@@_lastpunct_tl {#1} \@@_punct_rule:n { l/#1 } @@ -1908,46 +1922,46 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ % \end{macrocode} % \end{macro} % -% \begin{macro}[internal]{\@@_after_FullRight:} +% \begin{macro}[internal]{\xeCJK_after_FullRight:} % \begin{macrocode} -\cs_new_protected_nopar:Npn \@@_after_FullRight: +\cs_new_protected_nopar:Npn \xeCJK_after_FullRight: { - \@@_get_punct_bounds:nV { r } \l_@@_lastpunct_tl + \xeCJK_get_punct_bounds:nV { r } \l_@@_lastpunct_tl \@@_punct_rule:n { r/\l_@@_lastpunct_tl } \@@_punct_glue:n { r/\l_@@_lastpunct_tl } } % \end{macrocode} % \end{macro} % -% \begin{macro}[internal]{\@@_CJK_and_FullLeft:N} +% \begin{macro}[internal]{\xeCJK_CJK_and_FullLeft:N} % \begin{macrocode} -\cs_new_protected_nopar:Npn \@@_CJK_and_FullLeft:N #1 +\cs_new_protected_nopar:Npn \xeCJK_CJK_and_FullLeft:N #1 { - \@@_get_punct_bounds:nN { l } {#1} + \xeCJK_get_punct_bounds:nN { l } {#1} \int_compare:nNnF \etex_lastnodetype:D = \c_one { \@@_punct_glue:n { l/#1 } } - \@@_before_FullLeft:N {#1} + \xeCJK_before_FullLeft:N {#1} \@@_punct_if_middle:NT {#1} { - \@@_punct_rule:n { m/#1 } + \@@_punct_rule:n { lr/#1 } \@@_punct_glue:n { l/#1 } } } % \end{macrocode} % \end{macro} % -% \begin{macro}[internal]{\@@_CJK_and_FullRight:N} +% \begin{macro}[internal]{\xeCJK_CJK_and_FullRight:N} % \begin{macrocode} -\cs_new_protected_nopar:Npn \@@_CJK_and_FullRight:N #1 +\cs_new_protected_nopar:Npn \xeCJK_CJK_and_FullRight:N #1 { - \@@_get_punct_bounds:nN { r } {#1} + \xeCJK_get_punct_bounds:nN { r } {#1} \@@_punct_if_long:NTF {#1} \CJKglue { - \@@_no_break: + \xeCJK_no_break: \@@_punct_if_middle:NT {#1} { \@@_punct_glue:n { r/#1 } - \@@_punct_rule:n { m/#1 } + \@@_punct_rule:n { lr/#1 } } } \tl_gset:Nx \l_@@_lastpunct_tl {#1} @@ -1956,66 +1970,66 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ % \end{macrocode} % \end{macro} % -% \begin{macro}[internal]{\@@_FullLeft_and_FullLeft:N} +% \begin{macro}[internal]{\xeCJK_FullLeft_and_FullLeft:N} % \begin{macrocode} -\cs_new_protected_nopar:Npn \@@_FullLeft_and_FullLeft:N #1 +\cs_new_protected_nopar:Npn \xeCJK_FullLeft_and_FullLeft:N #1 { - \@@_no_break: - \@@_get_punct_bounds:nN { l } {#1} - \@@_get_kern:VN \l_@@_lastpunct_tl {#1} + \xeCJK_no_break: + \xeCJK_get_punct_bounds:nN { l } {#1} + \xeCJK_calc_kern:VN \l_@@_lastpunct_tl {#1} \@@_punct_kern:n { \l_@@_lastpunct_tl - #1 } - \@@_before_FullLeft:N {#1} + \xeCJK_before_FullLeft:N {#1} } % \end{macrocode} % \end{macro} % -% \begin{macro}[internal]{\@@_FullLeft_and_FullRight:N} +% \begin{macro}[internal]{\xeCJK_FullLeft_and_FullRight:N} % \begin{macrocode} -\cs_new_protected_nopar:Npn \@@_FullLeft_and_FullRight:N #1 +\cs_new_protected_nopar:Npn \xeCJK_FullLeft_and_FullRight:N #1 { - \@@_no_break: - \@@_get_punct_bounds:nN { r } {#1} - \@@_get_kern:VN \l_@@_lastpunct_tl {#1} + \xeCJK_no_break: + \xeCJK_get_punct_bounds:nN { r } {#1} + \xeCJK_calc_kern:VN \l_@@_lastpunct_tl {#1} \@@_punct_kern:n { \l_@@_lastpunct_tl - #1 } - \@@_no_break: + \xeCJK_no_break: \tl_set:Nx \l_@@_lastpunct_tl {#1} \CJKpunctsymbol {#1} } % \end{macrocode} % \end{macro} % -% \begin{macro}[internal]{\@@_FullRight_and_FullLeft:N} +% \begin{macro}[internal]{\xeCJK_FullRight_and_FullLeft:N} % \begin{macrocode} -\cs_new_protected_nopar:Npn \@@_FullRight_and_FullLeft:N #1 +\cs_new_protected_nopar:Npn \xeCJK_FullRight_and_FullLeft:N #1 { \@@_punct_rule:n { r/\l_@@_lastpunct_tl } - \@@_get_punct_bounds:nN { l } {#1} - \@@_get_kern:VN \l_@@_lastpunct_tl {#1} + \xeCJK_get_punct_bounds:nN { l } {#1} + \xeCJK_calc_kern:VN \l_@@_lastpunct_tl {#1} \@@_punct_kern:n { \l_@@_lastpunct_tl - #1 } \@@_punct_nobreak: - \@@_before_FullLeft:N {#1} + \xeCJK_before_FullLeft:N {#1} } % \end{macrocode} % \end{macro} % -% \begin{macro}[internal]{\@@_FullRight_and_FullRight:N} +% \begin{macro}[internal]{\xeCJK_FullRight_and_FullRight:N} % \begin{macrocode} -\cs_new_protected_nopar:Npn \@@_FullRight_and_FullRight:N #1 +\cs_new_protected_nopar:Npn \xeCJK_FullRight_and_FullRight:N #1 { \@@_punct_rule:n { r/\l_@@_lastpunct_tl } - \@@_get_punct_bounds:nN { r } {#1} - \@@_get_kern:VN \l_@@_lastpunct_tl {#1} + \xeCJK_get_punct_bounds:nN { r } {#1} + \xeCJK_calc_kern:VN \l_@@_lastpunct_tl {#1} \@@_punct_kern:n { \l_@@_lastpunct_tl - #1 } - \@@_no_break: + \xeCJK_no_break: \tl_set:Nx \l_@@_lastpunct_tl {#1} \CJKpunctsymbol {#1} } % \end{macrocode} % \end{macro} % -% \begin{macro}[pTF,internal]{\@@_if_last_node:n} +% \begin{macro}[pTF,internal]{\xeCJK_if_last_node:n} % \begin{macrocode} - \prg_new_conditional:Npnn \@@_if_last_node:n #1 { p , T , F , TF } + \prg_new_conditional:Npnn \xeCJK_if_last_node:n #1 { p , T , F , TF } { \if_dim:w \dim_use:c { c_@@_#1_node_dim } = \tex_lastkern:D \prg_return_true: \else: \prg_return_false: \fi: @@ -2023,32 +2037,33 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ % \end{macrocode} % \end{macro} % -% \begin{macro}[internal]{\@@_def_node:nn,\@@_make_node:n} +% \begin{macro}[internal]{\xeCJK_def_node:nn,\xeCJK_make_node:n} % 用于判断插入的各种 |kern|。 % \begin{macrocode} -\cs_new_protected_nopar:Npn \@@_def_node:nn #1#2 +\cs_new_protected_nopar:Npn \xeCJK_def_node:nn #1#2 { \dim_if_exist:cTF { c_@@_#1_node_dim } { \dim_gset:cn } { \dim_const:cn } { c_@@_#1_node_dim } {#2} } -\cs_new_protected_nopar:Npn \@@_make_node:n #1 +\cs_new_protected_nopar:Npn \xeCJK_make_node:n #1 { \tex_kern:D - \dim_use:c { c_@@_#1_node_dim } \tex_kern:D \dim_use:c { c_@@_#1_node_dim } } -\@@_def_node:nn { CJK } { 11 sp } -\@@_def_node:nn { CJK_space } { 12 sp } -\@@_def_node:nn { default } { 13 sp } -\@@_def_node:nn { default_space } { 14 sp } -\@@_def_node:nn { default_itcorr } { 15 sp } +\xeCJK_def_node:nn { CJK } { 11 sp } +\xeCJK_def_node:nn { CJK_space } { 12 sp } +\xeCJK_def_node:nn { default } { 13 sp } +\xeCJK_def_node:nn { default_space } { 14 sp } +\xeCJK_def_node:nn { default_itcorr } { 15 sp } % \end{macrocode} % \end{macro} % % \begin{macro}{CJKglue} % CJK 文字之间插入的 |glue|。 % \begin{macrocode} -\keys_define:nn { xeCJK / options } { CJKglue .tl_set:N = \CJKglue } +\keys_define:nn { xeCJK / options } + { CJKglue .code:n = { \cs_set_protected:Npn \CJKglue {#1} } } % \end{macrocode} % \end{macro} % @@ -2059,7 +2074,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ { CJKecglue .code:n = { - \cs_set:Npn \CJKecglue {#1} + \cs_set_protected:Npn \CJKecglue {#1} \settowidth \l_@@_ecglue_dim \CJKecglue }, xCJKecglue .choice:, @@ -2076,7 +2091,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ xCJKecglue / unknown .code:n = { \bool_set_true:N \l_@@_xecglue_bool - \cs_set:Npn \CJKecglue {#1} + \cs_set_protected:Npn \CJKecglue {#1} \settowidth \l_@@_ecglue_dim \CJKecglue \cs_set_eq:NN \@@_space_or_xecglue: \CJKecglue }, @@ -2108,12 +2123,12 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ \NewDocumentCommand \CJKspace { } { \bool_set_true:N \l_@@_space_bool - \cs_set_eq:NN \@@_ignorespaces: \@@_peek_math: + \cs_set_eq:NN \xeCJK_ignorespaces: \@@_peek_math: } \NewDocumentCommand \CJKnospace { } { \bool_set_false:N \l_@@_space_bool - \cs_set_eq:NN \@@_ignorespaces: \@@_ignore_spaces: + \cs_set_eq:NN \xeCJK_ignorespaces: \@@_ignore_spaces: } % \end{macrocode} % \end{macro} @@ -2124,21 +2139,21 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ { \peek_catcode:NTF \c_space_token { - \@@_if_last_node:nT { CJK } - { \tex_unkern:D \tex_unkern:D { \@@_make_node:n { CJK_space } } } - \@@_peek_catcode_ignore_spaces:NTF \c_math_toggle_token + \xeCJK_if_last_node:nT { CJK } + { \tex_unkern:D \tex_unkern:D { \xeCJK_make_node:n { CJK_space } } } + \xeCJK_peek_catcode_ignore_spaces:NTF \c_math_toggle_token { \@@_space_or_xecglue: } { \bool_if:nT { - \@@_if_outer_macro_p:c { l_peek_token } || + \xeCJK_if_outer_macro_p:c { l_peek_token } || \token_if_cs_p:c { l_peek_token } } { \@@_space_or_xecglue: } } } { - \@@_if_outer_macro:cF { l_peek_token } + \xeCJK_if_outer_macro:cF { l_peek_token } { \token_if_math_toggle:cTF { l_peek_token } \CJKecglue { \cs_if_exist:cF { l_peek_token } \exp_not:N } @@ -2149,13 +2164,13 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ { \peek_catcode:NTF \c_space_token { - \@@_if_last_node:nT { CJK } - { \tex_unkern:D \tex_unkern:D { \@@_make_node:n { CJK_space } } } - \@@_peek_catcode_ignore_spaces:NF \c_space_token + \xeCJK_if_last_node:nT { CJK } + { \tex_unkern:D \tex_unkern:D { \xeCJK_make_node:n { CJK_space } } } + \xeCJK_peek_catcode_ignore_spaces:NF \c_space_token { \@@_space_or_xecglue: } } { - \@@_if_outer_macro:cF { l_peek_token } + \xeCJK_if_outer_macro:cF { l_peek_token } { \token_if_math_toggle:cTF { l_peek_token } \CJKecglue { \cs_if_exist:cF { l_peek_token } \exp_not:N } @@ -2190,8 +2205,8 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ \bool_if:NF \l_@@_checksingle_bool { \bool_set_true:N \l_@@_checksingle_bool - \cs_set_eq:NN \@@_checksingle_save_CJKsymbol:N \@@_CJK_and_CJK:N - \cs_set_eq:NN \@@_CJK_and_CJK:N \@@_checksingle:N + \cs_set_eq:NN \@@_checksingle_save_CJKsymbol:N \xeCJK_CJK_and_CJK:N + \cs_set_eq:NN \xeCJK_CJK_and_CJK:N \xeCJK_checksingle:N } } \NewDocumentCommand \xeCJKdisablechecksingle { } @@ -2199,38 +2214,38 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ \bool_if:NT \l_@@_checksingle_bool { \bool_set_false:N \l_@@_checksingle_bool - \cs_set_eq:NN \@@_CJK_and_CJK:N \@@_checksingle_save_CJKsymbol:N + \cs_set_eq:NN \xeCJK_CJK_and_CJK:N \@@_checksingle_save_CJKsymbol:N } } % \end{macrocode} % \end{macro} % -% \begin{macro}[internal]{\@@_checksingle:N,\@@_checksingle:NN,\@@_checksingle:NNN} +% \begin{macro}[internal]{\xeCJK_checksingle:N,\xeCJK_checksingle:NN,\xeCJK_checksingle:NNN} % \begin{macrocode} -\cs_new_protected_nopar:Npn \@@_checksingle:N #1 +\cs_new_protected_nopar:Npn \xeCJK_checksingle:N #1 { \peek_catcode:NTF \c_catcode_other_token - { \@@_checksingle:NN {#1} } + { \xeCJK_checksingle:NN {#1} } { \bool_if:nTF { - ! ( \@@_if_outer_macro_p:c { l_peek_token } ) && - \@@_if_blank_x_p:n { \token_get_arg_spec:c { l_peek_token } } && + ! ( \xeCJK_if_outer_macro_p:c { l_peek_token } ) && + \xeCJK_if_blank_x_p:n { \token_get_arg_spec:c { l_peek_token } } && \exp_args:NNc \exp_args:No \tl_if_single_token_p:n { l_peek_token } && \exp_args:NNc \exp_after:wN \token_if_other_p:N { l_peek_token } } - { \@@_checksingle:NN {#1} } + { \xeCJK_checksingle:NN {#1} } { \@@_checksingle_save_CJKsymbol:N {#1} } } } -\cs_new_protected_nopar:Npn \@@_checksingle:NN #1#2 +\cs_new_protected_nopar:Npn \xeCJK_checksingle:NN #1#2 { \peek_catcode:NTF \c_catcode_other_token { \@@_checksingle_save_CJKsymbol:N {#1} #2 } { \bool_if:nTF { - ! ( \@@_if_outer_macro_p:c { l_peek_token } ) && + ! ( \xeCJK_if_outer_macro_p:c { l_peek_token } ) && ( \token_if_space_p:c { l_peek_token } || \token_if_math_toggle_p:c { l_peek_token } || \token_if_cs_p:c { l_peek_token } ) @@ -2238,62 +2253,62 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ { \bool_if:nTF { \token_if_space_p:c { l_peek_token } } { - \@@_peek_catcode_ignore_spaces:NTF \c_catcode_other_token + \xeCJK_peek_catcode_ignore_spaces:NTF \c_catcode_other_token { \@@_checksingle_save_CJKsymbol:N {#1} #2 \c_space_token } { \bool_if:nTF { - ! ( \@@_if_outer_macro_p:c { l_peek_token } ) && + ! ( \xeCJK_if_outer_macro_p:c { l_peek_token } ) && ( \token_if_math_toggle_p:c { l_peek_token } || \token_if_cs_p:c { l_peek_token } ) } - { \@@_checksingle:NNN {#1} {#2} \c_space_token } + { \xeCJK_checksingle:NNN {#1} {#2} \c_space_token } { \@@_checksingle_save_CJKsymbol:N {#1} #2 \c_space_token } } } - { \@@_checksingle:NNN {#1} {#2} { } } + { \xeCJK_checksingle:NNN {#1} {#2} { } } } { \@@_checksingle_save_CJKsymbol:N {#1} #2 } } } -\cs_new_protected_nopar:Npn \@@_checksingle:NNN #1#2#3 +\cs_new_protected_nopar:Npn \xeCJK_checksingle:NNN #1#2#3 { \bool_if:nTF { \token_if_eq_meaning_p:NN \l_peek_token \par || \token_if_eq_meaning_p:NN \l_peek_token \[ % \] } - { \CJKsymbol {#1} \@@_no_break: #2 } - { \@@_checksingle_env:NNN {#1} {#2} {#3} } + { \CJKsymbol {#1} \xeCJK_no_break: #2 } + { \xeCJK_checksingle_env:NNN {#1} {#2} {#3} } } % \end{macrocode} % \end{macro} % -% \begin{macro}[internal]{\@@_checksingle_env:NNN,\@@_checksingle_env:NNNNn} +% \begin{macro}[internal]{\xeCJK_checksingle_env:NNN,\xeCJK_checksingle_env:NNNNn} % \begin{macrocode} -\cs_new_protected_nopar:Npn \@@_checksingle_env:NNN #1#2#3 +\cs_new_protected_nopar:Npn \xeCJK_checksingle_env:NNN #1#2#3 { \peek_catcode_remove:NTF \c_math_toggle_token { \peek_catcode:NTF \c_math_toggle_token - { \CJKsymbol {#1} \@@_no_break: #2 \c_math_toggle_token } + { \CJKsymbol {#1} \xeCJK_no_break: #2 \c_math_toggle_token } { \@@_checksingle_save_CJKsymbol:N {#1} #2#3 \c_math_toggle_token } } { \peek_meaning_remove:NTF \begin - { \@@_checksingle_env:NNNNn {#1} {#2} {#3} \begin } + { \xeCJK_checksingle_env:NNNNn {#1} {#2} {#3} \begin } { \peek_meaning_remove:NTF \end - { \@@_checksingle_env:NNNNn {#1} {#2} {#3} \end } + { \xeCJK_checksingle_env:NNNNn {#1} {#2} {#3} \end } { \@@_checksingle_save_CJKsymbol:N {#1} #2#3 } } } } -\cs_new_protected_nopar:Npn \@@_checksingle_env:NNNNn #1#2#3#4#5 +\cs_new_protected_nopar:Npn \xeCJK_checksingle_env:NNNNn #1#2#3#4#5 { \clist_if_in:NnTF \g_@@_inline_env_clist {#5} { \@@_checksingle_save_CJKsymbol:N {#1} #2#3 } - { \CJKsymbol {#1} \@@_no_break: #2 } + { \CJKsymbol {#1} \xeCJK_no_break: #2 } \scan_stop: #4 {#5} } % \end{macrocode} @@ -2482,7 +2497,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ \@@_inter_class_toks:nnn { Boundary } { #1/#2 } { \@@_erase_CJKsymbol: - \@@_Boundary_and_CJK: + \xeCJK_Boundary_and_CJK: \@@_switch_font:nn {#1} {#2} \@@_restore_CJKsymbol: } @@ -2517,8 +2532,8 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ { PunctStyle .choice_code:n = { - \tl_set:Nx \l_@@_punctstyle_tl { \l_keys_choice_tl } - \tl_if_eq:NNT \l_@@_punctstyle_tl \c_@@_ps_plain_tl + \tl_set:Nx \l_xeCJK_punctstyle_tl { \l_keys_choice_tl } + \tl_if_eq:NNT \l_xeCJK_punctstyle_tl \c_@@_ps_plain_tl { \xeCJKallowbreakbetweenpuncts } }, } @@ -2571,7 +2586,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ \NewDocumentCommand \xeCJKallowbreakbetweenpuncts { } { \cs_set_eq:NN \@@_punct_nobreak: \@@_zero_glue: } \NewDocumentCommand \xeCJKnobreakbetweenpuncts { } - { \cs_set_eq:NN \@@_punct_nobreak: \@@_no_break: } + { \cs_set_eq:NN \@@_punct_nobreak: \xeCJK_no_break: } \cs_new_protected_nopar:Npn \@@_zero_glue: { \skip_horizontal:N \c_zero_skip } % \end{macrocode} % \end{macro} @@ -2619,11 +2634,11 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ % \end{macrocode} % \end{macro} % -% \begin{macro}[internal]{\@@_dim_set_max:Nn,\@@_dim_set_min:Nn} +% \begin{macro}[internal]{\xeCJK_dim_set_max:Nn,\xeCJK_dim_set_min:Nn} % \begin{macrocode} -\cs_new_protected_nopar:Npn \@@_dim_set_max:Nn #1#2 +\cs_new_protected_nopar:Npn \xeCJK_dim_set_max:Nn #1#2 { \dim_set:Nn #1 { \dim_max:nn {#1} {#2} } } -\cs_new_protected_nopar:Npn \@@_dim_set_min:Nn #1#2 +\cs_new_protected_nopar:Npn \xeCJK_dim_set_min:Nn #1#2 { \dim_set:Nn #1 { \dim_min:nn {#1} {#2} } } % \end{macrocode} % \end{macro} @@ -2631,28 +2646,31 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ % \begin{macro}[internal,var]{\l_@@_punct_coor_tl} % 记录当前字体状态下的标点处理方式。 % \begin{macrocode} -\tl_set:Nn \l_@@_punct_coor_tl { \l_@@_font_coor_tl/\l_@@_punctstyle_tl } +\tl_set:Nn \l_@@_punct_coor_tl { \l_xeCJK_font_coor_tl/\l_xeCJK_punctstyle_tl } % \end{macrocode} % \end{macro} % -% \begin{macro}[internal]{\@@_get_punct_bounds:nN} +% \begin{macro}[internal]{\xeCJK_get_punct_bounds:nN} % |#1| 为 |l/r|,|#2| 为标点字符,返回标点的实际左/右空白的负值和根据标点处理方式 % 决定添加的左/右空白。全角方式直接添加标点的实际左/右空白;半角方式添加标点左右空白 % 中的最小值;开明方式与半角相同,只在开明标点再增加实际左/右空白的一半。 % \begin{macrocode} -\cs_new_protected_nopar:Npn \@@_get_punct_bounds:nN #1#2 +\cs_new_protected_nopar:Npn \xeCJK_get_punct_bounds:nN #1#2 { \tl_if_exist:cF { \l_@@_punct_coor_tl/rule/#1/#2 } { - \tl_if_eq:NNTF \l_@@_punctstyle_tl \c_@@_ps_plain_tl + \tl_if_eq:NNTF \l_xeCJK_punctstyle_tl \c_@@_ps_plain_tl { - \clist_map_inline:nn { glue , rule , bound } - { \tl_gset:cV { \l_@@_punct_coor_tl/##1/#1/#2 } \c_zero_dim } - \tl_gset:cV { \l_@@_punct_coor_tl/rule/m/#2 } \c_zero_dim + \tl_set:NV \l_@@_tmpa_tl \c_zero_dim + \tl_gset_eq:cN { \l_@@_punct_coor_tl/glue/#1/#2 } \l_@@_tmpa_tl + \tl_gset_eq:cN { \l_@@_punct_coor_tl/rule/#1/#2 } \l_@@_tmpa_tl + \tl_gset_eq:cN { \l_@@_punct_coor_tl/rule/lr/#2 } \l_@@_tmpa_tl + \tl_gset_eq:cN { \l_@@_punct_coor_tl/bound/#1/#2 } \l_@@_tmpa_tl + \tl_gset_eq:cN { \l_@@_punct_coor_tl/bound/lr/#2 } \l_@@_tmpa_tl } { \tl_if_exist:cF { \l_@@_punct_coor_tl/bound/#1/#2 } - { { \xeCJK_select_font: \@@_get_punct_dimen:N {#2} } } + { { \xeCJK_select_font: \xeCJK_calc_punct_dimen:N {#2} } } \@@_punct_if_long:NTF {#2} { \dim_zero:N \l_@@_tmpa_dim @@ -2667,9 +2685,8 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ { \cs_if_exist_use:cF { g_@@_punct_width/#2 } { - \@@_if_blank_x:nTF \g_@@_punct_width_tl - { \c_zero_dim } - { \g_@@_punct_width_tl } + \xeCJK_if_blank_x:nTF \g_@@_punct_width_tl + { \c_zero_dim } { \g_@@_punct_width_tl } } } \@@_punct_if_middle:NTF {#2} @@ -2679,7 +2696,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ \dim_compare:nNnTF \l_@@_tmpc_dim > \c_zero_dim { \l_@@_tmpc_dim } { - \tl_case:Nnn \l_@@_punctstyle_tl + \tl_case:Nnn \l_xeCJK_punctstyle_tl { \c_@@_ps_halfwidth_tl { .5 em } \c_@@_ps_mixedwidth_tl { .5 em } @@ -2688,9 +2705,14 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ } { 1 em } } - - \tl_use:c { \l_@@_punct_coor_tl/dimen/#2 } + - ( \tl_use:c { \l_@@_punct_coor_tl/dimen/#2 } ) + } + \dim_compare:nNnTF \l_@@_tmpc_dim > \c_zero_dim + { \dim_set:Nn \l_@@_tmpc_dim { .5 \l_@@_tmpc_dim } } + { + \dim_set:Nn \l_@@_tmpc_dim + { \dim_min:nn \l_@@_tmpa_dim \l_@@_tmpb_dim } } - \dim_set:Nn \l_@@_tmpc_dim { .5 \l_@@_tmpc_dim } } { \dim_compare:nNnTF \l_@@_tmpc_dim > \c_zero_dim @@ -2698,13 +2720,13 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ \dim_set:Nn \l_@@_tmpc_dim { \l_@@_tmpc_dim - \l_@@_tmpb_dim - - \tl_use:c { \l_@@_punct_coor_tl/dimen/#2 } + - ( \tl_use:c { \l_@@_punct_coor_tl/dimen/#2 } ) } } { \dim_set:Nn \l_@@_tmpc_dim { \dim_min:nn \l_@@_tmpa_dim \l_@@_tmpb_dim } - \tl_case:Nnn \l_@@_punctstyle_tl + \tl_case:Nnn \l_xeCJK_punctstyle_tl { \c_@@_ps_halfwidth_tl { \prg_do_nothing: } \c_@@_ps_mixedwidth_tl @@ -2712,7 +2734,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ \@@_punct_if_mixedwidth:NT {#2} { \dim_add:Nn \l_@@_tmpc_dim { .5 \l_@@_tmpa_dim } - \@@_dim_set_min:Nn \l_@@_tmpc_dim \l_@@_tmpa_dim + \xeCJK_dim_set_min:Nn \l_@@_tmpc_dim \l_@@_tmpa_dim } } \c_@@_ps_CCT_tl @@ -2720,23 +2742,23 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ \@@_punct_if_mixedwidth:NTF {#2} { \dim_add:Nn \l_@@_tmpc_dim { .5 \l_@@_tmpa_dim } } { \dim_add:Nn \l_@@_tmpc_dim { .3 \l_@@_tmpa_dim } } - \@@_dim_set_min:Nn \l_@@_tmpc_dim \l_@@_tmpa_dim + \xeCJK_dim_set_min:Nn \l_@@_tmpc_dim \l_@@_tmpa_dim } } { \dim_set_eq:NN \l_@@_tmpc_dim \l_@@_tmpa_dim } } } - \@@_dim_set_max:Nn \l_@@_tmpc_dim \c_zero_dim + \xeCJK_dim_set_max:Nn \l_@@_tmpc_dim \c_zero_dim } \tl_gset:cx { \l_@@_punct_coor_tl/rule/#1/#2 } { - \dim_use:N \l_@@_tmpa_dim } - \tl_gset:cx { \l_@@_punct_coor_tl/rule/m/#2 } + \tl_gset:cx { \l_@@_punct_coor_tl/rule/lr/#2 } { - \dim_use:N \l_@@_tmpb_dim } \tl_gset:cV { \l_@@_punct_coor_tl/glue/#1/#2 } \l_@@_tmpc_dim } } } -\cs_generate_variant:Nn \@@_get_punct_bounds:nN { nV } +\cs_generate_variant:Nn \xeCJK_get_punct_bounds:nN { nV } % \end{macrocode} % \end{macro} % @@ -2780,72 +2802,73 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ % \end{macrocode} % \end{macro} % -% \begin{macro}[internal]{\@@_get_kern:NN,\@@_calc_kern:NN} +% \begin{macro}[internal]{\xeCJK_calc_kern:NN,\@@_calc_kern:NNN} % 标点挤压。行末半角方式,相邻标点不挤压;全角方式,相邻两个标点占 1.5 汉字宽度, % 半角、开明和 CCT 方式相邻标点占一个汉字宽度。 % \begin{macrocode} -\cs_new_protected_nopar:Npn \@@_get_kern:NN #1#2 +\cs_new_protected_nopar:Npn \xeCJK_calc_kern:NN #1#2 { \tl_if_exist:cF { \l_@@_punct_coor_tl/kern/#1-#2 } { \dim_zero:N \l_@@_tmpa_dim - \tl_if_eq:NNF \l_@@_punctstyle_tl \c_@@_ps_plain_tl + \tl_if_eq:NNF \l_xeCJK_punctstyle_tl \c_@@_ps_plain_tl { \tl_if_exist:cTF { g_@@_punct/kern/#1-#2 } { \dim_set:Nc \l_@@_tmpa_dim { g_@@_punct/kern/#1-#2 } } - { \@@_calc_kern:NN {#1} {#2} } + { \@@_calc_kern:NNN \l_@@_tmpa_dim {#1} {#2} } } \tl_gset:cV { \l_@@_punct_coor_tl/kern/#1-#2 } \l_@@_tmpa_dim } } -\cs_new_protected_nopar:Npn \@@_calc_kern:NN #1#2 +\cs_new_protected_nopar:Npn \@@_calc_kern:NNN #1#2#3 { - \tl_if_eq:NNTF \l_@@_punctstyle_tl \c_@@_ps_marginkerning_tl + \tl_if_eq:NNTF \l_xeCJK_punctstyle_tl \c_@@_ps_marginkerning_tl { - \@@_punct_if_right:NT {#1} - { \dim_add:Nc \l_@@_tmpa_dim { \l_@@_punct_coor_tl/bound/r/#1 } } - \@@_punct_if_right:NF {#2} - { \dim_add:Nc \l_@@_tmpa_dim { \l_@@_punct_coor_tl/bound/l/#2 } } + \dim_zero:N #1 + \@@_punct_if_right:NT {#2} + { \dim_add:Nc #1 { \l_@@_punct_coor_tl/bound/r/#2 } } + \@@_punct_if_right:NF {#3} + { \dim_add:Nc #1 { \l_@@_punct_coor_tl/bound/l/#3 } } } { - \tl_if_eq:NNTF \l_@@_punctstyle_tl \c_@@_ps_fullwidth_tl - { \@@_calc_kern:NnNN \l_@@_tmpa_dim { 1.5 em } {#1} {#2} } + \tl_if_eq:NNTF \l_xeCJK_punctstyle_tl \c_@@_ps_fullwidth_tl + { \dim_set:Nn #1 { \xeCJK_calc_kern:nNN { 1.5 em } {#2} {#3} } } { - \@@_punct_if_both_left_right:NNTF {#1} {#2} + \@@_punct_if_both_left_right:NNTF {#2} {#3} { - \@@_punct_if_mixedwidth:NT {#1} + \@@_punct_if_mixedwidth:NT {#2} { - \@@_calc_kern:NnNN \l_@@_tmpa_dim { 1 em } {#1} {#2} - \dim_compare:nNnT \l_@@_tmpa_dim < { .1 em } - { \dim_set:Nc \l_@@_tmpa_dim { \l_@@_punct_coor_tl/bound/l/#1 } } + \dim_set:Nn #1 { \xeCJK_calc_kern:nNN { 1 em } {#2} {#3} } + \dim_compare:nNnT #1 < { .1 em } + { \dim_set:Nc #1 { \l_@@_punct_coor_tl/bound/l/#2 } } } } { \bool_if:nTF { - \@@_punct_if_mixedwidth_p:N {#1} && - ! ( \tl_if_eq_p:NN \l_@@_punctstyle_tl \c_@@_ps_halfwidth_tl ) + \@@_punct_if_mixedwidth_p:N {#2} && + ! ( \tl_if_eq_p:NN \l_xeCJK_punctstyle_tl \c_@@_ps_halfwidth_tl ) } { - \dim_set:Nc \l_@@_tmpa_dim { \l_@@_punct_coor_tl/glue/r/#1 } - \dim_set:Nn \l_@@_tmpa_dim { .7 \l_@@_tmpa_dim } + \dim_set:Nn #1 { \tl_use:c { \l_@@_punct_coor_tl/glue/r/#2 } } + \dim_set:Nn #1 { .7 #1 } } { - \@@_calc_kern:NnNN \l_@@_tmpa_dim { 1 em } {#1} {#2} - \dim_compare:nNnT \l_@@_tmpa_dim < { .1 em } + \dim_set:Nn #1 { \xeCJK_calc_kern:nNN { 1 em } {#2} {#3} } + \dim_compare:nNnT #1 < { .1 em } { - \dim_set:Nn \l_@@_tmpa_dim + \dim_set:Nn #1 { \dim_max:nn { \dim_min:cc - { \l_@@_punct_coor_tl/bound/l/#1 } - { \l_@@_punct_coor_tl/bound/r/#1 } + { \l_@@_punct_coor_tl/bound/l/#2 } + { \l_@@_punct_coor_tl/bound/r/#2 } } { \dim_min:cc - { \l_@@_punct_coor_tl/bound/l/#2 } - { \l_@@_punct_coor_tl/bound/r/#2 } + { \l_@@_punct_coor_tl/bound/l/#3 } + { \l_@@_punct_coor_tl/bound/r/#3 } } } } @@ -2853,62 +2876,73 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ } } \bool_if:nT - { \@@_punct_if_long_p:N {#1} || \@@_punct_if_long_p:N {#2} } - { \@@_dim_set_max:Nn \l_@@_tmpa_dim { .1 em } } + { \@@_punct_if_long_p:N {#2} || \@@_punct_if_long_p:N {#3} } + { \xeCJK_dim_set_max:Nn #1 { .1 em } } } - \@@_dim_set_max:Nn \l_@@_tmpa_dim \c_zero_dim + \xeCJK_dim_set_max:Nn #1 \c_zero_dim } -\cs_generate_variant:Nn \@@_get_kern:NN { V } +\cs_generate_variant:Nn \xeCJK_calc_kern:NN { V } % \end{macrocode} % \end{macro} % -% \begin{macro}[internal]{\@@_calc_kern:NnNN} -% |#3| 和 |#4| 为相邻的两个标点,|#2| 为要确定的相邻两个标点总共占的宽度,|#1| 是 -% 尺寸寄存器,用于记录根据所占宽度计算得出的相邻两个标点间距。 +% \begin{macro}[internal]{\xeCJK_calc_kern:nNN} +% |#2| 和 |#3| 为相邻的两个标点,|#1| 为要确定的相邻两个标点总共占的宽度。 % \begin{macrocode} -\cs_new_protected_nopar:Npn \@@_calc_kern:NnNN #1#2#3#4 +\cs_new_protected_nopar:Npn \xeCJK_calc_kern:nNN #1#2#3 { - \dim_set:Nn #1 + \dim_eval:n { - #2 + #1 - \tl_use:c { \l_@@_punct_coor_tl/ - \@@_punct_if_right:NTF {#3} { bound } { glue } /l/#3 } + \@@_punct_if_right:NTF {#2} { bound } { glue } /l/#2 } - \tl_use:c { \l_@@_punct_coor_tl/ - \@@_punct_if_right:NTF {#4} { glue } { bound } /r/#4 } + \@@_punct_if_right:NTF {#3} { glue } { bound } /r/#3 } + - \tl_use:c { \l_@@_punct_coor_tl/dimen/#2 } - \tl_use:c { \l_@@_punct_coor_tl/dimen/#3 } - - \tl_use:c { \l_@@_punct_coor_tl/dimen/#4 } - \@@_punct_if_both_left_right:NNT {#3} {#4} - { + \tl_use:c { \l_@@_punct_coor_tl/rule/m/#4 } } + \@@_punct_if_both_left_right:NNT {#2} {#3} + { + \tl_use:c { \l_@@_punct_coor_tl/rule/lr/#3 } } } } % \end{macrocode} % \end{macro} % -% \begin{macro}[internal]{\@@_get_punct_dimen:N} +% \begin{macro}[internal]{\xeCJK_calc_punct_dimen:N} % 返回标点的左右空白和实际尺寸。对于破折号,计算两标点之间的空白,保证它中间不被断开。 % \begin{macrocode} -\cs_new_protected_nopar:Npn \@@_get_punct_dimen:N #1 +\cs_new_protected_nopar:Npn \xeCJK_calc_punct_dimen:N #1 { - \@@_get_glyph_bounds:nNN { left } {#1} \l_@@_tmpa_dim - \tl_gset:cV { \l_@@_punct_coor_tl/bound/l/#1 } \l_@@_tmpa_dim - \dim_set_eq:NN \l_@@_tmpb_dim \l_@@_tmpa_dim - \@@_get_glyph_bounds:nNN { right } {#1} \l_@@_tmpa_dim - \tl_gset:cV { \l_@@_punct_coor_tl/bound/r/#1 } \l_@@_tmpa_dim - \dim_add:Nn \l_@@_tmpb_dim \l_@@_tmpa_dim + \tl_gset:cx { \l_@@_punct_coor_tl/bound/l/#1 } + { \xeCJK_glyph_bounds:nN { left } {#1} } + \tl_gset:cx { \l_@@_punct_coor_tl/bound/r/#1 } + { \xeCJK_glyph_bounds:nN { right } {#1} } + \tl_gset:cx { \l_@@_punct_coor_tl/bound/lr/#1 } + { + \dim_eval:n + { + ( \tl_use:c { \l_@@_punct_coor_tl/bound/l/#1 } ) + + ( \tl_use:c { \l_@@_punct_coor_tl/bound/r/#1 } ) + } + } \tl_gset:cx { \l_@@_punct_coor_tl/dimen/#1 } - { \dim_eval:n { \etex_fontcharwd:D \tex_font:D `#1 - \l_@@_tmpb_dim } } + { + \dim_eval:n + { + ( \etex_fontcharwd:D \tex_font:D `#1 ) - + ( \tl_use:c { \l_@@_punct_coor_tl/bound/lr/#1 } ) + } + } \bool_if:nT { \@@_punct_if_long_p:N {#1} && - ! ( \str_if_eq_x_p:nn {#1} { … } || \str_if_eq_x_p:nn {#1} { ‥ } ) + ! ( \str_if_eq_x_p:nn {#1} { ^^^^2025 } || \str_if_eq_x_p:nn {#1} { ^^^^2026 } ) } { \clist_map_inline:Nn \g_@@_punctstyle_clist { \str_if_eq_x:nnF \c_@@_ps_plain_tl {##1} { - \tl_gset:cx { \l_@@_font_coor_tl/##1/kern/#1-#1 } - { - \dim_use:N \l_@@_tmpb_dim } + \tl_gset:cx { \l_xeCJK_font_coor_tl/##1/kern/#1-#1 } + { - \tl_use:c { \l_@@_punct_coor_tl/bound/lr/#1 } } } } } @@ -2916,12 +2950,12 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ % \end{macrocode} % \end{macro} % -% \begin{macro}[internal]{\@@_get_glyph_bounds:nNN} -% 用 |\XeTeXglyphbounds| 计算标点的上下左右空白。 +% \begin{macro}[internal]{\xeCJK_glyph_bounds:nN} +% 用 \cs{XeTeXglyphbounds} 计算标点的上下左右空白。 % \begin{macrocode} -\cs_new_protected_nopar:Npn \@@_get_glyph_bounds:nNN #1#2#3 +\cs_new_protected_nopar:Npn \xeCJK_glyph_bounds:nN #1#2 { - \dim_set:Nn #3 + \dim_eval:n { \XeTeXglyphbounds \str_case_x:nnn {#1} @@ -2970,7 +3004,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ { \bool_set_true:N \l_@@_fallback_bool \cs_set_eq:NN \@@_fallback_save_CJKsymbol:N \CJKsymbol - \cs_set_eq:NN \CJKsymbol \@@_fallback_testsymbol:N + \cs_set_eq:NN \CJKsymbol \xeCJK_fallback_testsymbol:N } } \NewDocumentCommand \xeCJKdisablefallback { } @@ -2984,19 +3018,19 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ % \end{macrocode} % \end{macro} % -% \begin{macro}[internal]{\@@_fallback_testsymbol:N} +% \begin{macro}[internal]{\xeCJK_fallback_testsymbol:N} % 测试当前字体中是否存在当前字符,如存在则直接输出,否则启用后备字体。 % \begin{macrocode} -\cs_new_protected_nopar:Npn \@@_fallback_testsymbol:N #1 +\cs_new_protected_nopar:Npn \xeCJK_fallback_testsymbol:N #1 { \font_glyph_if_exist:NnTF \tex_font:D {`#1} { \@@_fallback_save_CJKsymbol:N {#1} } { - \@@_family_if_exist:xTF { \l_xeCJK_family_tl/FallBack } + \xeCJK_family_if_exist:xTF { \l_xeCJK_family_tl/FallBack } { { \tl_put_right:Nn \l_xeCJK_family_tl { /FallBack } \xeCJK_select_font: - \@@_fallback_testsymbol:N {#1} + \xeCJK_fallback_testsymbol:N {#1} } } { \@@_warning:nx { fallback } {#1} @@ -3014,15 +3048,15 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ % \end{macro} % % \begin{macro}{\setCJKfallbackfamilyfont} -% \begin{macro}[aux]{\@@_set_family_fallback:nnn} +% \begin{macro}[internal]{\xeCJK_set_family_fallback:xnn} % \begin{macrocode} \NewDocumentCommand \setCJKfallbackfamilyfont { m O{} m } { \exp_args:Nx \tl_if_in:nnTF {#3} { , } - { \@@_set_family_fallback:nnn {#1} {#2} {#3} } + { \xeCJK_set_family_fallback:xnn {#1} {#2} {#3} } { \xeCJK_set_family:xnn { #1/FallBack } {#2} {#3} } } -\cs_new_protected_nopar:Npn \@@_set_family_fallback:nnn #1#2#3 +\cs_new_protected_nopar:Npn \xeCJK_set_family_fallback:xnn #1#2#3 { \group_begin: \tl_set:Nx \l_@@_family_fb_tl {#1} @@ -3107,11 +3141,11 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ { #1 .code:n = { - \@@_if_blank_x:nTF {##1} + \xeCJK_if_blank_x:nTF {##1} { \bool_set_false:c { l_@@_copy_#1_bool } \bool_set_false:c { l_@@_add_#1_bool } - \tl_put_right:Nx \l_@@_family_tl { /#1 } + \tl_put_right:Nx \l_@@_family_aux_tl { /#1 } } { \clist_put_right:Nx \l_@@_sub_key_clist {#1} @@ -3139,14 +3173,14 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ \exp_args:No \tl_if_head_eq_charcode:nNTF \l_@@_tmpa_tl [ % ] { \exp_after:wN \@@_get_sub_features_aux:n \l_@@_tmpa_tl \c_empty_tl - \@@_if_blank_x:nT \l_@@_sub_fontname_tl + \xeCJK_if_blank_x:nT \l_@@_sub_fontname_tl { \tl_set:Nx \l_@@_sub_fontname_tl \l_@@_tmpa_tl \clist_clear:N \l_@@_sub_fontfeat_clist } } { \tl_set:Nx \l_@@_sub_fontname_tl \l_@@_tmpa_tl } - \@@_if_blank_x:nTF \l_@@_sub_fontname_tl + \xeCJK_if_blank_x:nTF \l_@@_sub_fontname_tl { \tl_set:Nx \l_@@_sub_fontname_tl \l_@@_fontname_tl } { \tl_replace_all:Nnx \l_@@_sub_fontname_tl * \l_@@_fontname_tl } \clist_set:cx { l_@@_#1_fontfeat_clist } \l_@@_sub_fontfeat_clist @@ -3229,12 +3263,12 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ Mono .choice:, Mono / Exspace .code:n = { - \@@_set_monoexspace: + \xeCJK_set_monoexspace: \tl_clear:N \l_@@_monoscale_tl }, Mono / Scale .code:n = { - \@@_set_monoscale: + \xeCJK_set_monoscale: \tl_set:Nx \l_@@_monoscale_tl { Scale = { \fp_use:N \g_@@_monoscale_fp } } } } @@ -3245,6 +3279,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ % \begin{macrocode} \cs_new_protected_nopar:Npn \@@_set_init: { + \cs_set_eq:NN \CJKfamily \use_none:n \tl_clear:N \l_@@_monoscale_tl \int_gincr:N \g_@@_fontspec_int \prop_clear:N \l_@@_add_font_prop @@ -3269,33 +3304,36 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ % \end{macro} % % \begin{macro}[internal]{\xeCJK_set_family:xnn} -% 设置一个 CJK 新字体族,与 |\newfontfamily| 类似,增加 |FallBack| 选项。 +% 设置一个 CJK 新字体族,与 \cs{newfontfamily} 类似,增加 |FallBack| 选项。 % \begin{macrocode} \cs_new_protected_nopar:Npn \xeCJK_set_family:xnn #1#2#3 { \group_begin: \@@_set_init: - \tl_set:Nx \l_@@_family_tl {#1} + \tl_set:Nx \l_@@_family_aux_tl {#1} \clist_set:Nx \l_@@_fontoptions_clist {#2} \tl_set:Nx \l_@@_fontname_tl {#3} \keys_set_known:nxN { xeCJK / features } { \g_@@_default_features_clist, #2 } \l_@@_pass_features_clist \@@_parse_features: \@@_pass_features: - \@@_check_family:V \l_@@_family_tl - \cs_gset_protected_nopar:cpx { @@/family/\l_@@_family_tl } + \@@_check_family:V \l_@@_family_aux_tl + \cs_gset_protected_nopar:cpx { @@/family/\l_@@_family_aux_tl } { + \group_begin: + \exp_not:n { \cs_set_eq:NN \CJKfamily \use_none:n } \exp_not:n { \fontspec_set_family:Nnn \l_@@_fontspec_family_tl } { \l_@@_pass_features_clist } { \l_@@_fontname_tl } \prop_gput:NnV \exp_not:N \g_@@_family_name_prop - { \l_@@_family_tl } \exp_not:N \l_@@_fontspec_family_tl - \cs_gset_protected_nopar:cpx { @@/family/\l_@@_family_tl } + { \l_@@_family_aux_tl } \exp_not:N \l_@@_fontspec_family_tl + \cs_gset_protected_nopar:cpx { @@/family/\l_@@_family_aux_tl } \exp_not:n { { - \exp_not:N \fontencoding { \g_fontspec_encoding_tl } + \exp_not:N \fontencoding { \c_@@_encoding_tl } \exp_not:N \fontfamily { \l_@@_fontspec_family_tl } \exp_not:N \selectfont } } + \group_end: } \@@_save_family_info: \@@_add_sub_block: @@ -3394,7 +3432,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ % \begin{macrocode} \prg_new_conditional:Npnn \@@_if_font_select:n #1 { p, T, F, TF } { - \exp_args:Nc \@@_if_blank_x:nTF { l_@@_fontname_#1_tl } + \exp_args:Nc \xeCJK_if_blank_x:nTF { l_@@_fontname_#1_tl } \prg_return_false: \prg_return_true: } \prg_new_conditional:Npnn \@@_if_it_or_sl:n #1 { p, T, F, TF } @@ -3459,7 +3497,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ % \begin{macrocode} \prg_new_conditional:Npnn \@@_if_map_font_select:n #1 { p, T, F, TF } { - \@@_if_blank_x:nTF { \@@_get_map_font:n {#1} } + \xeCJK_if_blank_x:nTF { \@@_get_map_font:n {#1} } \prg_return_false: \prg_return_true: } % \end{macrocode} @@ -3479,8 +3517,8 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ } \prop_map_inline:Nn \l_@@_add_font_prop { \clist_put_right:Nx \l_@@_pass_features_clist { ##1 = { ##2 } } } - \@@_if_blank_x:nF \l_@@_monoscale_tl - { \clist_put_right:Nx \l_@@_pass_features_clist \l_@@_monoscale_tl } + \xeCJK_if_blank_x:nF \l_@@_monoscale_tl + { \clist_put_left:Nx \l_@@_pass_features_clist \l_@@_monoscale_tl } } % \end{macrocode} % \end{macro} @@ -3504,8 +3542,8 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ \clist_remove_all:Nn \l_@@_fontoptions_clist {##1} \clist_remove_all:Nn \l_@@_fontoptions_clist { ##1 = } } - \prop_gput:NVV \g_@@_family_prop \l_@@_family_tl \l_@@_fontname_tl - \prop_gput:NVV \g_@@_family_options_prop \l_@@_family_tl \l_@@_fontoptions_clist + \prop_gput:NVV \g_@@_family_prop \l_@@_family_aux_tl \l_@@_fontname_tl + \prop_gput:NVV \g_@@_family_options_prop \l_@@_family_aux_tl \l_@@_fontoptions_clist \group_end: } % \end{macrocode} @@ -3518,30 +3556,30 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ \clist_remove_duplicates:N \l_@@_sub_key_clist \clist_map_inline:Nn \l_@@_sub_key_clist { - \tl_set:Nx \l_@@_sub_family_tl { \l_@@_family_tl/##1 } + \tl_set:Nx \l_@@_sub_family_tl { \l_@@_family_aux_tl/##1 } \bool_if:cT { l_@@_copy_##1_bool } { \@@_check_family:V \l_@@_sub_family_tl - \prop_get:NVNT \g_@@_family_prop \l_@@_family_tl \l_@@_tmpa_tl + \prop_get:NVNT \g_@@_family_prop \l_@@_family_aux_tl \l_@@_tmpa_tl { \prop_gput:NVV \g_@@_family_prop \l_@@_sub_family_tl \l_@@_tmpa_tl } - \prop_get:NVNT \g_@@_family_options_prop \l_@@_family_tl \l_@@_tmpa_clist + \prop_get:NVNT \g_@@_family_options_prop \l_@@_family_aux_tl \l_@@_tmpa_clist { \clist_remove_all:Nn \l_@@_tmpa_clist { ##1 = * } \prop_gput:NVV \g_@@_family_options_prop \l_@@_sub_family_tl \l_@@_tmpa_clist } \cs_gset_protected_nopar:cpx { @@/family/\l_@@_sub_family_tl } { - \@@_family_if_exist:xT { \l_@@_family_tl } + \xeCJK_family_if_exist:xT { \l_@@_family_aux_tl } { \prop_get:NnNT \exp_not:N \g_@@_family_name_prop - { \l_@@_family_tl } \exp_not:N \l_@@_tmpa_tl + { \l_@@_family_aux_tl } \exp_not:N \l_@@_tmpa_tl { \prop_gput:NnV \exp_not:N \g_@@_family_name_prop { \l_@@_sub_family_tl } \exp_not:N \l_@@_tmpa_tl \cs_gset_protected_nopar:cpx { @@/family/\l_@@_sub_family_tl } \exp_not:n { { - \exp_not:N \fontencoding { \g_fontspec_encoding_tl } + \exp_not:N \fontencoding { \c_@@_encoding_tl } \exp_not:N \fontfamily { \l_@@_tmpa_tl } \exp_not:N \selectfont } } @@ -3563,7 +3601,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ % \begin{macrocode} \cs_new_protected_nopar:Npn \@@_copy_family:nn #1#2 { - \@@_family_if_exist:xT {#2} + \xeCJK_family_if_exist:xT {#2} { \tl_map_inline:nn { \g_@@_family_prop \g_@@_family_options_prop \g_@@_family_name_prop } @@ -3577,19 +3615,17 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ % % \subsection{字体切换} % -% \begin{macro}[internal]{\l_@@_font_coor_tl,\xeCJK_select_font:,\@@_switch_font:nn} +% \begin{macro}[internal]{\l_xeCJK_font_coor_tl,\xeCJK_select_font:,\@@_switch_font:nn} % 缓存当前字体的原始格式,以加速编译。 % \begin{macrocode} -\tl_set:Nn \l_@@_font_coor_tl { @@/\l_xeCJK_family_tl/\f@series/\f@shape/\f@size } +\tl_set:Nn \l_xeCJK_font_coor_tl { @@/\l_xeCJK_family_tl/\f@series/\f@shape/\f@size } \cs_new_protected_nopar:Npn \xeCJK_select_font: { - \cs_if_exist_use:cF { \l_@@_font_coor_tl } + \cs_if_exist_use:cF { \l_xeCJK_font_coor_tl } { - \tl_set:Nx \l_@@_current_coor_tl \l_@@_font_coor_tl - \@@_family_if_exist:xTF { \l_xeCJK_family_tl } - { \use:c { @@/family/\l_xeCJK_family_tl } } - { \use_none:nnnn } - \exp_last_unbraced:NNV \cs_gset_eq:cN \l_@@_current_coor_tl \tex_font:D + \tl_set:Nx \l_@@_current_coor_tl \l_xeCJK_font_coor_tl + \cs_if_exist_use:cT { @@/family/\l_xeCJK_family_tl } + { \exp_last_unbraced:NNV \cs_gset_eq:cN \l_@@_current_coor_tl \tex_font:D } } } \cs_new_eq:NN \xeCJK@setfont \xeCJK_select_font: @@ -3603,9 +3639,9 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ { \tl_set:Nx \l_@@_tmpa_tl \l_xeCJK_family_tl \tl_put_right:Nx \l_xeCJK_family_tl { /#2 } - \@@_family_if_exist:xF \l_xeCJK_family_tl + \xeCJK_family_if_exist:xF \l_xeCJK_family_tl { - \@@_family_if_exist:xTF { \CJKfamilydefault/#2 } + \xeCJK_family_if_exist:xTF { \CJKfamilydefault/#2 } { \@@_copy_family:xx \l_xeCJK_family_tl { \CJKfamilydefault/#2 } } { \@@_copy_family:xx \l_xeCJK_family_tl \l_@@_tmpa_tl } } @@ -3617,9 +3653,9 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ % \end{macrocode} % \end{macro} % -% \begin{macro}[TF,internal]{\@@_family_if_exist:x} +% \begin{macro}[TF,internal]{\xeCJK_family_if_exist:x} % \begin{macrocode} -\prg_new_protected_conditional:Npnn \@@_family_if_exist:x #1 { T, F, TF } +\prg_new_protected_conditional:Npnn \xeCJK_family_if_exist:x #1 { T, F, TF } { \cs_if_free:cTF { @@/family/#1 } { \prg_return_false: } @@ -3636,23 +3672,59 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ % \begin{macro}{\CJKfamily} % 用于切换 CJK 字体族。 % \begin{macrocode} -\NewDocumentCommand \CJKfamily { m } +\NewDocumentCommand \CJKfamily { t+ t- m } { - \cs_if_exist:cTF { @@/family/#1 } - { \tl_set:Nx \l_xeCJK_family_tl {#1} } + \xeCJK_if_blank_x:nTF {#3} { - \seq_if_in:NxF \g_@@_unknown_family_seq {#1} + \IfBooleanF {#1} { \IfBooleanF {#2} { \use_none:nn } } + \xeCJK_family_if_exist_use:x { \l_xeCJK_family_tl } + } + { + \IfBooleanTF {#2} { \xeCJK_family_if_exist_use:x {#3} } { - \seq_gput_right:Nx \g_@@_unknown_family_seq {#1} - \@@_warning:nx { CJKfamily-Unknown } {#1} + \xeCJK_family_if_exist:xTF {#3} + { + \tl_set:Nx \l_xeCJK_family_tl {#3} + \tl_set_eq:NN \xeCJK@family \l_xeCJK_family_tl + \IfBooleanT {#1} { \use:c { @@/family/#3 } } + } + { \@@_family_unknown_warning:x {#3} } } } \tex_ignorespaces:D } +% \end{macrocode} +% \end{macro} +% +% \begin{macro} +% {\xeCJK_family_if_exist_use:x,\@@_family_unknown_warning:x,\g_@@_unknown_family_seq} +% \begin{macrocode} +\cs_new_protected_nopar:Npn \xeCJK_family_if_exist_use:x #1 + { + \xeCJK_family_if_exist:xTF {#1} + { \use:c { @@/family/#1 } } + { \@@_family_unknown_warning:x {#1} } + } +\cs_new_protected_nopar:Npn \@@_family_unknown_warning:x #1 + { + \seq_if_in:NxF \g_@@_unknown_family_seq {#1} + { + \seq_gput_right:Nx \g_@@_unknown_family_seq {#1} + \@@_warning:nx { CJKfamily-Unknown } {#1} + } + } \seq_new:N \g_@@_unknown_family_seq \@@_msg_new:nn { CJKfamily-Unknown } { - Unknown~CJK~family~'#1'~is~ignored.\\\\ + Unknown~CJK~family~' + \str_case_x:nnn {#1} + { + \CJKrmdefault { \token_to_str:N \CJKrmdefault } + \CJKsfdefault { \token_to_str:N \CJKsfdefault } + \CJKttdefault { \token_to_str:N \CJKttdefault } + } + {#1} + '~is~ignored.\\\\ Try~to~use~ \str_case_x:nnn {#1} { @@ -3673,9 +3745,9 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ { \xeCJK_set_family:xnn {#1} {#2} {#3} } \NewDocumentCommand \newCJKfontfamily { o m O{} m } { - \tl_set:Nx \l_@@_family_tl { \IfNoValueTF {#1} { \cs_to_str:N #2 } {#1} } - \xeCJK_set_family:xnn \l_@@_family_tl {#3} {#4} - \cs_new_protected_nopar:Npx #2 { \exp_not:N \CJKfamily { \l_@@_family_tl } } + \tl_set:Nx \l_@@_family_aux_tl { \IfNoValueTF {#1} { \cs_to_str:N #2 } {#1} } + \xeCJK_set_family:xnn \l_@@_family_aux_tl {#3} {#4} + \cs_new_protected_nopar:Npx #2 { \exp_not:N \CJKfamily { \l_@@_family_aux_tl } } } \int_new:N \g_@@_fontspec_int \int_gdecr:N \g_@@_fontspec_int @@ -3737,7 +3809,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ } \clist_put_left:NV \l_@@_tmpa_clist \l_@@_tmpc_clist \use:x - { \group_end: \exp_not:N \CJKfontspec [ \l_@@_tmpa_clist ] { \l_@@_tmpa_tl } } + { \group_end: \CJKfontspec [ \l_@@_tmpa_clist ] { \l_@@_tmpa_tl } } } { \@@_warning:n { addCJKfontfeature-ignored } } \tex_ignorespaces:D @@ -3772,7 +3844,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ % \end{macrocode} % \end{macro} % -% 补丁 |\normalfont|,|\rmfamily|,|\sffamily| 和 |\ttfamily|,使其同时对 +% 补丁 \cs{normalfont},\cs{rmfamily},\cs{n\sffamily} 和 \cs{ttfamily},使其同时对 % CJK 字体族有效。 % \begin{macrocode} \AtEndOfPackage @@ -3819,7 +3891,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ \@@_check_num_range:nnNN {#1} {#2} \l_@@_tmpa_int \l_@@_tmpb_int \int_set:Nn \l_@@_tmpc_int { \@@_math_type:n {#3} } \int_set:Nn \l_tmpa_int { \use:c { sym #4 } } - \@@_int_until_do:nn { \l_@@_tmpa_int > \l_@@_tmpb_int } + \xeCJK_int_until_do:nn { \l_@@_tmpa_int > \l_@@_tmpb_int } { \XeTeXmathcode \l_@@_tmpa_int = \l_@@_tmpc_int \l_tmpa_int \l_@@_tmpa_int \int_incr:N \l_@@_tmpa_int @@ -3829,22 +3901,22 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ % \end{macrocode} % \end{macro} % -% \begin{macro}[internal]{\@@_set_mathfont:} +% \begin{macro}[internal]{\xeCJK_set_mathfont:} % \begin{macrocode} -\cs_new_protected_nopar:Npn \@@_set_mathfont: +\cs_new_protected_nopar:Npn \xeCJK_set_mathfont: { - \@@_family_if_exist:xTF \c_@@_math_tl + \xeCJK_family_if_exist:xTF \c_@@_math_tl { \tl_set:Nx \l_@@_tmpa_tl \c_@@_math_tl } { - \@@_family_if_exist:xTF \CJKfamilydefault + \xeCJK_family_if_exist:xTF \CJKfamilydefault { \tl_set:Nx \l_@@_tmpa_tl \CJKfamilydefault } { \tl_set_eq:NN \l_@@_tmpa_tl \q_no_value } } \prop_get:NVNT \g_@@_family_name_prop \l_@@_tmpa_tl \l_@@_math_family_tl { - \DeclareSymbolFont \c_@@_math_tl \g_fontspec_encoding_tl + \DeclareSymbolFont \c_@@_math_tl \c_@@_encoding_tl \l_@@_math_family_tl \mddefault \shapedefault - \SetSymbolFont \c_@@_math_tl { bold } \g_fontspec_encoding_tl + \SetSymbolFont \c_@@_math_tl { bold } \c_@@_encoding_tl \l_@@_math_family_tl \bfdefault \shapedefault \clist_map_inline:nn { CJK, FullLeft, FullRight } { @@ -3859,14 +3931,14 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ % \end{macrocode} % \end{macro} % -% 当没有设置 CJK 数学字体时,使用 |\CJKfamilydefault| 作为数学字体。 +% 当没有设置 CJK 数学字体时,使用 \cs{CJKfamilydefault} 作为数学字体。 % \begin{macrocode} \@@_AtEndPreamble:n { \normalfont \prop_if_empty:NTF \g_@@_family_prop { \@@_warning:n { no-CJKfamily } } - { \bool_if:NT \g_@@_math_bool { \@@_set_mathfont: } } + { \bool_if:NT \g_@@_math_bool { \xeCJK_set_mathfont: } } } \@@_msg_new:nn { no-CJKfamily } { @@ -3882,6 +3954,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ % \begin{macro}[internal,var]{\g_@@_monoscale_fp,\g_@@_exspace_dim} % \begin{macrocode} \fp_new:N \g_@@_monoscale_fp +\fp_set_eq:NN \g_@@_monoscale_fp \c_one_fp \dim_new:N \g_@@_exspace_dim % \end{macrocode} % \end{macro} @@ -3891,10 +3964,10 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ \NewDocumentCommand \setCJKmonoscale { } { \CJKflexiblespacing - \@@_set_monoscale: + \xeCJK_set_monoscale: \addCJKfontfeatures { Scale = \fp_use:N \g_@@_monoscale_fp } } -\cs_new_protected_nopar:Npn \@@_set_monoscale: +\cs_new_protected_nopar:Npn \xeCJK_set_monoscale: { \group_begin: \fontfamily \ttdefault \selectfont @@ -3907,13 +3980,16 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ % % \begin{macro}{\setCJKmonoexspace} % \begin{macrocode} -\NewDocumentCommand \setCJKmonoexspace { } { \@@_set_monoexspace: } -\cs_new_protected_nopar:Npn \@@_set_monoexspace: +\NewDocumentCommand \setCJKmonoexspace { } { \xeCJK_set_monoexspace: } +\cs_new_protected_nopar:Npn \xeCJK_set_monoexspace: { \group_begin: \fontfamily \ttdefault \selectfont \dim_gset:Nn \g_@@_exspace_dim - { \c_two \tex_fontdimen:D \c_two \tex_font:D - \f@size \p@ } + { + \c_two \tex_fontdimen:D \c_two \tex_font:D + - \fp_to_dim:n { \g_@@_monoscale_fp * ( \f@size ) } + } \group_end: } % \end{macrocode} @@ -3926,11 +4002,11 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ \bool_if:NF \l_@@_fixed_spacing_bool { \bool_set_true:N \l_@@_fixed_spacing_bool - \tl_set_eq:NN \l_@@_flexible_punctstyle_tl \l_@@_punctstyle_tl + \tl_set_eq:NN \l_@@_flexible_punctstyle_tl \l_xeCJK_punctstyle_tl \bool_set_eq:NN \l_@@_fixed_xecglue_bool \l_@@_xecglue_bool \cs_set_eq:NN \@@_flexible_ecglue: \CJKecglue \cs_set_eq:NN \@@_flexible_cjkglue: \CJKglue - \@@_set_monoexspace: + \xeCJK_set_monoexspace: \xeCJKsetup { PunctStyle = plain , @@ -3948,8 +4024,8 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ \exp_args:Nx \xeCJKsetup { PunctStyle = { \l_@@_flexible_punctstyle_tl } , - CJKglue = { \@@_flexible_cjkglue: } , - CJKecglue = { \@@_flexible_ecglue: } , + CJKglue = { \exp_not:o { \@@_flexible_cjkglue: } } , + CJKecglue = { \exp_not:o { \@@_flexible_ecglue: } } , xCJKecglue = { \bool_if:NTF \l_@@_fixed_xecglue_bool { true } { false } } , } } @@ -3992,19 +4068,19 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ { \msg_redirect_module:nnn { xeCJK } { warning } { info } \msg_redirect_module:nnn { xeCJK } { info } { none } - \@@_if_package_loaded:nF { fontspec } + \xeCJK_if_package_loaded:nF { fontspec } { \PassOptionsToPackage { quiet } { fontspec } } }, silent .code:n = { \msg_redirect_module:nnn { xeCJK } { warning } { none } \msg_redirect_module:nnn { xeCJK } { info } { none } - \@@_if_package_loaded:nF { fontspec } + \xeCJK_if_package_loaded:nF { fontspec } { \PassOptionsToPackage { silent } { fontspec } } }, unknown .code:n = { - \@@_if_package_loaded:nTF { fontspec } + \xeCJK_if_package_loaded:nTF { fontspec } { \@@_error:nx { key-unknown } { \l_keys_key_tl } } { \PassOptionsToPackage { \l_keys_key_tl } { fontspec } } }, @@ -4034,9 +4110,9 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ EmboldenFactor = 4 , SlantFactor = .167 , PunctStyle = quanjiao , - KaiMingPunct = { . 。? ! } , - LongPunct = { — ‥ … ─ } , - MiddlePunct = { · ・ ・ } , + KaiMingPunct = { ^^^^3002 ^^^^ff0e ^^^^ff1f ^^^^ff01 } , + LongPunct = { ^^^^2014 ^^^^2015 ^^^^2500 ^^^^2025 ^^^^2026 } , + MiddlePunct = { ^^^^2014 ^^^^2015 ^^^^2500 ^^^^00b7 ^^^^30fb ^^^^ff65 } , AllowBreakBetweenPuncts = false , } % \end{macrocode} @@ -4054,6 +4130,12 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ \RequirePackage { fontspec } [ 2011/09/13 ] % \end{macrocode} % +% \begin{macro}[internal]{\c_@@_encoding_tl} +% \begin{macrocode} +\tl_const:Nx \c_@@_encoding_tl { \g_fontspec_encoding_tl } +% \end{macrocode} +% \end{macro} +% % \begin{macrocode} \bool_if:NT \g_@@_indent_bool { @@ -4104,11 +4186,11 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ \cs_new_protected_nopar:Npn \@@_fix_itcorr: { \scan_stop: - \@@_if_last_node:nTF { default } + \xeCJK_if_last_node:nTF { default } { \tex_unkern:D \tex_unkern:D \@@_itcorr_aux - { \@@_make_node:n { default_itcorr } } + { \xeCJK_make_node:n { default_itcorr } } } { \@@_itcorr_aux } } @@ -4134,7 +4216,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ % \end{macro} % % \begin{macro}[internal]{\@@_set_others_toks:n,\c_@@_Others_class_int} -% 简单处理与同样使用 |\XeTeXinterchartoks| 机制的宏包的兼容问题。 +% 简单处理与同样使用 \cs{XeTeXinterchartoks} 机制的宏包的兼容问题。 % \begin{macrocode} \@@_AfterEndPreamble:n { @@ -4159,13 +4241,13 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ { \@@_get_inter_class_toks:nn { Default } { Others } } \exp_args:Nnnx \@@_pre_inter_class_toks:nnn { Others } {##1} { \@@_get_inter_class_toks:nn { Others } { Default } } - \@@_if_blank_x:nT + \xeCJK_if_blank_x:nT { \@@_get_inter_class_toks:nn { Others } { Boundary } } { \@@_copy_inter_class_toks:nnnn { Others } { Boundary } { Default } { Boundary } } - \@@_if_blank_x:nT + \xeCJK_if_blank_x:nT { \@@_get_inter_class_toks:nn { Boundary } { Others } } { \@@_copy_inter_class_toks:nnnn @@ -4203,7 +4285,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ \@@_patch:Nnn \tipaencoding { \makexeCJKinactive } { } \cs_set_eq:NN \@@_aux_r \r \cs_set_protected_nopar:Npn \r #1 { { \makexeCJKinactive \@@_aux_r {#1} } } - \@@_if_package_loaded:nT { pifont } + \xeCJK_if_package_loaded:nT { pifont } { \RenewDocumentCommand \Pifont { m } { \makexeCJKinactive \usefont {U} {#1} {m} {n} } @@ -4219,7 +4301,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ { \bool_if:nT { - \@@_if_package_loaded_p:n { hyperref } && + \xeCJK_if_package_loaded_p:n { hyperref } && \tl_if_exist_p:N \pdfstringdefPreHook } { @@ -4236,7 +4318,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ % % 禁止在 \pkg{xeCJK} 宏包后再载入 \pkg{CJK} 宏包。 % \begin{macrocode} -\tl_set:cn { ver@CJK.sty } { 2050/01/01 } +\tl_set:cn { ver@CJK.sty } { 2100/01/01 } % \end{macrocode} % % \begin{macro}[internal]{\xeCJKcaption} @@ -4261,28 +4343,28 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ % \end{macro} % % \begin{macro}[internal] -% {\@@_ULprepunctchar:n, \@@_ULpostpunctchar:n, \@@_ULroutines:} +% {\xeCJK_ULprepunctchar:n, \xeCJK_ULpostpunctchar:n, \xeCJK_ULroutines:} % \begin{macrocode} -\cs_new_protected_nopar:Npn \@@_ULprepunctchar:n #1 +\cs_new_protected_nopar:Npn \xeCJK_ULprepunctchar:n #1 { - { \makexeCJKinactive \CJKpunctsymbol {#1} \@@_no_break: } + { \makexeCJKinactive \CJKpunctsymbol {#1} \xeCJK_no_break: } \tex_ignorespaces:D } -\cs_new_protected_nopar:Npn \@@_ULpostpunctchar:n #1 +\cs_new_protected_nopar:Npn \xeCJK_ULpostpunctchar:n #1 { { \makexeCJKinactive \CJKpunctsymbol {#1} } - \@@_ignorespaces: + \xeCJK_ignorespaces: } -\cs_new_protected_nopar:Npn \@@_ULroutines: +\cs_new_protected_nopar:Npn \xeCJK_ULroutines: { \@@_inter_class_toks:nnn { Default } { CJK } { \CJKecglue \CJKsymbol } \@@_inter_class_toks:nnn { HalfLeft } { CJK } { \CJKsymbol } \@@_inter_class_toks:nnn { HalfRight } { CJK } { \CJKecglue \CJKsymbol } - \@@_inter_class_toks:nnn { Boundary } { CJK } { \@@_Boundary_and_CJK: } + \@@_inter_class_toks:nnn { Boundary } { CJK } { \xeCJK_Boundary_and_CJK: } \clist_map_inline:nn { Default, HalfLeft, HalfRight, Boundary } { - \@@_inter_class_toks:nnn {##1} { FullLeft } { \@@_ULprepunctchar:n } - \@@_inter_class_toks:nnn {##1} { FullRight } { \@@_ULpostpunctchar:n } + \@@_inter_class_toks:nnn {##1} { FullLeft } { \xeCJK_ULprepunctchar:n } + \@@_inter_class_toks:nnn {##1} { FullRight } { \xeCJK_ULpostpunctchar:n } } \@@_UL_subclass_patch_tl } @@ -4302,11 +4384,11 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ \cs_set_protected_nopar:Npn \CJKsymbol #1 { { \xeCJK_select_font: \@@_UL_CJKsymbol {#1} } - { \@@_make_node:n { CJK } } \@@_ignorespaces: + { \xeCJK_make_node:n { CJK } } \xeCJK_ignorespaces: } \cs_set_protected_nopar:Npn \CJKpunctsymbol #1 { { \xeCJK_select_font: \@@_UL_CJKpunctsymbol {#1} } } - \@@_ULroutines: + \xeCJK_ULroutines: } } \cs_if_exist:NT \XeTeX@CJKfntef@hook @@ -4327,9 +4409,9 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ \cs_set_protected_nopar:Npn \Unicode #1#2 { \tex_char:D \int_eval:n { (#1) * \c_two_hundred_fifty_six + (#2) } } \RequirePackage { CJKnumb } - \use:c { @@_enc_\CJK@UnicodeEnc } - \tl_set:Nn \CJK@tenthousand { 万 } - \tl_set:Nn \CJK@hundredmillion { 亿 } + \cs_if_exist_use:cT { @@_enc_\CJK@UnicodeEnc } { } + \tl_set:Nx \CJK@tenthousand { ^^^^4e07 } + \tl_set:Nx \CJK@hundredmillion { ^^^^4ebf } } % \end{macrocode} % diff --git a/Master/texmf-dist/source/xelatex/xecjk/xeCJK.ins b/Master/texmf-dist/source/xelatex/xecjk/xeCJK.ins index eabbbca62fd..ff9493f666f 100644 --- a/Master/texmf-dist/source/xelatex/xecjk/xeCJK.ins +++ b/Master/texmf-dist/source/xelatex/xecjk/xeCJK.ins @@ -6,7 +6,7 @@ %% %% xeCJK.dtx (with options: `batchfile') %% -%% $Id: xeCJK.dtx 357 2012-10-16 18:42:20Z sobenlee $ +%% $Id: xeCJK.dtx 358 2012-10-27 11:52:01Z sobenlee $ %% $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ %% ----------------------------------------------------------------- %% Author: @@ -35,7 +35,7 @@ \askforoverwritefalse \preamble -$Id: xeCJK.dtx 357 2012-10-16 18:42:20Z sobenlee $ +$Id: xeCJK.dtx 358 2012-10-27 11:52:01Z sobenlee $ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ ----------------------------------------------------------------- Author: diff --git a/Master/texmf-dist/tex/xelatex/xecjk/xeCJK.sty b/Master/texmf-dist/tex/xelatex/xecjk/xeCJK.sty index 8edb6922281..c229af4412c 100644 --- a/Master/texmf-dist/tex/xelatex/xecjk/xeCJK.sty +++ b/Master/texmf-dist/tex/xelatex/xecjk/xeCJK.sty @@ -6,7 +6,7 @@ %% %% xeCJK.dtx (with options: `package') %% -%% $Id: xeCJK.dtx 357 2012-10-16 18:42:20Z sobenlee $ +%% $Id: xeCJK.dtx 358 2012-10-27 11:52:01Z sobenlee $ %% $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ %% ----------------------------------------------------------------- %% Author: @@ -31,11 +31,11 @@ %% \NeedsTeXFormat{LaTeX2e} \RequirePackage{expl3} -\GetIdInfo$Id: xeCJK.dtx 357 2012-10-16 18:42:20Z sobenlee $ +\GetIdInfo$Id: xeCJK.dtx 358 2012-10-27 11:52:01Z sobenlee $ {package for typesetting CJK scripts with XeLaTeX} \ProvidesExplPackage {\ExplFileName} - {\ExplFileDate}{3.0.9}{\ExplFileDescription} + {\ExplFileDate}{3.0.10}{\ExplFileDescription} \msg_new:nnn { xeCJK } { Require-XeTeX } { The~xeCJK~package~requires~XeTeX~to~function.\\\\ @@ -77,7 +77,7 @@ \clist_new:N \l__xeCJK_tmpa_clist \clist_new:N \l__xeCJK_tmpb_clist \clist_new:N \l__xeCJK_tmpc_clist -\cs_new_protected_nopar:Npn \__xeCJK_no_break: { \tex_penalty:D \c_ten_thousand } +\cs_new_protected_nopar:Npn \xeCJK_no_break: { \tex_penalty:D \c_ten_thousand } \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 @@ -100,14 +100,14 @@ \tl_to_lowercase:n { \group_end: - \prg_new_conditional:Npnn \__xeCJK_if_outer_macro:c #1 { p , T , F , TF } + \prg_new_conditional:Npnn \xeCJK_if_outer_macro:c #1 { p , T , F , TF } { \exp_last_unbraced:Nf \__xeCJK_if_outer_macro_aux:w { \cs_meaning:c {#1} } OUZER ~ MAYRO ; \q_stop } \cs_new_nopar:Npn \__xeCJK_if_outer_macro_aux:w #1 OUZER ~ MAYRO ; #2 \q_stop { - \if_cs_exist:w c__xeCJK_prefix_ #1 _aux_tl \cs_end: + \if_cs_exist:w c__xeCJK_prefix_#1_aux_tl \cs_end: \prg_return_true: \else: \prg_return_false: \fi: } \tl_new:c { c__xeCJK_prefix_/_aux_tl } @@ -116,7 +116,7 @@ \tl_new:c { c__xeCJK_prefix_/protected/long/_aux_tl } } \token_new:Nn \l__xeCJK_peek_search_token { ? } -\cs_new_protected:Npn \__xeCJK_peek_catcode_ignore_spaces:NTF #1#2#3 +\cs_new_protected:Npn \xeCJK_peek_catcode_ignore_spaces:NTF #1#2#3 { \cs_set_eq:NN \l__xeCJK_peek_search_token #1 \prg_do_nothing: \tl_set:Nn \__xeCJK_peek_true:w { \group_align_safe_end: #2 } @@ -124,10 +124,10 @@ \group_align_safe_begin: \peek_after:Nw \__xeCJK_peek_ignore_spaces_execute_branches: } -\cs_new_protected:Npn \__xeCJK_peek_catcode_ignore_spaces:NT #1#2 - { \__xeCJK_peek_catcode_ignore_spaces:NTF #1 {#2} { } } -\cs_new_protected:Npn \__xeCJK_peek_catcode_ignore_spaces:NF #1#2 - { \__xeCJK_peek_catcode_ignore_spaces:NTF #1 { } {#2} } +\cs_new_protected:Npn \xeCJK_peek_catcode_ignore_spaces:NT #1#2 + { \xeCJK_peek_catcode_ignore_spaces:NTF #1 {#2} { } } +\cs_new_protected:Npn \xeCJK_peek_catcode_ignore_spaces:NF #1#2 + { \xeCJK_peek_catcode_ignore_spaces:NTF #1 { } {#2} } \cs_new_nopar:Npn \__xeCJK_peek_ignore_spaces_execute_branches: { \if_meaning:w \l_peek_token \c_space_token @@ -147,7 +147,7 @@ \exp_after:wN \__xeCJK_peek_false:w \fi: } -\prg_new_conditional:Npnn \__xeCJK_if_blank_x:n #1 { p , T , F , TF } +\prg_new_conditional:Npnn \xeCJK_if_blank_x:n #1 { p , T , F , TF } { \if_int_compare:w \pdftex_strcmp:D { \c_empty_tl } {#1} = \c_zero \prg_return_true: @@ -156,7 +156,7 @@ \prg_return_true: \else: \prg_return_false: \fi: \fi: } -\prg_new_conditional:Npnn \__xeCJK_if_package_loaded:n #1 { p , T , F , TF } +\prg_new_conditional:Npnn \xeCJK_if_package_loaded:n #1 { p , T , F , TF } { \tl_if_exist:cTF { ver@ #1 . \c__xeCJK_pkg_extension_tl } { \prg_return_true: } { \prg_return_false: } @@ -244,14 +244,14 @@ \prop_if_in:NVTF \g__xeCJK_CJK_class_prop \l__xeCJK_tmpc_int { \cs_set_eq:NN \__xeCJK_set_char_catcode:n \char_set_catcode_other:n } { \cs_set_eq:NN \__xeCJK_set_char_catcode:n \use_none:n } - \__xeCJK_int_until_do:nn { \l__xeCJK_tmpa_int > \l__xeCJK_tmpb_int } + \xeCJK_int_until_do:nn { \l__xeCJK_tmpa_int > \l__xeCJK_tmpb_int } { \__xeCJK_set_char_catcode:n { \l__xeCJK_tmpa_int } \XeTeXcharclass \l__xeCJK_tmpa_int = \l__xeCJK_tmpc_int \int_incr:N \l__xeCJK_tmpa_int } } -\cs_new_protected:Npn \__xeCJK_int_until_do:nn #1#2 +\cs_new_protected:Npn \xeCJK_int_until_do:nn #1#2 { \__xeCJK_int_until_do_aux:wn \use_none:n { \reverse_if:N \if_int_compare:w #1#2 } @@ -263,9 +263,9 @@ } \cs_new_protected_nopar:Npn \__xeCJK_check_num_range:nnNN #1#2#3#4 { - \bool_if:nTF { \__xeCJK_if_blank_x_p:n {#1} || \__xeCJK_if_blank_x_p:n {#2} } + \bool_if:nTF { \xeCJK_if_blank_x_p:n {#1} || \xeCJK_if_blank_x_p:n {#2} } { - \int_set:Nn #3 { \__xeCJK_if_blank_x:nTF {#1} {#2} {#1} } + \int_set:Nn #3 { \xeCJK_if_blank_x:nTF {#1} {#2} {#1} } \int_set_eq:NN #3 #4 } { @@ -288,16 +288,17 @@ } \__xeCJK_declare_char_class:nn { FullRight } { - "00B7 , "2019 , "201D , "2014 , "2025 , "2026 , "2030 , "2500 , "3001 , - "3002 , "3005 , "3006 , "3009 , "300B , "300D , "300F , "3011 , "3015 , - "3017 , "3019 , "301B , "301E , "301F , "3041 , "3043 , "3045 , "3047 , - "3049 , "3063 , "3083 , "3085 , "3087 , "308E , "309B , "309C , "309D , - "309E , "30A1 , "30A3 , "30A5 , "30A7 , "30A9 , "30C3 , "30E3 , "30E5 , - "30E7 , "30EE , "30F5 , "30F6 , "30FB , "30FC , "30FD , "30FE , "FE50 , - "FE51 , "FE52 , "FE54 , "FE55 , "FE56 , "FE57 , "FE5A , "FE5C , "FE5E , - "FE6A , "FF01 , "FF05 , "FF09 , "FF0C , "FF0E , "FF1A , "FF1B , "FF1F , - "FF3D , "FF5D , "FF61 , "FF63 , "FF64 , "FF65 , "FF67 , "FF68 , "FF69 , - "FF6A , "FF6B , "FF6C , "FF6D , "FF6E , "FF6F , "FF70 , "FF9E , "FF9F , + "00B7 , "2019 , "201D , "2014 , "2015 , "2025 , "2026 , "2030 , "2500 , + "3001 , "3002 , "3005 , "3006 , "3009 , "300B , "300D , "300F , "3011 , + "3015 , "3017 , "3019 , "301B , "301E , "301F , "3041 , "3043 , "3045 , + "3047 , "3049 , "3063 , "3083 , "3085 , "3087 , "308E , "309B , "309C , + "309D , "309E , "30A1 , "30A3 , "30A5 , "30A7 , "30A9 , "30C3 , "30E3 , + "30E5 , "30E7 , "30EE , "30F5 , "30F6 , "30FB , "30FC , "30FD , "30FE , + "FE50 , "FE51 , "FE52 , "FE54 , "FE55 , "FE56 , "FE57 , "FE5A , "FE5C , + "FE5E , "FE6A , "FF01 , "FF05 , "FF09 , "FF0C , "FF0E , "FF1A , "FF1B , + "FF1F , "FF3D , "FF5D , "FF61 , "FF63 , "FF64 , "FF65 , "FF67 , "FF68 , + "FF69 , "FF6A , "FF6B , "FF6C , "FF6D , "FF6E , "FF6F , "FF70 , "FF9E , + "FF9F , } } \__xeCJK_declare_char_class:nn { CJK } @@ -384,7 +385,7 @@ } \__xeCJK_app_inter_class_toks:nnn {#1} { CJK } { \CJKsymbol } \clist_map_inline:nn { FullLeft, FullRight } - { \__xeCJK_app_inter_class_toks:nnc {#1} {##1} { __xeCJK_CJK_and_##1:N } } + { \__xeCJK_app_inter_class_toks:nnc {#1} {##1} { xeCJK_CJK_and_##1:N } } } \clist_map_inline:nn { Default, HalfLeft, NormalSpace } { @@ -399,12 +400,12 @@ { \tex_unskip:D \bool_if:nTF - { \__xeCJK_if_last_node_p:n { CJK } || \__xeCJK_if_last_node_p:n { CJK_space } } + { \xeCJK_if_last_node_p:n { CJK } || \xeCJK_if_last_node_p:n { CJK_space } } { \CJKecglue } { \c_space_token } } { - \__xeCJK_if_last_node:nTF { CJK } { \CJKecglue } - { \__xeCJK_if_last_node:nT { CJK_space } { \__xeCJK_space_or_xecglue: } } + \xeCJK_if_last_node:nTF { CJK } { \CJKecglue } + { \xeCJK_if_last_node:nT { CJK_space } { \__xeCJK_space_or_xecglue: } } } } \str_if_eq_x:nnF {#1} { NormalSpace } @@ -415,14 +416,14 @@ \__xeCJK_inter_class_toks:nnn {#1} { Boundary } { \peek_catcode:NTF \c_space_token - { { \__xeCJK_make_node:n { default_space } } } - { { \__xeCJK_make_node:n { default } } } + { { \xeCJK_make_node:n { default_space } } } + { { \xeCJK_make_node:n { default } } } } \str_if_eq_x:nnF {#1} { NormalSpace } { \__xeCJK_pre_inter_class_toks:nnn {#1} { CJK } { \CJKecglue } } } -\__xeCJK_inter_class_toks:nnn { Boundary } { CJK } { \__xeCJK_Boundary_and_CJK: } -\cs_new_protected_nopar:Npn \__xeCJK_Boundary_and_CJK: +\__xeCJK_inter_class_toks:nnn { Boundary } { CJK } { \xeCJK_Boundary_and_CJK: } +\cs_new_protected_nopar:Npn \xeCJK_Boundary_and_CJK: { { \__xeCJK_check_for_glue: } \c_group_begin_token @@ -433,14 +434,14 @@ \cs_new_protected_nopar:Npn \__xeCJK_check_for_glue: { \bool_if:nTF - { \__xeCJK_if_last_node_p:n { CJK } || \__xeCJK_if_last_node_p:n { CJK_space } } + { \xeCJK_if_last_node_p:n { CJK } || \xeCJK_if_last_node_p:n { CJK_space } } { \CJKglue } { \bool_if:nTF { - \__xeCJK_if_last_node_p:n { default } || + \xeCJK_if_last_node_p:n { default } || \int_compare_p:nNn \etex_lastnodetype:D = \c_ten || - \__xeCJK_if_last_node_p:n { default_itcorr } + \xeCJK_if_last_node_p:n { default_itcorr } } { \CJKecglue } { @@ -455,17 +456,17 @@ \tex_unskip:D \bool_if:nTF { - \__xeCJK_if_last_node_p:n { default_space } || + \xeCJK_if_last_node_p:n { default_space } || \int_compare_p:nNn \etex_lastnodetype:D = \c_ten || - \__xeCJK_if_last_node_p:n { default } || - \__xeCJK_if_last_node_p:n { default_itcorr } + \xeCJK_if_last_node_p:n { default } || + \xeCJK_if_last_node_p:n { default_itcorr } } { \CJKecglue } { \bool_if:nTF { - \__xeCJK_if_last_node_p:n { CJK } || - \__xeCJK_if_last_node_p:n { CJK_space } + \xeCJK_if_last_node_p:n { CJK } || + \xeCJK_if_last_node_p:n { CJK_space } } { \bool_if:NTF \l__xeCJK_space_bool \c_space_token \CJKglue } { \c_space_token } @@ -483,11 +484,11 @@ \__xeCJK_inter_class_toks:nnn { CJK } { Boundary } { \c_group_end_token - { \__xeCJK_make_node:n { CJK } } - \__xeCJK_ignorespaces: + { \xeCJK_make_node:n { CJK } } + \xeCJK_ignorespaces: } -\__xeCJK_inter_class_toks:nnn { CJK } { CJK } { \__xeCJK_CJK_and_CJK:N } -\cs_new_protected_nopar:Npn \__xeCJK_CJK_and_CJK:N #1 { \CJKglue \CJKsymbol {#1} } +\__xeCJK_inter_class_toks:nnn { CJK } { CJK } { \xeCJK_CJK_and_CJK:N } +\cs_new_protected_nopar:Npn \xeCJK_CJK_and_CJK:N #1 { \CJKglue \CJKsymbol {#1} } \clist_map_inline:nn { FullLeft, FullRight } { \__xeCJK_inter_class_toks:nnn { Boundary } {#1} @@ -495,7 +496,7 @@ \c_group_begin_token \__xeCJK_clear_CJK_toks: \xeCJK_select_font: - \use:c { __xeCJK_CJK_and_#1:N } + \use:c { xeCJK_CJK_and_#1:N } } \__xeCJK_inter_class_toks:nnn {#1} { CJK } { \CJKsymbol } \__xeCJK_inter_class_toks:nnn {#1} { Boundary } { \c_group_end_token \tex_ignorespaces:D } @@ -505,14 +506,14 @@ \bool_if:nF { \str_if_eq_x_p:nn {#1} { FullLeft } || \str_if_eq_x_p:nn {#1} { FullRight } } { - \__xeCJK_pre_inter_class_toks:nnn { FullLeft } {#1} { \__xeCJK_no_break: } - \__xeCJK_pre_inter_class_toks:nnn { FullRight } {#1} { \__xeCJK_after_FullRight: } + \__xeCJK_pre_inter_class_toks:nnn { FullLeft } {#1} { \xeCJK_no_break: } + \__xeCJK_pre_inter_class_toks:nnn { FullRight } {#1} { \xeCJK_after_FullRight: } } } \clist_map_inline:nn { CJK, FullLeft, FullRight } { \clist_map_inline:nn { FullLeft, FullRight } - { \__xeCJK_inter_class_toks:nnc {#1} {##1} { __xeCJK_#1_and_##1:N } } + { \__xeCJK_inter_class_toks:nnc {#1} {##1} { xeCJK_#1_and_##1:N } } } \cs_new_protected_nopar:Npn \__xeCJK_punct_rule:n #1 { @@ -533,109 +534,110 @@ \cs_new_protected_nopar:Npn \__xeCJK_punct_kern:n #1 { \tex_kern:D \dim_eval:c { \l__xeCJK_punct_coor_tl/kern/#1 } } \cs_generate_variant:Nn \dim_eval:n { c } -\cs_new_protected_nopar:Npn \__xeCJK_before_FullLeft:N #1 +\cs_new_protected_nopar:Npn \xeCJK_before_FullLeft:N #1 { \tl_set:Nx \l__xeCJK_lastpunct_tl {#1} \__xeCJK_punct_rule:n { l/#1 } \CJKpunctsymbol {#1} } -\cs_new_protected_nopar:Npn \__xeCJK_after_FullRight: +\cs_new_protected_nopar:Npn \xeCJK_after_FullRight: { - \__xeCJK_get_punct_bounds:nV { r } \l__xeCJK_lastpunct_tl + \xeCJK_get_punct_bounds:nV { r } \l__xeCJK_lastpunct_tl \__xeCJK_punct_rule:n { r/\l__xeCJK_lastpunct_tl } \__xeCJK_punct_glue:n { r/\l__xeCJK_lastpunct_tl } } -\cs_new_protected_nopar:Npn \__xeCJK_CJK_and_FullLeft:N #1 +\cs_new_protected_nopar:Npn \xeCJK_CJK_and_FullLeft:N #1 { - \__xeCJK_get_punct_bounds:nN { l } {#1} + \xeCJK_get_punct_bounds:nN { l } {#1} \int_compare:nNnF \etex_lastnodetype:D = \c_one { \__xeCJK_punct_glue:n { l/#1 } } - \__xeCJK_before_FullLeft:N {#1} + \xeCJK_before_FullLeft:N {#1} \__xeCJK_punct_if_middle:NT {#1} { - \__xeCJK_punct_rule:n { m/#1 } + \__xeCJK_punct_rule:n { lr/#1 } \__xeCJK_punct_glue:n { l/#1 } } } -\cs_new_protected_nopar:Npn \__xeCJK_CJK_and_FullRight:N #1 +\cs_new_protected_nopar:Npn \xeCJK_CJK_and_FullRight:N #1 { - \__xeCJK_get_punct_bounds:nN { r } {#1} + \xeCJK_get_punct_bounds:nN { r } {#1} \__xeCJK_punct_if_long:NTF {#1} \CJKglue { - \__xeCJK_no_break: + \xeCJK_no_break: \__xeCJK_punct_if_middle:NT {#1} { \__xeCJK_punct_glue:n { r/#1 } - \__xeCJK_punct_rule:n { m/#1 } + \__xeCJK_punct_rule:n { lr/#1 } } } \tl_gset:Nx \l__xeCJK_lastpunct_tl {#1} \CJKpunctsymbol {#1} } -\cs_new_protected_nopar:Npn \__xeCJK_FullLeft_and_FullLeft:N #1 +\cs_new_protected_nopar:Npn \xeCJK_FullLeft_and_FullLeft:N #1 { - \__xeCJK_no_break: - \__xeCJK_get_punct_bounds:nN { l } {#1} - \__xeCJK_get_kern:VN \l__xeCJK_lastpunct_tl {#1} + \xeCJK_no_break: + \xeCJK_get_punct_bounds:nN { l } {#1} + \xeCJK_calc_kern:VN \l__xeCJK_lastpunct_tl {#1} \__xeCJK_punct_kern:n { \l__xeCJK_lastpunct_tl - #1 } - \__xeCJK_before_FullLeft:N {#1} + \xeCJK_before_FullLeft:N {#1} } -\cs_new_protected_nopar:Npn \__xeCJK_FullLeft_and_FullRight:N #1 +\cs_new_protected_nopar:Npn \xeCJK_FullLeft_and_FullRight:N #1 { - \__xeCJK_no_break: - \__xeCJK_get_punct_bounds:nN { r } {#1} - \__xeCJK_get_kern:VN \l__xeCJK_lastpunct_tl {#1} + \xeCJK_no_break: + \xeCJK_get_punct_bounds:nN { r } {#1} + \xeCJK_calc_kern:VN \l__xeCJK_lastpunct_tl {#1} \__xeCJK_punct_kern:n { \l__xeCJK_lastpunct_tl - #1 } - \__xeCJK_no_break: + \xeCJK_no_break: \tl_set:Nx \l__xeCJK_lastpunct_tl {#1} \CJKpunctsymbol {#1} } -\cs_new_protected_nopar:Npn \__xeCJK_FullRight_and_FullLeft:N #1 +\cs_new_protected_nopar:Npn \xeCJK_FullRight_and_FullLeft:N #1 { \__xeCJK_punct_rule:n { r/\l__xeCJK_lastpunct_tl } - \__xeCJK_get_punct_bounds:nN { l } {#1} - \__xeCJK_get_kern:VN \l__xeCJK_lastpunct_tl {#1} + \xeCJK_get_punct_bounds:nN { l } {#1} + \xeCJK_calc_kern:VN \l__xeCJK_lastpunct_tl {#1} \__xeCJK_punct_kern:n { \l__xeCJK_lastpunct_tl - #1 } \__xeCJK_punct_nobreak: - \__xeCJK_before_FullLeft:N {#1} + \xeCJK_before_FullLeft:N {#1} } -\cs_new_protected_nopar:Npn \__xeCJK_FullRight_and_FullRight:N #1 +\cs_new_protected_nopar:Npn \xeCJK_FullRight_and_FullRight:N #1 { \__xeCJK_punct_rule:n { r/\l__xeCJK_lastpunct_tl } - \__xeCJK_get_punct_bounds:nN { r } {#1} - \__xeCJK_get_kern:VN \l__xeCJK_lastpunct_tl {#1} + \xeCJK_get_punct_bounds:nN { r } {#1} + \xeCJK_calc_kern:VN \l__xeCJK_lastpunct_tl {#1} \__xeCJK_punct_kern:n { \l__xeCJK_lastpunct_tl - #1 } - \__xeCJK_no_break: + \xeCJK_no_break: \tl_set:Nx \l__xeCJK_lastpunct_tl {#1} \CJKpunctsymbol {#1} } - \prg_new_conditional:Npnn \__xeCJK_if_last_node:n #1 { p , T , F , TF } + \prg_new_conditional:Npnn \xeCJK_if_last_node:n #1 { p , T , F , TF } { \if_dim:w \dim_use:c { c__xeCJK_#1_node_dim } = \tex_lastkern:D \prg_return_true: \else: \prg_return_false: \fi: } -\cs_new_protected_nopar:Npn \__xeCJK_def_node:nn #1#2 +\cs_new_protected_nopar:Npn \xeCJK_def_node:nn #1#2 { \dim_if_exist:cTF { c__xeCJK_#1_node_dim } { \dim_gset:cn } { \dim_const:cn } { c__xeCJK_#1_node_dim } {#2} } -\cs_new_protected_nopar:Npn \__xeCJK_make_node:n #1 +\cs_new_protected_nopar:Npn \xeCJK_make_node:n #1 { \tex_kern:D - \dim_use:c { c__xeCJK_#1_node_dim } \tex_kern:D \dim_use:c { c__xeCJK_#1_node_dim } } -\__xeCJK_def_node:nn { CJK } { 11 sp } -\__xeCJK_def_node:nn { CJK_space } { 12 sp } -\__xeCJK_def_node:nn { default } { 13 sp } -\__xeCJK_def_node:nn { default_space } { 14 sp } -\__xeCJK_def_node:nn { default_itcorr } { 15 sp } -\keys_define:nn { xeCJK / options } { CJKglue .tl_set:N = \CJKglue } +\xeCJK_def_node:nn { CJK } { 11 sp } +\xeCJK_def_node:nn { CJK_space } { 12 sp } +\xeCJK_def_node:nn { default } { 13 sp } +\xeCJK_def_node:nn { default_space } { 14 sp } +\xeCJK_def_node:nn { default_itcorr } { 15 sp } +\keys_define:nn { xeCJK / options } + { CJKglue .code:n = { \cs_set_protected:Npn \CJKglue {#1} } } \keys_define:nn { xeCJK / options } { CJKecglue .code:n = { - \cs_set:Npn \CJKecglue {#1} + \cs_set_protected:Npn \CJKecglue {#1} \settowidth \l__xeCJK_ecglue_dim \CJKecglue }, xCJKecglue .choice:, @@ -652,7 +654,7 @@ xCJKecglue / unknown .code:n = { \bool_set_true:N \l__xeCJK_xecglue_bool - \cs_set:Npn \CJKecglue {#1} + \cs_set_protected:Npn \CJKecglue {#1} \settowidth \l__xeCJK_ecglue_dim \CJKecglue \cs_set_eq:NN \__xeCJK_space_or_xecglue: \CJKecglue }, @@ -672,32 +674,32 @@ \NewDocumentCommand \CJKspace { } { \bool_set_true:N \l__xeCJK_space_bool - \cs_set_eq:NN \__xeCJK_ignorespaces: \__xeCJK_peek_math: + \cs_set_eq:NN \xeCJK_ignorespaces: \__xeCJK_peek_math: } \NewDocumentCommand \CJKnospace { } { \bool_set_false:N \l__xeCJK_space_bool - \cs_set_eq:NN \__xeCJK_ignorespaces: \__xeCJK_ignore_spaces: + \cs_set_eq:NN \xeCJK_ignorespaces: \__xeCJK_ignore_spaces: } \cs_new_protected_nopar:Npn \__xeCJK_ignore_spaces: { \peek_catcode:NTF \c_space_token { - \__xeCJK_if_last_node:nT { CJK } - { \tex_unkern:D \tex_unkern:D { \__xeCJK_make_node:n { CJK_space } } } - \__xeCJK_peek_catcode_ignore_spaces:NTF \c_math_toggle_token + \xeCJK_if_last_node:nT { CJK } + { \tex_unkern:D \tex_unkern:D { \xeCJK_make_node:n { CJK_space } } } + \xeCJK_peek_catcode_ignore_spaces:NTF \c_math_toggle_token { \__xeCJK_space_or_xecglue: } { \bool_if:nT { - \__xeCJK_if_outer_macro_p:c { l_peek_token } || + \xeCJK_if_outer_macro_p:c { l_peek_token } || \token_if_cs_p:c { l_peek_token } } { \__xeCJK_space_or_xecglue: } } } { - \__xeCJK_if_outer_macro:cF { l_peek_token } + \xeCJK_if_outer_macro:cF { l_peek_token } { \token_if_math_toggle:cTF { l_peek_token } \CJKecglue { \cs_if_exist:cF { l_peek_token } \exp_not:N } @@ -708,13 +710,13 @@ { \peek_catcode:NTF \c_space_token { - \__xeCJK_if_last_node:nT { CJK } - { \tex_unkern:D \tex_unkern:D { \__xeCJK_make_node:n { CJK_space } } } - \__xeCJK_peek_catcode_ignore_spaces:NF \c_space_token + \xeCJK_if_last_node:nT { CJK } + { \tex_unkern:D \tex_unkern:D { \xeCJK_make_node:n { CJK_space } } } + \xeCJK_peek_catcode_ignore_spaces:NF \c_space_token { \__xeCJK_space_or_xecglue: } } { - \__xeCJK_if_outer_macro:cF { l_peek_token } + \xeCJK_if_outer_macro:cF { l_peek_token } { \token_if_math_toggle:cTF { l_peek_token } \CJKecglue { \cs_if_exist:cF { l_peek_token } \exp_not:N } @@ -735,8 +737,8 @@ \bool_if:NF \l__xeCJK_checksingle_bool { \bool_set_true:N \l__xeCJK_checksingle_bool - \cs_set_eq:NN \__xeCJK_checksingle_save_CJKsymbol:N \__xeCJK_CJK_and_CJK:N - \cs_set_eq:NN \__xeCJK_CJK_and_CJK:N \__xeCJK_checksingle:N + \cs_set_eq:NN \__xeCJK_checksingle_save_CJKsymbol:N \xeCJK_CJK_and_CJK:N + \cs_set_eq:NN \xeCJK_CJK_and_CJK:N \xeCJK_checksingle:N } } \NewDocumentCommand \xeCJKdisablechecksingle { } @@ -744,33 +746,33 @@ \bool_if:NT \l__xeCJK_checksingle_bool { \bool_set_false:N \l__xeCJK_checksingle_bool - \cs_set_eq:NN \__xeCJK_CJK_and_CJK:N \__xeCJK_checksingle_save_CJKsymbol:N + \cs_set_eq:NN \xeCJK_CJK_and_CJK:N \__xeCJK_checksingle_save_CJKsymbol:N } } -\cs_new_protected_nopar:Npn \__xeCJK_checksingle:N #1 +\cs_new_protected_nopar:Npn \xeCJK_checksingle:N #1 { \peek_catcode:NTF \c_catcode_other_token - { \__xeCJK_checksingle:NN {#1} } + { \xeCJK_checksingle:NN {#1} } { \bool_if:nTF { - ! ( \__xeCJK_if_outer_macro_p:c { l_peek_token } ) && - \__xeCJK_if_blank_x_p:n { \token_get_arg_spec:c { l_peek_token } } && + ! ( \xeCJK_if_outer_macro_p:c { l_peek_token } ) && + \xeCJK_if_blank_x_p:n { \token_get_arg_spec:c { l_peek_token } } && \exp_args:NNc \exp_args:No \tl_if_single_token_p:n { l_peek_token } && \exp_args:NNc \exp_after:wN \token_if_other_p:N { l_peek_token } } - { \__xeCJK_checksingle:NN {#1} } + { \xeCJK_checksingle:NN {#1} } { \__xeCJK_checksingle_save_CJKsymbol:N {#1} } } } -\cs_new_protected_nopar:Npn \__xeCJK_checksingle:NN #1#2 +\cs_new_protected_nopar:Npn \xeCJK_checksingle:NN #1#2 { \peek_catcode:NTF \c_catcode_other_token { \__xeCJK_checksingle_save_CJKsymbol:N {#1} #2 } { \bool_if:nTF { - ! ( \__xeCJK_if_outer_macro_p:c { l_peek_token } ) && + ! ( \xeCJK_if_outer_macro_p:c { l_peek_token } ) && ( \token_if_space_p:c { l_peek_token } || \token_if_math_toggle_p:c { l_peek_token } || \token_if_cs_p:c { l_peek_token } ) @@ -778,57 +780,57 @@ { \bool_if:nTF { \token_if_space_p:c { l_peek_token } } { - \__xeCJK_peek_catcode_ignore_spaces:NTF \c_catcode_other_token + \xeCJK_peek_catcode_ignore_spaces:NTF \c_catcode_other_token { \__xeCJK_checksingle_save_CJKsymbol:N {#1} #2 \c_space_token } { \bool_if:nTF { - ! ( \__xeCJK_if_outer_macro_p:c { l_peek_token } ) && + ! ( \xeCJK_if_outer_macro_p:c { l_peek_token } ) && ( \token_if_math_toggle_p:c { l_peek_token } || \token_if_cs_p:c { l_peek_token } ) } - { \__xeCJK_checksingle:NNN {#1} {#2} \c_space_token } + { \xeCJK_checksingle:NNN {#1} {#2} \c_space_token } { \__xeCJK_checksingle_save_CJKsymbol:N {#1} #2 \c_space_token } } } - { \__xeCJK_checksingle:NNN {#1} {#2} { } } + { \xeCJK_checksingle:NNN {#1} {#2} { } } } { \__xeCJK_checksingle_save_CJKsymbol:N {#1} #2 } } } -\cs_new_protected_nopar:Npn \__xeCJK_checksingle:NNN #1#2#3 +\cs_new_protected_nopar:Npn \xeCJK_checksingle:NNN #1#2#3 { \bool_if:nTF { \token_if_eq_meaning_p:NN \l_peek_token \par || \token_if_eq_meaning_p:NN \l_peek_token \[ % \] } - { \CJKsymbol {#1} \__xeCJK_no_break: #2 } - { \__xeCJK_checksingle_env:NNN {#1} {#2} {#3} } + { \CJKsymbol {#1} \xeCJK_no_break: #2 } + { \xeCJK_checksingle_env:NNN {#1} {#2} {#3} } } -\cs_new_protected_nopar:Npn \__xeCJK_checksingle_env:NNN #1#2#3 +\cs_new_protected_nopar:Npn \xeCJK_checksingle_env:NNN #1#2#3 { \peek_catcode_remove:NTF \c_math_toggle_token { \peek_catcode:NTF \c_math_toggle_token - { \CJKsymbol {#1} \__xeCJK_no_break: #2 \c_math_toggle_token } + { \CJKsymbol {#1} \xeCJK_no_break: #2 \c_math_toggle_token } { \__xeCJK_checksingle_save_CJKsymbol:N {#1} #2#3 \c_math_toggle_token } } { \peek_meaning_remove:NTF \begin - { \__xeCJK_checksingle_env:NNNNn {#1} {#2} {#3} \begin } + { \xeCJK_checksingle_env:NNNNn {#1} {#2} {#3} \begin } { \peek_meaning_remove:NTF \end - { \__xeCJK_checksingle_env:NNNNn {#1} {#2} {#3} \end } + { \xeCJK_checksingle_env:NNNNn {#1} {#2} {#3} \end } { \__xeCJK_checksingle_save_CJKsymbol:N {#1} #2#3 } } } } -\cs_new_protected_nopar:Npn \__xeCJK_checksingle_env:NNNNn #1#2#3#4#5 +\cs_new_protected_nopar:Npn \xeCJK_checksingle_env:NNNNn #1#2#3#4#5 { \clist_if_in:NnTF \g__xeCJK_inline_env_clist {#5} { \__xeCJK_checksingle_save_CJKsymbol:N {#1} #2#3 } - { \CJKsymbol {#1} \__xeCJK_no_break: #2 } + { \CJKsymbol {#1} \xeCJK_no_break: #2 } \scan_stop: #4 {#5} } \keys_define:nn { xeCJK / options } @@ -970,7 +972,7 @@ \__xeCJK_inter_class_toks:nnn { Boundary } { #1/#2 } { \__xeCJK_erase_CJKsymbol: - \__xeCJK_Boundary_and_CJK: + \xeCJK_Boundary_and_CJK: \__xeCJK_switch_font:nn {#1} {#2} \__xeCJK_restore_CJKsymbol: } @@ -987,8 +989,8 @@ { PunctStyle .choice_code:n = { - \tl_set:Nx \l__xeCJK_punctstyle_tl { \l_keys_choice_tl } - \tl_if_eq:NNT \l__xeCJK_punctstyle_tl \c__xeCJK_ps_plain_tl + \tl_set:Nx \l_xeCJK_punctstyle_tl { \l_keys_choice_tl } + \tl_if_eq:NNT \l_xeCJK_punctstyle_tl \c__xeCJK_ps_plain_tl { \xeCJKallowbreakbetweenpuncts } }, } @@ -1029,7 +1031,7 @@ \NewDocumentCommand \xeCJKallowbreakbetweenpuncts { } { \cs_set_eq:NN \__xeCJK_punct_nobreak: \__xeCJK_zero_glue: } \NewDocumentCommand \xeCJKnobreakbetweenpuncts { } - { \cs_set_eq:NN \__xeCJK_punct_nobreak: \__xeCJK_no_break: } + { \cs_set_eq:NN \__xeCJK_punct_nobreak: \xeCJK_no_break: } \cs_new_protected_nopar:Npn \__xeCJK_zero_glue: { \skip_horizontal:N \c_zero_skip } \clist_set:Nn \g__xeCJK_special_ps_clist { mixedwidth , long , middle } \clist_map_inline:Nn \g__xeCJK_special_ps_clist @@ -1062,24 +1064,27 @@ \cs_generate_variant:Nn \dim_set:Nn { Nc } \cs_generate_variant:Nn \dim_add:Nn { Nc } \cs_generate_variant:Nn \dim_min:nn { cc } -\cs_new_protected_nopar:Npn \__xeCJK_dim_set_max:Nn #1#2 +\cs_new_protected_nopar:Npn \xeCJK_dim_set_max:Nn #1#2 { \dim_set:Nn #1 { \dim_max:nn {#1} {#2} } } -\cs_new_protected_nopar:Npn \__xeCJK_dim_set_min:Nn #1#2 +\cs_new_protected_nopar:Npn \xeCJK_dim_set_min:Nn #1#2 { \dim_set:Nn #1 { \dim_min:nn {#1} {#2} } } -\tl_set:Nn \l__xeCJK_punct_coor_tl { \l__xeCJK_font_coor_tl/\l__xeCJK_punctstyle_tl } -\cs_new_protected_nopar:Npn \__xeCJK_get_punct_bounds:nN #1#2 +\tl_set:Nn \l__xeCJK_punct_coor_tl { \l_xeCJK_font_coor_tl/\l_xeCJK_punctstyle_tl } +\cs_new_protected_nopar:Npn \xeCJK_get_punct_bounds:nN #1#2 { \tl_if_exist:cF { \l__xeCJK_punct_coor_tl/rule/#1/#2 } { - \tl_if_eq:NNTF \l__xeCJK_punctstyle_tl \c__xeCJK_ps_plain_tl + \tl_if_eq:NNTF \l_xeCJK_punctstyle_tl \c__xeCJK_ps_plain_tl { - \clist_map_inline:nn { glue , rule , bound } - { \tl_gset:cV { \l__xeCJK_punct_coor_tl/##1/#1/#2 } \c_zero_dim } - \tl_gset:cV { \l__xeCJK_punct_coor_tl/rule/m/#2 } \c_zero_dim + \tl_set:NV \l__xeCJK_tmpa_tl \c_zero_dim + \tl_gset_eq:cN { \l__xeCJK_punct_coor_tl/glue/#1/#2 } \l__xeCJK_tmpa_tl + \tl_gset_eq:cN { \l__xeCJK_punct_coor_tl/rule/#1/#2 } \l__xeCJK_tmpa_tl + \tl_gset_eq:cN { \l__xeCJK_punct_coor_tl/rule/lr/#2 } \l__xeCJK_tmpa_tl + \tl_gset_eq:cN { \l__xeCJK_punct_coor_tl/bound/#1/#2 } \l__xeCJK_tmpa_tl + \tl_gset_eq:cN { \l__xeCJK_punct_coor_tl/bound/lr/#2 } \l__xeCJK_tmpa_tl } { \tl_if_exist:cF { \l__xeCJK_punct_coor_tl/bound/#1/#2 } - { { \xeCJK_select_font: \__xeCJK_get_punct_dimen:N {#2} } } + { { \xeCJK_select_font: \xeCJK_calc_punct_dimen:N {#2} } } \__xeCJK_punct_if_long:NTF {#2} { \dim_zero:N \l__xeCJK_tmpa_dim @@ -1094,9 +1099,8 @@ { \cs_if_exist_use:cF { g__xeCJK_punct_width/#2 } { - \__xeCJK_if_blank_x:nTF \g__xeCJK_punct_width_tl - { \c_zero_dim } - { \g__xeCJK_punct_width_tl } + \xeCJK_if_blank_x:nTF \g__xeCJK_punct_width_tl + { \c_zero_dim } { \g__xeCJK_punct_width_tl } } } \__xeCJK_punct_if_middle:NTF {#2} @@ -1106,7 +1110,7 @@ \dim_compare:nNnTF \l__xeCJK_tmpc_dim > \c_zero_dim { \l__xeCJK_tmpc_dim } { - \tl_case:Nnn \l__xeCJK_punctstyle_tl + \tl_case:Nnn \l_xeCJK_punctstyle_tl { \c__xeCJK_ps_halfwidth_tl { .5 em } \c__xeCJK_ps_mixedwidth_tl { .5 em } @@ -1115,9 +1119,14 @@ } { 1 em } } - - \tl_use:c { \l__xeCJK_punct_coor_tl/dimen/#2 } + - ( \tl_use:c { \l__xeCJK_punct_coor_tl/dimen/#2 } ) + } + \dim_compare:nNnTF \l__xeCJK_tmpc_dim > \c_zero_dim + { \dim_set:Nn \l__xeCJK_tmpc_dim { .5 \l__xeCJK_tmpc_dim } } + { + \dim_set:Nn \l__xeCJK_tmpc_dim + { \dim_min:nn \l__xeCJK_tmpa_dim \l__xeCJK_tmpb_dim } } - \dim_set:Nn \l__xeCJK_tmpc_dim { .5 \l__xeCJK_tmpc_dim } } { \dim_compare:nNnTF \l__xeCJK_tmpc_dim > \c_zero_dim @@ -1125,13 +1134,13 @@ \dim_set:Nn \l__xeCJK_tmpc_dim { \l__xeCJK_tmpc_dim - \l__xeCJK_tmpb_dim - - \tl_use:c { \l__xeCJK_punct_coor_tl/dimen/#2 } + - ( \tl_use:c { \l__xeCJK_punct_coor_tl/dimen/#2 } ) } } { \dim_set:Nn \l__xeCJK_tmpc_dim { \dim_min:nn \l__xeCJK_tmpa_dim \l__xeCJK_tmpb_dim } - \tl_case:Nnn \l__xeCJK_punctstyle_tl + \tl_case:Nnn \l_xeCJK_punctstyle_tl { \c__xeCJK_ps_halfwidth_tl { \prg_do_nothing: } \c__xeCJK_ps_mixedwidth_tl @@ -1139,7 +1148,7 @@ \__xeCJK_punct_if_mixedwidth:NT {#2} { \dim_add:Nn \l__xeCJK_tmpc_dim { .5 \l__xeCJK_tmpa_dim } - \__xeCJK_dim_set_min:Nn \l__xeCJK_tmpc_dim \l__xeCJK_tmpa_dim + \xeCJK_dim_set_min:Nn \l__xeCJK_tmpc_dim \l__xeCJK_tmpa_dim } } \c__xeCJK_ps_CCT_tl @@ -1147,23 +1156,23 @@ \__xeCJK_punct_if_mixedwidth:NTF {#2} { \dim_add:Nn \l__xeCJK_tmpc_dim { .5 \l__xeCJK_tmpa_dim } } { \dim_add:Nn \l__xeCJK_tmpc_dim { .3 \l__xeCJK_tmpa_dim } } - \__xeCJK_dim_set_min:Nn \l__xeCJK_tmpc_dim \l__xeCJK_tmpa_dim + \xeCJK_dim_set_min:Nn \l__xeCJK_tmpc_dim \l__xeCJK_tmpa_dim } } { \dim_set_eq:NN \l__xeCJK_tmpc_dim \l__xeCJK_tmpa_dim } } } - \__xeCJK_dim_set_max:Nn \l__xeCJK_tmpc_dim \c_zero_dim + \xeCJK_dim_set_max:Nn \l__xeCJK_tmpc_dim \c_zero_dim } \tl_gset:cx { \l__xeCJK_punct_coor_tl/rule/#1/#2 } { - \dim_use:N \l__xeCJK_tmpa_dim } - \tl_gset:cx { \l__xeCJK_punct_coor_tl/rule/m/#2 } + \tl_gset:cx { \l__xeCJK_punct_coor_tl/rule/lr/#2 } { - \dim_use:N \l__xeCJK_tmpb_dim } \tl_gset:cV { \l__xeCJK_punct_coor_tl/glue/#1/#2 } \l__xeCJK_tmpc_dim } } } -\cs_generate_variant:Nn \__xeCJK_get_punct_bounds:nN { nV } +\cs_generate_variant:Nn \xeCJK_get_punct_bounds:nN { nV } \NewDocumentCommand \xeCJKsetwidth { m m } { \tl_map_inline:xn {#1} { \tl_gset:cn { g__xeCJK_punct_width/##1 } {#2} } } \prg_new_conditional:Npnn \__xeCJK_punct_if_right:N #1 { p , T , F , TF } @@ -1191,68 +1200,69 @@ \prg_return_true: \prg_return_false: } } -\cs_new_protected_nopar:Npn \__xeCJK_get_kern:NN #1#2 +\cs_new_protected_nopar:Npn \xeCJK_calc_kern:NN #1#2 { \tl_if_exist:cF { \l__xeCJK_punct_coor_tl/kern/#1-#2 } { \dim_zero:N \l__xeCJK_tmpa_dim - \tl_if_eq:NNF \l__xeCJK_punctstyle_tl \c__xeCJK_ps_plain_tl + \tl_if_eq:NNF \l_xeCJK_punctstyle_tl \c__xeCJK_ps_plain_tl { \tl_if_exist:cTF { g__xeCJK_punct/kern/#1-#2 } { \dim_set:Nc \l__xeCJK_tmpa_dim { g__xeCJK_punct/kern/#1-#2 } } - { \__xeCJK_calc_kern:NN {#1} {#2} } + { \__xeCJK_calc_kern:NNN \l__xeCJK_tmpa_dim {#1} {#2} } } \tl_gset:cV { \l__xeCJK_punct_coor_tl/kern/#1-#2 } \l__xeCJK_tmpa_dim } } -\cs_new_protected_nopar:Npn \__xeCJK_calc_kern:NN #1#2 +\cs_new_protected_nopar:Npn \__xeCJK_calc_kern:NNN #1#2#3 { - \tl_if_eq:NNTF \l__xeCJK_punctstyle_tl \c__xeCJK_ps_marginkerning_tl + \tl_if_eq:NNTF \l_xeCJK_punctstyle_tl \c__xeCJK_ps_marginkerning_tl { - \__xeCJK_punct_if_right:NT {#1} - { \dim_add:Nc \l__xeCJK_tmpa_dim { \l__xeCJK_punct_coor_tl/bound/r/#1 } } - \__xeCJK_punct_if_right:NF {#2} - { \dim_add:Nc \l__xeCJK_tmpa_dim { \l__xeCJK_punct_coor_tl/bound/l/#2 } } + \dim_zero:N #1 + \__xeCJK_punct_if_right:NT {#2} + { \dim_add:Nc #1 { \l__xeCJK_punct_coor_tl/bound/r/#2 } } + \__xeCJK_punct_if_right:NF {#3} + { \dim_add:Nc #1 { \l__xeCJK_punct_coor_tl/bound/l/#3 } } } { - \tl_if_eq:NNTF \l__xeCJK_punctstyle_tl \c__xeCJK_ps_fullwidth_tl - { \__xeCJK_calc_kern:NnNN \l__xeCJK_tmpa_dim { 1.5 em } {#1} {#2} } + \tl_if_eq:NNTF \l_xeCJK_punctstyle_tl \c__xeCJK_ps_fullwidth_tl + { \dim_set:Nn #1 { \xeCJK_calc_kern:nNN { 1.5 em } {#2} {#3} } } { - \__xeCJK_punct_if_both_left_right:NNTF {#1} {#2} + \__xeCJK_punct_if_both_left_right:NNTF {#2} {#3} { - \__xeCJK_punct_if_mixedwidth:NT {#1} + \__xeCJK_punct_if_mixedwidth:NT {#2} { - \__xeCJK_calc_kern:NnNN \l__xeCJK_tmpa_dim { 1 em } {#1} {#2} - \dim_compare:nNnT \l__xeCJK_tmpa_dim < { .1 em } - { \dim_set:Nc \l__xeCJK_tmpa_dim { \l__xeCJK_punct_coor_tl/bound/l/#1 } } + \dim_set:Nn #1 { \xeCJK_calc_kern:nNN { 1 em } {#2} {#3} } + \dim_compare:nNnT #1 < { .1 em } + { \dim_set:Nc #1 { \l__xeCJK_punct_coor_tl/bound/l/#2 } } } } { \bool_if:nTF { - \__xeCJK_punct_if_mixedwidth_p:N {#1} && - ! ( \tl_if_eq_p:NN \l__xeCJK_punctstyle_tl \c__xeCJK_ps_halfwidth_tl ) + \__xeCJK_punct_if_mixedwidth_p:N {#2} && + ! ( \tl_if_eq_p:NN \l_xeCJK_punctstyle_tl \c__xeCJK_ps_halfwidth_tl ) } { - \dim_set:Nc \l__xeCJK_tmpa_dim { \l__xeCJK_punct_coor_tl/glue/r/#1 } - \dim_set:Nn \l__xeCJK_tmpa_dim { .7 \l__xeCJK_tmpa_dim } + \dim_set:Nn #1 { \tl_use:c { \l__xeCJK_punct_coor_tl/glue/r/#2 } } + \dim_set:Nn #1 { .7 #1 } } { - \__xeCJK_calc_kern:NnNN \l__xeCJK_tmpa_dim { 1 em } {#1} {#2} - \dim_compare:nNnT \l__xeCJK_tmpa_dim < { .1 em } + \dim_set:Nn #1 { \xeCJK_calc_kern:nNN { 1 em } {#2} {#3} } + \dim_compare:nNnT #1 < { .1 em } { - \dim_set:Nn \l__xeCJK_tmpa_dim + \dim_set:Nn #1 { \dim_max:nn { \dim_min:cc - { \l__xeCJK_punct_coor_tl/bound/l/#1 } - { \l__xeCJK_punct_coor_tl/bound/r/#1 } + { \l__xeCJK_punct_coor_tl/bound/l/#2 } + { \l__xeCJK_punct_coor_tl/bound/r/#2 } } { \dim_min:cc - { \l__xeCJK_punct_coor_tl/bound/l/#2 } - { \l__xeCJK_punct_coor_tl/bound/r/#2 } + { \l__xeCJK_punct_coor_tl/bound/l/#3 } + { \l__xeCJK_punct_coor_tl/bound/r/#3 } } } } @@ -1260,56 +1270,68 @@ } } \bool_if:nT - { \__xeCJK_punct_if_long_p:N {#1} || \__xeCJK_punct_if_long_p:N {#2} } - { \__xeCJK_dim_set_max:Nn \l__xeCJK_tmpa_dim { .1 em } } + { \__xeCJK_punct_if_long_p:N {#2} || \__xeCJK_punct_if_long_p:N {#3} } + { \xeCJK_dim_set_max:Nn #1 { .1 em } } } - \__xeCJK_dim_set_max:Nn \l__xeCJK_tmpa_dim \c_zero_dim + \xeCJK_dim_set_max:Nn #1 \c_zero_dim } -\cs_generate_variant:Nn \__xeCJK_get_kern:NN { V } -\cs_new_protected_nopar:Npn \__xeCJK_calc_kern:NnNN #1#2#3#4 +\cs_generate_variant:Nn \xeCJK_calc_kern:NN { V } +\cs_new_protected_nopar:Npn \xeCJK_calc_kern:nNN #1#2#3 { - \dim_set:Nn #1 + \dim_eval:n { - #2 + #1 - \tl_use:c { \l__xeCJK_punct_coor_tl/ - \__xeCJK_punct_if_right:NTF {#3} { bound } { glue } /l/#3 } + \__xeCJK_punct_if_right:NTF {#2} { bound } { glue } /l/#2 } - \tl_use:c { \l__xeCJK_punct_coor_tl/ - \__xeCJK_punct_if_right:NTF {#4} { glue } { bound } /r/#4 } + \__xeCJK_punct_if_right:NTF {#3} { glue } { bound } /r/#3 } + - \tl_use:c { \l__xeCJK_punct_coor_tl/dimen/#2 } - \tl_use:c { \l__xeCJK_punct_coor_tl/dimen/#3 } - - \tl_use:c { \l__xeCJK_punct_coor_tl/dimen/#4 } - \__xeCJK_punct_if_both_left_right:NNT {#3} {#4} - { + \tl_use:c { \l__xeCJK_punct_coor_tl/rule/m/#4 } } + \__xeCJK_punct_if_both_left_right:NNT {#2} {#3} + { + \tl_use:c { \l__xeCJK_punct_coor_tl/rule/lr/#3 } } } } -\cs_new_protected_nopar:Npn \__xeCJK_get_punct_dimen:N #1 +\cs_new_protected_nopar:Npn \xeCJK_calc_punct_dimen:N #1 { - \__xeCJK_get_glyph_bounds:nNN { left } {#1} \l__xeCJK_tmpa_dim - \tl_gset:cV { \l__xeCJK_punct_coor_tl/bound/l/#1 } \l__xeCJK_tmpa_dim - \dim_set_eq:NN \l__xeCJK_tmpb_dim \l__xeCJK_tmpa_dim - \__xeCJK_get_glyph_bounds:nNN { right } {#1} \l__xeCJK_tmpa_dim - \tl_gset:cV { \l__xeCJK_punct_coor_tl/bound/r/#1 } \l__xeCJK_tmpa_dim - \dim_add:Nn \l__xeCJK_tmpb_dim \l__xeCJK_tmpa_dim + \tl_gset:cx { \l__xeCJK_punct_coor_tl/bound/l/#1 } + { \xeCJK_glyph_bounds:nN { left } {#1} } + \tl_gset:cx { \l__xeCJK_punct_coor_tl/bound/r/#1 } + { \xeCJK_glyph_bounds:nN { right } {#1} } + \tl_gset:cx { \l__xeCJK_punct_coor_tl/bound/lr/#1 } + { + \dim_eval:n + { + ( \tl_use:c { \l__xeCJK_punct_coor_tl/bound/l/#1 } ) + + ( \tl_use:c { \l__xeCJK_punct_coor_tl/bound/r/#1 } ) + } + } \tl_gset:cx { \l__xeCJK_punct_coor_tl/dimen/#1 } - { \dim_eval:n { \etex_fontcharwd:D \tex_font:D `#1 - \l__xeCJK_tmpb_dim } } + { + \dim_eval:n + { + ( \etex_fontcharwd:D \tex_font:D `#1 ) - + ( \tl_use:c { \l__xeCJK_punct_coor_tl/bound/lr/#1 } ) + } + } \bool_if:nT { \__xeCJK_punct_if_long_p:N {#1} && - ! ( \str_if_eq_x_p:nn {#1} { … } || \str_if_eq_x_p:nn {#1} { ‥ } ) + ! ( \str_if_eq_x_p:nn {#1} { ^^^^2025 } || \str_if_eq_x_p:nn {#1} { ^^^^2026 } ) } { \clist_map_inline:Nn \g__xeCJK_punctstyle_clist { \str_if_eq_x:nnF \c__xeCJK_ps_plain_tl {##1} { - \tl_gset:cx { \l__xeCJK_font_coor_tl/##1/kern/#1-#1 } - { - \dim_use:N \l__xeCJK_tmpb_dim } + \tl_gset:cx { \l_xeCJK_font_coor_tl/##1/kern/#1-#1 } + { - \tl_use:c { \l__xeCJK_punct_coor_tl/bound/lr/#1 } } } } } } -\cs_new_protected_nopar:Npn \__xeCJK_get_glyph_bounds:nNN #1#2#3 +\cs_new_protected_nopar:Npn \xeCJK_glyph_bounds:nN #1#2 { - \dim_set:Nn #3 + \dim_eval:n { \XeTeXglyphbounds \str_case_x:nnn {#1} @@ -1338,7 +1360,7 @@ { \bool_set_true:N \l__xeCJK_fallback_bool \cs_set_eq:NN \__xeCJK_fallback_save_CJKsymbol:N \CJKsymbol - \cs_set_eq:NN \CJKsymbol \__xeCJK_fallback_testsymbol:N + \cs_set_eq:NN \CJKsymbol \xeCJK_fallback_testsymbol:N } } \NewDocumentCommand \xeCJKdisablefallback { } @@ -1349,16 +1371,16 @@ \cs_set_eq:NN \CJKsymbol \__xeCJK_fallback_save_CJKsymbol:N } } -\cs_new_protected_nopar:Npn \__xeCJK_fallback_testsymbol:N #1 +\cs_new_protected_nopar:Npn \xeCJK_fallback_testsymbol:N #1 { \font_glyph_if_exist:NnTF \tex_font:D {`#1} { \__xeCJK_fallback_save_CJKsymbol:N {#1} } { - \__xeCJK_family_if_exist:xTF { \l_xeCJK_family_tl/FallBack } + \xeCJK_family_if_exist:xTF { \l_xeCJK_family_tl/FallBack } { { \tl_put_right:Nn \l_xeCJK_family_tl { /FallBack } \xeCJK_select_font: - \__xeCJK_fallback_testsymbol:N {#1} + \xeCJK_fallback_testsymbol:N {#1} } } { \__xeCJK_warning:nx { fallback } {#1} @@ -1375,10 +1397,10 @@ \NewDocumentCommand \setCJKfallbackfamilyfont { m O{} m } { \exp_args:Nx \tl_if_in:nnTF {#3} { , } - { \__xeCJK_set_family_fallback:nnn {#1} {#2} {#3} } + { \xeCJK_set_family_fallback:xnn {#1} {#2} {#3} } { \xeCJK_set_family:xnn { #1/FallBack } {#2} {#3} } } -\cs_new_protected_nopar:Npn \__xeCJK_set_family_fallback:nnn #1#2#3 +\cs_new_protected_nopar:Npn \xeCJK_set_family_fallback:xnn #1#2#3 { \group_begin: \tl_set:Nx \l__xeCJK_family_fb_tl {#1} @@ -1439,11 +1461,11 @@ { #1 .code:n = { - \__xeCJK_if_blank_x:nTF {##1} + \xeCJK_if_blank_x:nTF {##1} { \bool_set_false:c { l__xeCJK_copy_#1_bool } \bool_set_false:c { l__xeCJK_add_#1_bool } - \tl_put_right:Nx \l__xeCJK_family_tl { /#1 } + \tl_put_right:Nx \l__xeCJK_family_aux_tl { /#1 } } { \clist_put_right:Nx \l__xeCJK_sub_key_clist {#1} @@ -1471,14 +1493,14 @@ \exp_args:No \tl_if_head_eq_charcode:nNTF \l__xeCJK_tmpa_tl [ % ] { \exp_after:wN \__xeCJK_get_sub_features_aux:n \l__xeCJK_tmpa_tl \c_empty_tl - \__xeCJK_if_blank_x:nT \l__xeCJK_sub_fontname_tl + \xeCJK_if_blank_x:nT \l__xeCJK_sub_fontname_tl { \tl_set:Nx \l__xeCJK_sub_fontname_tl \l__xeCJK_tmpa_tl \clist_clear:N \l__xeCJK_sub_fontfeat_clist } } { \tl_set:Nx \l__xeCJK_sub_fontname_tl \l__xeCJK_tmpa_tl } - \__xeCJK_if_blank_x:nTF \l__xeCJK_sub_fontname_tl + \xeCJK_if_blank_x:nTF \l__xeCJK_sub_fontname_tl { \tl_set:Nx \l__xeCJK_sub_fontname_tl \l__xeCJK_fontname_tl } { \tl_replace_all:Nnx \l__xeCJK_sub_fontname_tl * \l__xeCJK_fontname_tl } \clist_set:cx { l__xeCJK_#1_fontfeat_clist } \l__xeCJK_sub_fontfeat_clist @@ -1537,17 +1559,18 @@ Mono .choice:, Mono / Exspace .code:n = { - \__xeCJK_set_monoexspace: + \xeCJK_set_monoexspace: \tl_clear:N \l__xeCJK_monoscale_tl }, Mono / Scale .code:n = { - \__xeCJK_set_monoscale: + \xeCJK_set_monoscale: \tl_set:Nx \l__xeCJK_monoscale_tl { Scale = { \fp_use:N \g__xeCJK_monoscale_fp } } } } \cs_new_protected_nopar:Npn \__xeCJK_set_init: { + \cs_set_eq:NN \CJKfamily \use_none:n \tl_clear:N \l__xeCJK_monoscale_tl \int_gincr:N \g__xeCJK_fontspec_int \prop_clear:N \l__xeCJK_add_font_prop @@ -1572,27 +1595,30 @@ { \group_begin: \__xeCJK_set_init: - \tl_set:Nx \l__xeCJK_family_tl {#1} + \tl_set:Nx \l__xeCJK_family_aux_tl {#1} \clist_set:Nx \l__xeCJK_fontoptions_clist {#2} \tl_set:Nx \l__xeCJK_fontname_tl {#3} \keys_set_known:nxN { xeCJK / features } { \g__xeCJK_default_features_clist, #2 } \l__xeCJK_pass_features_clist \__xeCJK_parse_features: \__xeCJK_pass_features: - \__xeCJK_check_family:V \l__xeCJK_family_tl - \cs_gset_protected_nopar:cpx { __xeCJK/family/\l__xeCJK_family_tl } + \__xeCJK_check_family:V \l__xeCJK_family_aux_tl + \cs_gset_protected_nopar:cpx { __xeCJK/family/\l__xeCJK_family_aux_tl } { + \group_begin: + \exp_not:n { \cs_set_eq:NN \CJKfamily \use_none:n } \exp_not:n { \fontspec_set_family:Nnn \l__xeCJK_fontspec_family_tl } { \l__xeCJK_pass_features_clist } { \l__xeCJK_fontname_tl } \prop_gput:NnV \exp_not:N \g__xeCJK_family_name_prop - { \l__xeCJK_family_tl } \exp_not:N \l__xeCJK_fontspec_family_tl - \cs_gset_protected_nopar:cpx { __xeCJK/family/\l__xeCJK_family_tl } + { \l__xeCJK_family_aux_tl } \exp_not:N \l__xeCJK_fontspec_family_tl + \cs_gset_protected_nopar:cpx { __xeCJK/family/\l__xeCJK_family_aux_tl } \exp_not:n { { - \exp_not:N \fontencoding { \g_fontspec_encoding_tl } + \exp_not:N \fontencoding { \c__xeCJK_encoding_tl } \exp_not:N \fontfamily { \l__xeCJK_fontspec_family_tl } \exp_not:N \selectfont } } + \group_end: } \__xeCJK_save_family_info: \__xeCJK_add_sub_block: @@ -1663,7 +1689,7 @@ } \prg_new_conditional:Npnn \__xeCJK_if_font_select:n #1 { p, T, F, TF } { - \exp_args:Nc \__xeCJK_if_blank_x:nTF { l__xeCJK_fontname_#1_tl } + \exp_args:Nc \xeCJK_if_blank_x:nTF { l__xeCJK_fontname_#1_tl } \prg_return_false: \prg_return_true: } \prg_new_conditional:Npnn \__xeCJK_if_it_or_sl:n #1 { p, T, F, TF } @@ -1708,7 +1734,7 @@ { \tl_use:c { l__xeCJK_fontname_\str_if_eq_x:nnTF {#1} {it} {sl} {it} _tl } } \prg_new_conditional:Npnn \__xeCJK_if_map_font_select:n #1 { p, T, F, TF } { - \__xeCJK_if_blank_x:nTF { \__xeCJK_get_map_font:n {#1} } + \xeCJK_if_blank_x:nTF { \__xeCJK_get_map_font:n {#1} } \prg_return_false: \prg_return_true: } \cs_new_protected_nopar:Npn \__xeCJK_pass_features: @@ -1723,8 +1749,8 @@ } \prop_map_inline:Nn \l__xeCJK_add_font_prop { \clist_put_right:Nx \l__xeCJK_pass_features_clist { ##1 = { ##2 } } } - \__xeCJK_if_blank_x:nF \l__xeCJK_monoscale_tl - { \clist_put_right:Nx \l__xeCJK_pass_features_clist \l__xeCJK_monoscale_tl } + \xeCJK_if_blank_x:nF \l__xeCJK_monoscale_tl + { \clist_put_left:Nx \l__xeCJK_pass_features_clist \l__xeCJK_monoscale_tl } } \prop_new:N \g__xeCJK_family_prop \prop_new:N \g__xeCJK_family_name_prop @@ -1737,8 +1763,8 @@ \clist_remove_all:Nn \l__xeCJK_fontoptions_clist {##1} \clist_remove_all:Nn \l__xeCJK_fontoptions_clist { ##1 = } } - \prop_gput:NVV \g__xeCJK_family_prop \l__xeCJK_family_tl \l__xeCJK_fontname_tl - \prop_gput:NVV \g__xeCJK_family_options_prop \l__xeCJK_family_tl \l__xeCJK_fontoptions_clist + \prop_gput:NVV \g__xeCJK_family_prop \l__xeCJK_family_aux_tl \l__xeCJK_fontname_tl + \prop_gput:NVV \g__xeCJK_family_options_prop \l__xeCJK_family_aux_tl \l__xeCJK_fontoptions_clist \group_end: } \cs_new_protected_nopar:Npn \__xeCJK_add_sub_block: @@ -1746,30 +1772,30 @@ \clist_remove_duplicates:N \l__xeCJK_sub_key_clist \clist_map_inline:Nn \l__xeCJK_sub_key_clist { - \tl_set:Nx \l__xeCJK_sub_family_tl { \l__xeCJK_family_tl/##1 } + \tl_set:Nx \l__xeCJK_sub_family_tl { \l__xeCJK_family_aux_tl/##1 } \bool_if:cT { l__xeCJK_copy_##1_bool } { \__xeCJK_check_family:V \l__xeCJK_sub_family_tl - \prop_get:NVNT \g__xeCJK_family_prop \l__xeCJK_family_tl \l__xeCJK_tmpa_tl + \prop_get:NVNT \g__xeCJK_family_prop \l__xeCJK_family_aux_tl \l__xeCJK_tmpa_tl { \prop_gput:NVV \g__xeCJK_family_prop \l__xeCJK_sub_family_tl \l__xeCJK_tmpa_tl } - \prop_get:NVNT \g__xeCJK_family_options_prop \l__xeCJK_family_tl \l__xeCJK_tmpa_clist + \prop_get:NVNT \g__xeCJK_family_options_prop \l__xeCJK_family_aux_tl \l__xeCJK_tmpa_clist { \clist_remove_all:Nn \l__xeCJK_tmpa_clist { ##1 = * } \prop_gput:NVV \g__xeCJK_family_options_prop \l__xeCJK_sub_family_tl \l__xeCJK_tmpa_clist } \cs_gset_protected_nopar:cpx { __xeCJK/family/\l__xeCJK_sub_family_tl } { - \__xeCJK_family_if_exist:xT { \l__xeCJK_family_tl } + \xeCJK_family_if_exist:xT { \l__xeCJK_family_aux_tl } { \prop_get:NnNT \exp_not:N \g__xeCJK_family_name_prop - { \l__xeCJK_family_tl } \exp_not:N \l__xeCJK_tmpa_tl + { \l__xeCJK_family_aux_tl } \exp_not:N \l__xeCJK_tmpa_tl { \prop_gput:NnV \exp_not:N \g__xeCJK_family_name_prop { \l__xeCJK_sub_family_tl } \exp_not:N \l__xeCJK_tmpa_tl \cs_gset_protected_nopar:cpx { __xeCJK/family/\l__xeCJK_sub_family_tl } \exp_not:n { { - \exp_not:N \fontencoding { \g_fontspec_encoding_tl } + \exp_not:N \fontencoding { \c__xeCJK_encoding_tl } \exp_not:N \fontfamily { \l__xeCJK_tmpa_tl } \exp_not:N \selectfont } } @@ -1786,7 +1812,7 @@ } \cs_new_protected_nopar:Npn \__xeCJK_copy_family:nn #1#2 { - \__xeCJK_family_if_exist:xT {#2} + \xeCJK_family_if_exist:xT {#2} { \tl_map_inline:nn { \g__xeCJK_family_prop \g__xeCJK_family_options_prop \g__xeCJK_family_name_prop } @@ -1795,16 +1821,14 @@ } } \cs_generate_variant:Nn \__xeCJK_copy_family:nn { xx } -\tl_set:Nn \l__xeCJK_font_coor_tl { __xeCJK/\l_xeCJK_family_tl/\f@series/\f@shape/\f@size } +\tl_set:Nn \l_xeCJK_font_coor_tl { __xeCJK/\l_xeCJK_family_tl/\f@series/\f@shape/\f@size } \cs_new_protected_nopar:Npn \xeCJK_select_font: { - \cs_if_exist_use:cF { \l__xeCJK_font_coor_tl } + \cs_if_exist_use:cF { \l_xeCJK_font_coor_tl } { - \tl_set:Nx \l__xeCJK_current_coor_tl \l__xeCJK_font_coor_tl - \__xeCJK_family_if_exist:xTF { \l_xeCJK_family_tl } - { \use:c { __xeCJK/family/\l_xeCJK_family_tl } } - { \use_none:nnnn } - \exp_last_unbraced:NNV \cs_gset_eq:cN \l__xeCJK_current_coor_tl \tex_font:D + \tl_set:Nx \l__xeCJK_current_coor_tl \l_xeCJK_font_coor_tl + \cs_if_exist_use:cT { __xeCJK/family/\l_xeCJK_family_tl } + { \exp_last_unbraced:NNV \cs_gset_eq:cN \l__xeCJK_current_coor_tl \tex_font:D } } } \cs_new_eq:NN \xeCJK@setfont \xeCJK_select_font: @@ -1818,9 +1842,9 @@ { \tl_set:Nx \l__xeCJK_tmpa_tl \l_xeCJK_family_tl \tl_put_right:Nx \l_xeCJK_family_tl { /#2 } - \__xeCJK_family_if_exist:xF \l_xeCJK_family_tl + \xeCJK_family_if_exist:xF \l_xeCJK_family_tl { - \__xeCJK_family_if_exist:xTF { \CJKfamilydefault/#2 } + \xeCJK_family_if_exist:xTF { \CJKfamilydefault/#2 } { \__xeCJK_copy_family:xx \l_xeCJK_family_tl { \CJKfamilydefault/#2 } } { \__xeCJK_copy_family:xx \l_xeCJK_family_tl \l__xeCJK_tmpa_tl } } @@ -1829,7 +1853,7 @@ \xeCJK_select_font: } \__xeCJK_msg_new:nn { CJK-block } { Switch~from~block~'#1'~to~'#2'. } -\prg_new_protected_conditional:Npnn \__xeCJK_family_if_exist:x #1 { T, F, TF } +\prg_new_protected_conditional:Npnn \xeCJK_family_if_exist:x #1 { T, F, TF } { \cs_if_free:cTF { __xeCJK/family/#1 } { \prg_return_false: } @@ -1840,23 +1864,53 @@ } } \cs_generate_variant:Nn \prop_get:NnNTF { Nx } -\NewDocumentCommand \CJKfamily { m } +\NewDocumentCommand \CJKfamily { t+ t- m } { - \cs_if_exist:cTF { __xeCJK/family/#1 } - { \tl_set:Nx \l_xeCJK_family_tl {#1} } + \xeCJK_if_blank_x:nTF {#3} + { + \IfBooleanF {#1} { \IfBooleanF {#2} { \use_none:nn } } + \xeCJK_family_if_exist_use:x { \l_xeCJK_family_tl } + } { - \seq_if_in:NxF \g__xeCJK_unknown_family_seq {#1} + \IfBooleanTF {#2} { \xeCJK_family_if_exist_use:x {#3} } { - \seq_gput_right:Nx \g__xeCJK_unknown_family_seq {#1} - \__xeCJK_warning:nx { CJKfamily-Unknown } {#1} + \xeCJK_family_if_exist:xTF {#3} + { + \tl_set:Nx \l_xeCJK_family_tl {#3} + \tl_set_eq:NN \xeCJK@family \l_xeCJK_family_tl + \IfBooleanT {#1} { \use:c { __xeCJK/family/#3 } } + } + { \__xeCJK_family_unknown_warning:x {#3} } } } \tex_ignorespaces:D } +\cs_new_protected_nopar:Npn \xeCJK_family_if_exist_use:x #1 + { + \xeCJK_family_if_exist:xTF {#1} + { \use:c { __xeCJK/family/#1 } } + { \__xeCJK_family_unknown_warning:x {#1} } + } +\cs_new_protected_nopar:Npn \__xeCJK_family_unknown_warning:x #1 + { + \seq_if_in:NxF \g__xeCJK_unknown_family_seq {#1} + { + \seq_gput_right:Nx \g__xeCJK_unknown_family_seq {#1} + \__xeCJK_warning:nx { CJKfamily-Unknown } {#1} + } + } \seq_new:N \g__xeCJK_unknown_family_seq \__xeCJK_msg_new:nn { CJKfamily-Unknown } { - Unknown~CJK~family~'#1'~is~ignored.\\\\ + Unknown~CJK~family~' + \str_case_x:nnn {#1} + { + \CJKrmdefault { \token_to_str:N \CJKrmdefault } + \CJKsfdefault { \token_to_str:N \CJKsfdefault } + \CJKttdefault { \token_to_str:N \CJKttdefault } + } + {#1} + '~is~ignored.\\\\ Try~to~use~ \str_case_x:nnn {#1} { @@ -1871,9 +1925,9 @@ { \xeCJK_set_family:xnn {#1} {#2} {#3} } \NewDocumentCommand \newCJKfontfamily { o m O{} m } { - \tl_set:Nx \l__xeCJK_family_tl { \IfNoValueTF {#1} { \cs_to_str:N #2 } {#1} } - \xeCJK_set_family:xnn \l__xeCJK_family_tl {#3} {#4} - \cs_new_protected_nopar:Npx #2 { \exp_not:N \CJKfamily { \l__xeCJK_family_tl } } + \tl_set:Nx \l__xeCJK_family_aux_tl { \IfNoValueTF {#1} { \cs_to_str:N #2 } {#1} } + \xeCJK_set_family:xnn \l__xeCJK_family_aux_tl {#3} {#4} + \cs_new_protected_nopar:Npx #2 { \exp_not:N \CJKfamily { \l__xeCJK_family_aux_tl } } } \int_new:N \g__xeCJK_fontspec_int \int_gdecr:N \g__xeCJK_fontspec_int @@ -1929,7 +1983,7 @@ } \clist_put_left:NV \l__xeCJK_tmpa_clist \l__xeCJK_tmpc_clist \use:x - { \group_end: \exp_not:N \CJKfontspec [ \l__xeCJK_tmpa_clist ] { \l__xeCJK_tmpa_tl } } + { \group_end: \CJKfontspec [ \l__xeCJK_tmpa_clist ] { \l__xeCJK_tmpa_tl } } } { \__xeCJK_warning:n { addCJKfontfeature-ignored } } \tex_ignorespaces:D @@ -1972,27 +2026,27 @@ \__xeCJK_check_num_range:nnNN {#1} {#2} \l__xeCJK_tmpa_int \l__xeCJK_tmpb_int \int_set:Nn \l__xeCJK_tmpc_int { \__xeCJK_math_type:n {#3} } \int_set:Nn \l_tmpa_int { \use:c { sym #4 } } - \__xeCJK_int_until_do:nn { \l__xeCJK_tmpa_int > \l__xeCJK_tmpb_int } + \xeCJK_int_until_do:nn { \l__xeCJK_tmpa_int > \l__xeCJK_tmpb_int } { \XeTeXmathcode \l__xeCJK_tmpa_int = \l__xeCJK_tmpc_int \l_tmpa_int \l__xeCJK_tmpa_int \int_incr:N \l__xeCJK_tmpa_int } } \cs_new_eq:NN \__xeCJK_math_type:n \mathchar@type -\cs_new_protected_nopar:Npn \__xeCJK_set_mathfont: +\cs_new_protected_nopar:Npn \xeCJK_set_mathfont: { - \__xeCJK_family_if_exist:xTF \c__xeCJK_math_tl + \xeCJK_family_if_exist:xTF \c__xeCJK_math_tl { \tl_set:Nx \l__xeCJK_tmpa_tl \c__xeCJK_math_tl } { - \__xeCJK_family_if_exist:xTF \CJKfamilydefault + \xeCJK_family_if_exist:xTF \CJKfamilydefault { \tl_set:Nx \l__xeCJK_tmpa_tl \CJKfamilydefault } { \tl_set_eq:NN \l__xeCJK_tmpa_tl \q_no_value } } \prop_get:NVNT \g__xeCJK_family_name_prop \l__xeCJK_tmpa_tl \l__xeCJK_math_family_tl { - \DeclareSymbolFont \c__xeCJK_math_tl \g_fontspec_encoding_tl + \DeclareSymbolFont \c__xeCJK_math_tl \c__xeCJK_encoding_tl \l__xeCJK_math_family_tl \mddefault \shapedefault - \SetSymbolFont \c__xeCJK_math_tl { bold } \g_fontspec_encoding_tl + \SetSymbolFont \c__xeCJK_math_tl { bold } \c__xeCJK_encoding_tl \l__xeCJK_math_family_tl \bfdefault \shapedefault \clist_map_inline:nn { CJK, FullLeft, FullRight } { @@ -2009,7 +2063,7 @@ \normalfont \prop_if_empty:NTF \g__xeCJK_family_prop { \__xeCJK_warning:n { no-CJKfamily } } - { \bool_if:NT \g__xeCJK_math_bool { \__xeCJK_set_mathfont: } } + { \bool_if:NT \g__xeCJK_math_bool { \xeCJK_set_mathfont: } } } \__xeCJK_msg_new:nn { no-CJKfamily } { @@ -2019,14 +2073,15 @@ in~the~preamble~to~declare~the~main~CJKfamily.\\ } \fp_new:N \g__xeCJK_monoscale_fp +\fp_set_eq:NN \g__xeCJK_monoscale_fp \c_one_fp \dim_new:N \g__xeCJK_exspace_dim \NewDocumentCommand \setCJKmonoscale { } { \CJKflexiblespacing - \__xeCJK_set_monoscale: + \xeCJK_set_monoscale: \addCJKfontfeatures { Scale = \fp_use:N \g__xeCJK_monoscale_fp } } -\cs_new_protected_nopar:Npn \__xeCJK_set_monoscale: +\cs_new_protected_nopar:Npn \xeCJK_set_monoscale: { \group_begin: \fontfamily \ttdefault \selectfont @@ -2034,13 +2089,16 @@ { \dim_to_fp:n { \c_two \tex_fontdimen:D \c_two \tex_font:D } / ( \f@size ) } \group_end: } -\NewDocumentCommand \setCJKmonoexspace { } { \__xeCJK_set_monoexspace: } -\cs_new_protected_nopar:Npn \__xeCJK_set_monoexspace: +\NewDocumentCommand \setCJKmonoexspace { } { \xeCJK_set_monoexspace: } +\cs_new_protected_nopar:Npn \xeCJK_set_monoexspace: { \group_begin: \fontfamily \ttdefault \selectfont \dim_gset:Nn \g__xeCJK_exspace_dim - { \c_two \tex_fontdimen:D \c_two \tex_font:D - \f@size \p@ } + { + \c_two \tex_fontdimen:D \c_two \tex_font:D + - \fp_to_dim:n { \g__xeCJK_monoscale_fp * ( \f@size ) } + } \group_end: } \NewDocumentCommand \CJKfixedspacing { } @@ -2048,11 +2106,11 @@ \bool_if:NF \l__xeCJK_fixed_spacing_bool { \bool_set_true:N \l__xeCJK_fixed_spacing_bool - \tl_set_eq:NN \l__xeCJK_flexible_punctstyle_tl \l__xeCJK_punctstyle_tl + \tl_set_eq:NN \l__xeCJK_flexible_punctstyle_tl \l_xeCJK_punctstyle_tl \bool_set_eq:NN \l__xeCJK_fixed_xecglue_bool \l__xeCJK_xecglue_bool \cs_set_eq:NN \__xeCJK_flexible_ecglue: \CJKecglue \cs_set_eq:NN \__xeCJK_flexible_cjkglue: \CJKglue - \__xeCJK_set_monoexspace: + \xeCJK_set_monoexspace: \xeCJKsetup { PunctStyle = plain , @@ -2070,8 +2128,8 @@ \exp_args:Nx \xeCJKsetup { PunctStyle = { \l__xeCJK_flexible_punctstyle_tl } , - CJKglue = { \__xeCJK_flexible_cjkglue: } , - CJKecglue = { \__xeCJK_flexible_ecglue: } , + CJKglue = { \exp_not:o { \__xeCJK_flexible_cjkglue: } } , + CJKecglue = { \exp_not:o { \__xeCJK_flexible_ecglue: } } , xCJKecglue = { \bool_if:NTF \l__xeCJK_fixed_xecglue_bool { true } { false } } , } } @@ -2098,19 +2156,19 @@ { \msg_redirect_module:nnn { xeCJK } { warning } { info } \msg_redirect_module:nnn { xeCJK } { info } { none } - \__xeCJK_if_package_loaded:nF { fontspec } + \xeCJK_if_package_loaded:nF { fontspec } { \PassOptionsToPackage { quiet } { fontspec } } }, silent .code:n = { \msg_redirect_module:nnn { xeCJK } { warning } { none } \msg_redirect_module:nnn { xeCJK } { info } { none } - \__xeCJK_if_package_loaded:nF { fontspec } + \xeCJK_if_package_loaded:nF { fontspec } { \PassOptionsToPackage { silent } { fontspec } } }, unknown .code:n = { - \__xeCJK_if_package_loaded:nTF { fontspec } + \xeCJK_if_package_loaded:nTF { fontspec } { \__xeCJK_error:nx { key-unknown } { \l_keys_key_tl } } { \PassOptionsToPackage { \l_keys_key_tl } { fontspec } } }, @@ -2133,15 +2191,16 @@ EmboldenFactor = 4 , SlantFactor = .167 , PunctStyle = quanjiao , - KaiMingPunct = { . 。? ! } , - LongPunct = { — ‥ … ─ } , - MiddlePunct = { · ・ ・ } , + KaiMingPunct = { ^^^^3002 ^^^^ff0e ^^^^ff1f ^^^^ff01 } , + LongPunct = { ^^^^2014 ^^^^2015 ^^^^2500 ^^^^2025 ^^^^2026 } , + MiddlePunct = { ^^^^2014 ^^^^2015 ^^^^2500 ^^^^00b7 ^^^^30fb ^^^^ff65 } , AllowBreakBetweenPuncts = false , } \cs_new_nopar:Npn \CJKsymbol #1 {#1} \cs_new_nopar:Npn \CJKpunctsymbol #1 {#1} \ProcessKeysOptions { xeCJK / options } \RequirePackage { fontspec } [ 2011/09/13 ] +\tl_const:Nx \c__xeCJK_encoding_tl { \g_fontspec_encoding_tl } \bool_if:NT \g__xeCJK_indent_bool { \cs_set_eq:NN \@afterindentfalse \@afterindenttrue @@ -2163,11 +2222,11 @@ \cs_new_protected_nopar:Npn \__xeCJK_fix_itcorr: { \scan_stop: - \__xeCJK_if_last_node:nTF { default } + \xeCJK_if_last_node:nTF { default } { \tex_unkern:D \tex_unkern:D \__xeCJK_itcorr_aux - { \__xeCJK_make_node:n { default_itcorr } } + { \xeCJK_make_node:n { default_itcorr } } } { \__xeCJK_itcorr_aux } } @@ -2201,13 +2260,13 @@ { \__xeCJK_get_inter_class_toks:nn { Default } { Others } } \exp_args:Nnnx \__xeCJK_pre_inter_class_toks:nnn { Others } {##1} { \__xeCJK_get_inter_class_toks:nn { Others } { Default } } - \__xeCJK_if_blank_x:nT + \xeCJK_if_blank_x:nT { \__xeCJK_get_inter_class_toks:nn { Others } { Boundary } } { \__xeCJK_copy_inter_class_toks:nnnn { Others } { Boundary } { Default } { Boundary } } - \__xeCJK_if_blank_x:nT + \xeCJK_if_blank_x:nT { \__xeCJK_get_inter_class_toks:nn { Boundary } { Others } } { \__xeCJK_copy_inter_class_toks:nnnn @@ -2233,7 +2292,7 @@ \__xeCJK_patch:Nnn \tipaencoding { \makexeCJKinactive } { } \cs_set_eq:NN \__xeCJK_aux_r \r \cs_set_protected_nopar:Npn \r #1 { { \makexeCJKinactive \__xeCJK_aux_r {#1} } } - \__xeCJK_if_package_loaded:nT { pifont } + \xeCJK_if_package_loaded:nT { pifont } { \RenewDocumentCommand \Pifont { m } { \makexeCJKinactive \usefont {U} {#1} {m} {n} } @@ -2245,7 +2304,7 @@ { \bool_if:nT { - \__xeCJK_if_package_loaded_p:n { hyperref } && + \xeCJK_if_package_loaded_p:n { hyperref } && \tl_if_exist_p:N \pdfstringdefPreHook } { @@ -2258,7 +2317,7 @@ } } } -\tl_set:cn { ver@CJK.sty } { 2050/01/01 } +\tl_set:cn { ver@CJK.sty } { 2100/01/01 } \cs_if_free:NT \CJK@ifundefined { \cs_set_eq:NN \CJK@ifundefined \cs_if_free:NTF } \NewDocumentCommand \xeCJKcaption { o m } @@ -2274,26 +2333,26 @@ \__xeCJK_reset_at_catcode: \XeTeXdefaultencoding "UTF-8" } -\cs_new_protected_nopar:Npn \__xeCJK_ULprepunctchar:n #1 +\cs_new_protected_nopar:Npn \xeCJK_ULprepunctchar:n #1 { - { \makexeCJKinactive \CJKpunctsymbol {#1} \__xeCJK_no_break: } + { \makexeCJKinactive \CJKpunctsymbol {#1} \xeCJK_no_break: } \tex_ignorespaces:D } -\cs_new_protected_nopar:Npn \__xeCJK_ULpostpunctchar:n #1 +\cs_new_protected_nopar:Npn \xeCJK_ULpostpunctchar:n #1 { { \makexeCJKinactive \CJKpunctsymbol {#1} } - \__xeCJK_ignorespaces: + \xeCJK_ignorespaces: } -\cs_new_protected_nopar:Npn \__xeCJK_ULroutines: +\cs_new_protected_nopar:Npn \xeCJK_ULroutines: { \__xeCJK_inter_class_toks:nnn { Default } { CJK } { \CJKecglue \CJKsymbol } \__xeCJK_inter_class_toks:nnn { HalfLeft } { CJK } { \CJKsymbol } \__xeCJK_inter_class_toks:nnn { HalfRight } { CJK } { \CJKecglue \CJKsymbol } - \__xeCJK_inter_class_toks:nnn { Boundary } { CJK } { \__xeCJK_Boundary_and_CJK: } + \__xeCJK_inter_class_toks:nnn { Boundary } { CJK } { \xeCJK_Boundary_and_CJK: } \clist_map_inline:nn { Default, HalfLeft, HalfRight, Boundary } { - \__xeCJK_inter_class_toks:nnn {##1} { FullLeft } { \__xeCJK_ULprepunctchar:n } - \__xeCJK_inter_class_toks:nnn {##1} { FullRight } { \__xeCJK_ULpostpunctchar:n } + \__xeCJK_inter_class_toks:nnn {##1} { FullLeft } { \xeCJK_ULprepunctchar:n } + \__xeCJK_inter_class_toks:nnn {##1} { FullRight } { \xeCJK_ULpostpunctchar:n } } \__xeCJK_UL_subclass_patch_tl } @@ -2308,11 +2367,11 @@ \cs_set_protected_nopar:Npn \CJKsymbol #1 { { \xeCJK_select_font: \__xeCJK_UL_CJKsymbol {#1} } - { \__xeCJK_make_node:n { CJK } } \__xeCJK_ignorespaces: + { \xeCJK_make_node:n { CJK } } \xeCJK_ignorespaces: } \cs_set_protected_nopar:Npn \CJKpunctsymbol #1 { { \xeCJK_select_font: \__xeCJK_UL_CJKpunctsymbol {#1} } } - \__xeCJK_ULroutines: + \xeCJK_ULroutines: } } \cs_if_exist:NT \XeTeX@CJKfntef@hook @@ -2329,9 +2388,9 @@ \cs_set_protected_nopar:Npn \Unicode #1#2 { \tex_char:D \int_eval:n { (#1) * \c_two_hundred_fifty_six + (#2) } } \RequirePackage { CJKnumb } - \use:c { __xeCJK_enc_\CJK@UnicodeEnc } - \tl_set:Nn \CJK@tenthousand { 万 } - \tl_set:Nn \CJK@hundredmillion { 亿 } + \cs_if_exist_use:cT { __xeCJK_enc_\CJK@UnicodeEnc } { } + \tl_set:Nx \CJK@tenthousand { ^^^^4e07 } + \tl_set:Nx \CJK@hundredmillion { ^^^^4ebf } } %% %% This package consists of the file xeCJK.dtx -- cgit v1.2.3