summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/xelatex/xecjk
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2013-08-18 23:36:18 +0000
committerKarl Berry <karl@freefriends.org>2013-08-18 23:36:18 +0000
commit63a2bf1ad66c853ca9858eec2ca115d3c2267f43 (patch)
tree4d65a306b518b02ea7566282d1b3f341481f583e /Master/texmf-dist/source/xelatex/xecjk
parent61f0c1ea7acefd4a1ab37a9464f28c1331d1d897 (diff)
xecjk (18aug13)
git-svn-id: svn://tug.org/texlive/trunk@31466 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/xelatex/xecjk')
-rw-r--r--Master/texmf-dist/source/xelatex/xecjk/xeCJK.dtx630
-rw-r--r--Master/texmf-dist/source/xelatex/xecjk/xeCJK.ins4
2 files changed, 356 insertions, 278 deletions
diff --git a/Master/texmf-dist/source/xelatex/xecjk/xeCJK.dtx b/Master/texmf-dist/source/xelatex/xecjk/xeCJK.dtx
index ce3deb0783f..61cc1e1a36b 100644
--- a/Master/texmf-dist/source/xelatex/xecjk/xeCJK.dtx
+++ b/Master/texmf-dist/source/xelatex/xecjk/xeCJK.dtx
@@ -90,7 +90,7 @@ CJK scripts fonts (TrueType or OpenType).
\askforoverwritefalse
\preamble
-$Id: xeCJK.dtx 477 2013-07-25 22:15:20Z sobenlee $
+$Id: xeCJK.dtx 510 2013-08-15 23:20:17Z sobenlee $
$URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
-----------------------------------------------------------------
Author:
@@ -189,7 +189,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
\NeedsTeXFormat{LaTeX2e}
\RequirePackage{expl3}
%</!config>
-\GetIdInfo$Id: xeCJK.dtx 477 2013-07-25 22:15:20Z sobenlee $
+\GetIdInfo$Id: xeCJK.dtx 510 2013-08-15 23:20:17Z sobenlee $
%<*driver|package>
{Typesetting CJK scripts with XeLaTeX}
%</driver|package>
@@ -209,9 +209,9 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
%<fntef> {xeCJKfntef}
%<listings> {xeCJK-listings}
%<xunicode> {xunicode-addon}
- {\ExplFileDate}{3.2.5}{\ExplFileDescription}
+ {\ExplFileDate}{3.2.6}{\ExplFileDescription}
%<*driver>
-\def\xeCJKversion{3.2.5}
+\def\xeCJKversion{3.2.6}
\let\xeCJKdate\ExplFileDate
\let\xeCJKrevnum\ExplFileVersion
\ExplSyntaxOff
@@ -335,12 +335,13 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
%</driver>
% \fi
%
-% \CheckSum{5213}
+% \CheckSum{5262}
% \changes{v3.1.0}{2012/11/13}{放弃对 \cs{outer} 宏的特殊处理。}
% \changes{v3.1.1}{2012/12/07}{不再依赖 \pkg{xpatch} 宏包。}
% \changes{v3.2.2}{2013/06/01}{修正某些重音不能正确显示的问题。}
% \changes{v3.2.3}{2013/06/07}{提供四个 TECkit 映射文件用于句号转换和简繁互换。}
% \changes{v3.2.4}{2013/07/02}{遵循 \hologo{LaTeX3} 变量需要预先声明的原则。}
+% \changes{v3.2.6}{2013/07/29}{\texttt{case} 类函数的用法与 \hologo{LaTeX3} 同步。}
%
%
% \title{\bfseries\pkg{xeCJK} 宏包}
@@ -1402,7 +1403,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
using~your~TeX~package~manager~or~from~CTAN.\\
\str_if_eq:nnT {#1} { expl3 } { Loading~xeCJK~will~abort! }
}
-\@ifpackagelater { expl3 } { 2012/11/10 } { }
+\@ifpackagelater { expl3 } { 2013/07/20 } { }
{ \msg_critical:nnn { xeCJK } { l3-too-old } { expl3 } }
% \end{macrocode}
%
@@ -1436,6 +1437,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
% 各种信息函数的缩略形式。
% \begin{macrocode}
\cs_new_protected_nopar:Npn \@@_msg_new:nn { \msg_new:nnn { xeCJK } }
+\cs_new_protected_nopar:Npn \@@_msg_new:nnn { \msg_new:nnnn { xeCJK } }
\cs_new_protected_nopar:Npn \@@_error:n { \msg_error:nn { xeCJK } }
\cs_new_protected_nopar:Npn \@@_error:nx { \msg_error:nnx { xeCJK } }
\cs_new_protected_nopar:Npn \@@_warning:n { \msg_warning:nn { xeCJK } }
@@ -2908,13 +2910,54 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
%
% \hypertarget{cjk-bound}{}
% \begin{macrocode}
-\xeCJK_inter_class_toks:nnn { CJK } { Boundary }
+\xeCJK_inter_class_toks:nnn { CJK } { Boundary } { \xeCJK_CJK_and_Boundary:w }
+% \end{macrocode}
+%
+% \begin{macro}[internal]{\xeCJK_CJK_and_Boundary:w}
+% \changes{v3.2.6}{2013/08/05}{更好的处理边界是 \cs{relax} 的情况。}
+% 当边界是 \cs{relax} 的时候,它可能是由 |\csname ...\endcsname| 的形式产生的,
+% 这样就可能出现问题\footnote{参见 \url{http://bbs.ctex.org/forum.php?mod=viewthread&tid=71563}。}。
+% 原来是都在未定义控制序列前都加上 \cs{exp_not:N},现在是采用分组结束后手工恢复的方式。
+% \begin{macrocode}
+\cs_new_protected_nopar:Npn \xeCJK_CJK_and_Boundary:w
{
- \xeCJK_class_group_end:
- { \xeCJK_make_node:n { CJK } }
- \xeCJK_ignore_spaces:w
+ \xeCJK_peek_catcode_ignore_spaces:NTF \c_math_toggle_token
+ {
+ \bool_if:NTF \l_@@_peek_ignore_spaces_bool
+ { \xeCJK_class_group_end: \xeCJK_space_or_xecglue: }
+ { \xeCJK_class_group_end: \CJKecglue }
+ }
+ {
+ \bool_if:NTF \l_@@_peek_ignore_spaces_bool
+ {
+ \bool_if:nTF
+ {
+ \token_if_macro_p:N \l_peek_token ||
+ ( \l_@@_reserve_space_bool && \token_if_letter_p:N \l_peek_token )
+ }
+ {
+ \xeCJK_class_group_end: { \xeCJK_make_node:n { CJK-space } }
+ \xeCJK_space_or_xecglue:
+ }
+ { \xeCJK_class_group_end: { \xeCJK_make_node:n { CJK-space } } }
+ }
+ {
+ \token_if_eq_meaning:NNTF \l_peek_token \scan_stop:
+ { \@@_CJK_and_Boundary_relax:N }
+ { \@@_CJK_and_Boundary_aux: }
+ }
+ }
+ }
+\cs_new_protected_nopar:Npn \@@_CJK_and_Boundary_aux:
+ { \xeCJK_class_group_end: { \xeCJK_make_node:n { CJK } } }
+\cs_new_protected:Npn \@@_CJK_and_Boundary_relax:N #1
+ {
+ \@@_CJK_and_Boundary_aux:
+ \token_if_eq_meaning:NNTF #1 \scan_stop:
+ {#1} { \cs_set_eq:NN #1 \scan_stop: #1 }
}
% \end{macrocode}
+% \end{macro}
%
% \begin{macro}[internal]{\xeCJK_ignore_spaces:w}
% \begin{macrocode}
@@ -2926,23 +2969,19 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
{ \xeCJK_space_or_xecglue: } { \CJKecglue }
}
{
- \bool_if:NTF \l_@@_peek_ignore_spaces_bool
+ \bool_if:NT \l_@@_peek_ignore_spaces_bool
{
- \xeCJK_remove_node:
- { \xeCJK_make_node:n { CJK-space } }
+ \xeCJK_if_last_node:nT { CJK }
+ { \xeCJK_remove_node: { \xeCJK_make_node:n { CJK-space } } }
\bool_if:nT
{
\token_if_macro_p:N \l_peek_token ||
- ( \l_@@_reserve_space_bool &&
- \token_if_letter_p:N \l_peek_token )
+ ( \l_@@_reserve_space_bool && \token_if_letter_p:N \l_peek_token )
}
{ \xeCJK_space_or_xecglue: }
}
- { \@@_CJK_and_Boundary_aux: }
}
}
-\cs_new_protected_nopar:Npn \@@_CJK_and_Boundary_aux:
- { \cs_if_exist:NF \l_peek_token \exp_not:N }
% \end{macrocode}
% \end{macro}
%
@@ -3177,7 +3216,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
% \begin{macrocode}
\cs_new_protected_nopar:Npn \@@_Boundary_and_FullLeft_glue:N #1
{
- \int_case:nnn { \etex_lastnodetype:D }
+ \int_case:nnTF { \etex_lastnodetype:D }
{
{ \c_one }
{
@@ -3226,7 +3265,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
{ \use:n }
}
}
- { \use:n }
+ { { \@@_punct_glue:NN \c_@@_left_tl {#1} } }
{ \@@_punct_glue:NN \c_@@_left_tl {#1} }
}
% \end{macrocode}
@@ -3428,11 +3467,15 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
{
\xeCJK_get_punct_bounds:NN \c_@@_right_tl \g_@@_last_punct_tl
\@@_punct_rule:NN \c_@@_right_tl \g_@@_last_punct_tl
- \tl_case:Non \l_peek_token { \l_@@_no_break_cs_case_tl } { }
+ \group_align_safe_begin:
+ \tl_case:NoTF \l_peek_token
+ { \l_@@_no_break_cs_case_tl }
+ { \group_align_safe_end: \xeCJK_no_break: }
+ { \group_align_safe_end: }
\@@_punct_glue:NN \c_@@_right_tl \g_@@_last_punct_tl
\xeCJK_class_group_end:
}
-\cs_generate_variant:Nn \tl_case:Nnn { No }
+\cs_generate_variant:Nn \tl_case:NnTF { No }
% \end{macrocode}
% \end{macro}
%
@@ -3482,7 +3525,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
% 设置不能在全角右标点之后断行的控制序列。
% \begin{macrocode}
\xeCJK_cs_case_keys_define:nNNnn { NoBreakCS }
- \l_@@_no_break_cs_case_tl \l_@@_no_break_cs_seq { \xeCJK_no_break: } { }
+ \l_@@_no_break_cs_case_tl \l_@@_no_break_cs_seq { } { }
% \end{macrocode}
% \end{macro}
%
@@ -3543,12 +3586,14 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
\peek_catcode:NTF \c_catcode_letter_token
{ \xeCJK_check_single:NNw #1 }
{
+ \group_align_safe_begin:
\token_if_other:NTF \l_peek_token
- { \xeCJK_check_single:NNw #1 }
+ { \group_align_safe_end: \xeCJK_check_single:NNw #1 }
{
+ \group_align_safe_end:
\bool_if:nTF
{
- \xeCJK_if_blank_x_p:n { \token_get_arg_spec:N \l_peek_token } &&
+ \str_if_eq_x_p:nn { \token_get_arg_spec:N \l_peek_token } { } &&
\exp_args:No \tl_if_single_token_p:n \l_peek_token &&
( \exp_after:wN \token_if_other_p:N \l_peek_token ||
\exp_after:wN \token_if_letter_p:N \l_peek_token )
@@ -3663,14 +3708,14 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
% l.10 \item
% \end{verbatim}
% 原因在于 \env{tabenum} 实际上是一个 \TeX 对齐环境(\cs{halign}),\cs{par} 在
-% 其中被重定义为 \cs{cr}。而在下面 \cs{tl_case:Nnn} 的分支里有对 \cs{par} 的
+% 其中被重定义为 \cs{cr}。而在下面 \cs{tl_case:NnF} 的分支里有对 \cs{par} 的
% \cs{ifx} 判断。解决办法是将判断用 \cs{group_align_safe_begin:} 和
% \cs{group_align_safe_end:} 包起来。或者改用原语 \cs{tex_par:D} 作为判断条件。
% \begin{macrocode}
\cs_new_protected_nopar:Npn \xeCJK_check_single_cs:NNn #1#2#3
{
\group_align_safe_begin:
- \tl_case:Non \l_peek_token
+ \tl_case:NoF \l_peek_token
{ \l_@@_check_single_cs_case_tl }
{ \group_align_safe_end: \use_iii:nnn }
{ \xeCJK_check_single_env:nnNn }
@@ -3681,6 +3726,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
{ \@@_check_single_save:N #1 #2#3 }
}
\tl_new:N \l_@@_check_single_cs_case_tl
+\cs_generate_variant:Nn \tl_case:NnF { No }
% \end{macrocode}
% \end{macro}
%
@@ -3689,13 +3735,13 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
\cs_new_protected_nopar:Npn \xeCJK_check_single_env:nnNn #1#2#3#4
{
\group_align_safe_begin:
- \str_case_x:non {#4}
+ \str_case_x:noTF {#4}
{ \l_@@_inline_env_case_tl }
- { \group_align_safe_end: \use_i:nn }
- {#1} {#2}
- \scan_stop: #3 {#4}
+ { \group_align_safe_end: #2 }
+ { \group_align_safe_end: #1 }
+ #3 {#4}
}
-\cs_generate_variant:Nn \str_case_x:nnn { no }
+\cs_generate_variant:Nn \str_case_x:nnTF { no }
% \end{macrocode}
% \end{macro}
%
@@ -3762,7 +3808,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
{
\tl_clear:N \l_@@_inline_env_case_tl
\seq_map_inline:Nn \l_@@_inline_env_seq
- { \tl_put_right:Nn \l_@@_inline_env_case_tl { {##1} { \use_ii:nn } } }
+ { \tl_put_right:Nn \l_@@_inline_env_case_tl { {##1} { } } }
}
\tl_new:N \l_@@_inline_env_case_tl
% \end{macrocode}
@@ -4841,34 +4887,30 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}[internal]
-% {\g_@@_features_id_prop, BoldFont, ItalicFont, BoldItalicFont,
-% SlantedFont, BoldSlantedFont,BoldFeatures, ItalicFeatures,
-% BoldItalicFeatures, SlantedFeatures, BoldSlantedFeatures}
+% \begin{macro}[internal]{BoldFont,ItalicFont}
% 调用字体的属性声明,同 \pkg{fontspec} 宏包。
% \begin{macrocode}
-\prop_new:N \g_@@_features_id_prop
-\prop_put:Nnn \g_@@_features_id_prop { bf } { Bold }
-\prop_put:Nnn \g_@@_features_id_prop { it } { Italic }
-\prop_put:Nnn \g_@@_features_id_prop { bfit } { BoldItalic }
-\prop_put:Nnn \g_@@_features_id_prop { sl } { Slanted }
-\prop_put:Nnn \g_@@_features_id_prop { bfsl } { BoldSlanted }
-\prop_map_inline:Nn \g_@@_features_id_prop
+\keys_define:nn { xeCJK / features }
{
- \keys_define:nn { xeCJK / features }
- {
- #2Font .tl_set:c = { l_@@_font_name_#1_tl } ,
- #2Features .clist_set:c = { l_@@_font_feat_#1_clist }
- }
+ BoldFont .tl_set:N = \l_@@_font_name_bf_tl ,
+ ItalicFont .tl_set:N = \l_@@_font_name_it_tl
}
% \end{macrocode}
% \end{macro}
%
+% \changes{v3.2.6}{2013/07/31}{\texttt{AutoFakeBold} 和 \texttt{AutoFakeSlant}
+% 选项直接使用 \pkg{fontspec} 的设置,修正不能调用相应实际字体的问题。}
+%
% \begin{macro}[internal]{AutoFakeBold, AutoFakeSlant}
% \begin{macrocode}
\keys_define:nn { xeCJK / features }
{
AutoFakeBold .choice: ,
+ AutoFakeBold / true .code:n =
+ {
+ \bool_set_true:N \l_@@_auto_fake_bold_bool
+ \fp_set_eq:NN \l_@@_embolden_factor_fp \g_@@_embolden_factor_fp
+ } ,
AutoFakeBold / false .code:n =
{ \bool_set_false:N \l_@@_auto_fake_bold_bool } ,
AutoFakeBold / unknown .code:n =
@@ -4876,8 +4918,13 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
\bool_set_true:N \l_@@_auto_fake_bold_bool
\fp_set:Nn \l_@@_embolden_factor_fp { \l_keys_value_tl }
} ,
- AutoFakeBold .default:n = { \g_@@_embolden_factor_fp } ,
+ AutoFakeBold .default:n = { true } ,
AutoFakeSlant .choice: ,
+ AutoFakeSlant / true .code:n =
+ {
+ \bool_set_true:N \l_@@_auto_fake_slant_bool
+ \fp_set_eq:NN \l_@@_slant_factor_fp \g_@@_slant_factor_fp
+ } ,
AutoFakeSlant / false .code:n =
{ \bool_set_false:N \l_@@_auto_fake_slant_bool } ,
AutoFakeSlant / unknown .code:n =
@@ -4885,7 +4932,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
\bool_set_true:N \l_@@_auto_fake_slant_bool
\fp_set:Nn \l_@@_slant_factor_fp { \l_keys_value_tl }
} ,
- AutoFakeSlant .default:n = { \g_@@_slant_factor_fp }
+ AutoFakeSlant .default:n = { true }
}
% \end{macrocode}
% \end{macro}
@@ -4895,21 +4942,16 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
\cs_new_protected_nopar:Npn \@@_set_family_initial:
{
\int_gincr:N \g_@@_family_int
- \prop_clear:N \l_@@_add_font_prop
\prop_clear:N \l_@@_sub_key_prop
- \prop_map_inline:Nn \g_@@_features_id_prop
- {
- \tl_clear:c { l_@@_font_name_##1_tl }
- \clist_clear:c { l_@@_font_feat_##1_clist }
- }
+ \tl_clear:N \l_@@_font_name_bf_tl
+ \tl_clear:N \l_@@_font_name_it_tl
\clist_clear:N \l_@@_fontspec_options_clist
- \bool_set_eq:NN \l_@@_auto_fake_bold_bool \g_@@_auto_fake_bold_bool
- \bool_set_eq:NN \l_@@_auto_fake_slant_bool \g_@@_auto_fake_slant_bool
+ \bool_set_eq:NN \l_@@_auto_fake_bold_bool \g_@@_auto_fake_bold_bool
+ \bool_set_eq:NN \l_@@_auto_fake_slant_bool \g_@@_auto_fake_slant_bool
\fp_set_eq:NN \l_@@_embolden_factor_fp \g_@@_embolden_factor_fp
\fp_set_eq:NN \l_@@_slant_factor_fp \g_@@_slant_factor_fp
}
\int_new:N \g_@@_family_int
-\prop_new:N \l_@@_add_font_prop
\prop_new:N \l_@@_sub_key_prop
\clist_new:N \l_@@_fontspec_options_clist
\bool_new:N \l_@@_auto_fake_bold_bool
@@ -4934,8 +4976,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
\@@_remove_duplicate_keys:N \l_@@_font_options_clist
\keys_set_known:nVN { xeCJK / features }
\l_@@_font_options_clist \l_@@_fontspec_options_clist
- \@@_parse_features:
- \@@_pass_features:
+ \@@_parse_font_shape:
\@@_check_family:V \l_@@_family_name_tl
\@@_gset_family_cs:x { \l_@@_family_name_tl }
\@@_save_family_info:
@@ -4985,7 +5026,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
\cs_gset_protected_nopar:cpx { \@@_family_csname:n {#1} }
{
\group_begin:
- \exp_not:n { \cs_set_eq:NN \@@_update_family:n \use_none:n }
+ \exp_not:n { \cs_set_eq:NN \@@_update_family:n \use_none:nn }
\exp_not:n { \fontspec_set_family:Nnn \l_@@_fontspec_family_tl }
{ \exp_not:V \l_@@_fontspec_options_clist }
{ \exp_not:V \l_@@_font_name_tl }
@@ -5001,7 +5042,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
% \begin{macrocode}
\cs_new_protected_nopar:Npn \@@_check_family:n #1
{
- \prop_get:NnNT \g_@@_family_font_name_prop {#1} \l_@@_tmp_tl
+ \prop_gpop:NnNT \g_@@_family_font_name_prop {#1} \l_@@_tmp_tl
{
\prop_gpop:NnNT \g_@@_family_name_prop {#1} \l_@@_tmp_tl
{ \cs_undefine:c { \@@_family_nfss_csname:n {#1} } }
@@ -5014,154 +5055,34 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}[internal]{\@@_add_font:nn,\@@_add_font_if_new:nn}
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \@@_add_font:nn #1#2
- { \prop_put:Nnn \l_@@_add_font_prop { #1 Font } {#2} }
-\cs_new_protected_nopar:Npn \@@_add_font_if_new:nn #1#2
- { \prop_put_if_new:Nnn \l_@@_add_font_prop { #1 Font } {#2} }
-\cs_generate_variant:Nn \@@_add_font:nn { nx , nV , nv }
-\cs_generate_variant:Nn \@@_add_font_if_new:nn { nx , nV , nv }
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}[internal]{\@@_add_fake_bold:n,\@@_add_fake_slant:n}
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \@@_add_fake_bold:n #1
- {
- \clist_put_left:cx { l_@@_font_feat_#1_clist }
- { FakeBold = { \fp_use:N \l_@@_embolden_factor_fp } }
- }
-\cs_new_protected_nopar:Npn \@@_add_fake_slant:n #1
- {
- \clist_put_left:cx { l_@@_font_feat_#1_clist }
- { FakeSlant = { \fp_use:N \l_@@_slant_factor_fp } }
- }
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}[internal]{\@@_parse_features:,\@@_parse_features:nn}
+% \begin{macro}[internal]{\@@_parse_font_shape:}
% \begin{macrocode}
-\cs_new_protected_nopar:Npn \@@_parse_features:
- { \prop_map_function:NN \g_@@_features_id_prop \@@_parse_features:nn }
-\cs_new_protected_nopar:Npn \@@_parse_features:nn #1#2
+\cs_new_protected_nopar:Npn \@@_parse_font_shape:
{
- \@@_if_font_select:nTF {#1}
+ \tl_if_blank:VTF \l_@@_font_name_bf_tl
{
- \@@_add_font:nv {#2} { l_@@_font_name_#1_tl }
- \@@_if_it_or_sl:nTF {#1}
- {
- \@@_if_font_select:nF { bf #1 }
- { \@@_add_font_if_new:nv {#2} { l_@@_font_name_#1_tl } }
- }
+ \bool_if:NT \l_@@_auto_fake_bold_bool
{
- \str_if_eq:nnT {#1} { bf }
- {
- \@@_if_font_select:nF { bfit }
- { \@@_add_font:nV { BoldItalic } \l_@@_font_name_bf_tl }
- \@@_if_font_select:nF { bfsl }
- { \@@_add_font:nV { BoldSlanted } \l_@@_font_name_bf_tl }
- }
+ \clist_put_right:Nx \l_@@_fontspec_options_clist
+ { AutoFakeBold = { \fp_use:N \l_@@_embolden_factor_fp } }
}
}
- { \@@_set_fake_font:nn {#1} {#2} }
- }
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}[pTF,internal]{\@@_if_font_select:n,\@@_if_it_or_sl:n}
-% \begin{macrocode}
-\prg_new_conditional:Npnn \@@_if_font_select:n #1 { p , T , F , TF }
- {
- \tl_if_blank:vTF { l_@@_font_name_#1_tl }
- { \prg_return_false: } { \prg_return_true: }
- }
-\prg_new_conditional:Npnn \@@_if_it_or_sl:n #1 { p , T , F , TF }
- {
- \if_predicate:w
- \bool_if_p:n { \str_if_eq_p:nn { it } {#1} || \str_if_eq_p:nn { sl } {#1} }
- \prg_return_true: \else: \prg_return_false: \fi:
- }
-\cs_generate_variant:Nn \tl_if_blank:nTF { v }
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}[internal]{\@@_set_fake_font:nn}
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \@@_set_fake_font:nn #1#2
- {
- \str_if_eq:nnTF {#1} { bf }
- { \bool_if:NT \l_@@_auto_fake_bold_bool { \@@_add_fake_bold:n {#1} } }
{
- \bool_if:NTF \l_@@_auto_fake_slant_bool
- {
- \bool_if:nT
- { \@@_if_it_or_sl_p:n {#1}
- || ( \str_if_eq_p:nn {#1} { bfit }
- && ! ( \@@_if_font_select_p:n { it } ) )
- || ( \str_if_eq_p:nn {#1} { bfsl }
- && ! ( \@@_if_font_select_p:n { sl } ) )
- }
- { \@@_add_fake_slant:n {#1} }
- }
- { \@@_if_it_or_sl:nT {#1} { \@@_map_it_sl:nn {#1} {#2} } }
- \bool_if:nT
- { \l_@@_auto_fake_bold_bool
- && ! ( \@@_if_it_or_sl_p:n {#1} )
- && ! ( \@@_if_font_select_p:n { bf } )
- }
- { \@@_add_fake_bold:n {#1} }
+ \clist_put_right:Nx \l_@@_fontspec_options_clist
+ { BoldFont = { \exp_not:V \l_@@_font_name_bf_tl } }
}
- \@@_add_font_if_new:nn {#2} { * }
- }
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}[internal]{\@@_map_it_sl:n}
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \@@_map_it_sl:nn #1#2
- {
- \@@_if_map_font_select:nT {#1}
+ \tl_if_blank:VTF \l_@@_font_name_it_tl
{
- \@@_add_font:nx {#2} { \@@_get_map_font:n {#1} }
- \@@_if_font_select:nF { bf #1 }
- { \@@_add_font_if_new:nx { Bold #2 } { \@@_get_map_font:n {#1} } }
- }
- }
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}[internal]{\@@_get_map_font:n}
-% \begin{macrocode}
-\cs_new_nopar:Npn \@@_get_map_font:n #1
- { \exp_not:v { l_@@_font_name_ \xeCJK_reverse:nnn {#1} { it } { sl } _tl } }
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}[pTF,internal]{\@@_if_map_font_select:n}
-% \begin{macrocode}
-\prg_new_conditional:Npnn \@@_if_map_font_select:n #1 { p , T , F , TF }
- {
- \xeCJK_if_blank_x:nTF { \@@_get_map_font:n {#1} }
- { \prg_return_false: } { \prg_return_true: }
- }
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}[internal]{\@@_pass_features:}
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \@@_pass_features:
- {
- \prop_map_inline:Nn \g_@@_features_id_prop
- {
- \clist_if_empty:cF { l_@@_font_feat_##1_clist }
+ \bool_if:NT \l_@@_auto_fake_slant_bool
{
\clist_put_right:Nx \l_@@_fontspec_options_clist
- { ##2Features = { \exp_not:v { l_@@_font_feat_##1_clist } } }
+ { AutoFakeSlant = { \fp_use:N \l_@@_slant_factor_fp } }
}
}
- \prop_map_inline:Nn \l_@@_add_font_prop
- { \clist_put_right:Nn \l_@@_fontspec_options_clist { ##1 = {##2} } }
+ {
+ \clist_put_right:Nx \l_@@_fontspec_options_clist
+ { ItalicFont = { \exp_not:V \l_@@_font_name_it_tl } }
+ }
}
% \end{macrocode}
% \end{macro}
@@ -5179,12 +5100,10 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
% \begin{macrocode}
\cs_new_protected_nopar:Npn \@@_save_family_info:
{
- \group_begin:
\prop_gput:NVV \g_@@_family_font_name_prop
\l_@@_family_name_tl \l_@@_font_name_tl
\prop_gput:NVV \g_@@_family_font_options_prop
\l_@@_family_name_tl \l_@@_font_options_clist
- \group_end:
}
% \end{macrocode}
% \end{macro}
@@ -5750,6 +5669,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
% \end{macro}
%
% \begin{macro}[internal]{\xeCJK_set_mathfont:}
+% \changes{v3.2.6}{2013/08/01}{设置粗体时先检查对应字体是否存在。}
% 当没有设置 CJK 数学字体时,使用 \cs{CJKfamilydefault} 作为数学字体。
% \begin{macrocode}
\cs_new_protected_nopar:Npn \xeCJK_set_mathfont:
@@ -5764,10 +5684,14 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
\prop_get:NVNT \g_@@_family_name_prop \l_@@_tmp_tl \l_@@_tmp_tl
{
\tl_const:Nx \c_@@_math_family_tl { \l_@@_tmp_tl }
- \DeclareSymbolFont \c_@@_math_tl
- \c_@@_encoding_tl \c_@@_math_family_tl \mddefault \shapedefault
- \SetSymbolFont \c_@@_math_tl { bold }
- \c_@@_encoding_tl \c_@@_math_family_tl \bfdefault \shapedefault
+ \DeclareSymbolFont { \c_@@_math_tl } { \c_@@_encoding_tl }
+ { \c_@@_math_family_tl } { \mddefault } { \shapedefault }
+ \cs_if_free:cF
+ { \c_@@_encoding_tl/\c_@@_math_family_tl/\bfdefault/\shapedefault }
+ {
+ \SetSymbolFont { \c_@@_math_tl } { bold } { \c_@@_encoding_tl }
+ { \c_@@_math_family_tl } { \bfdefault } { \shapedefault }
+ }
\int_const:Nn \c_xeCJK_math_fam_int { \use:c { sym \c_@@_math_tl } }
\clist_concat:NNN \l_@@_tmp_clist
\c_@@_CJK_chars_clist \c_@@_FullLeft_chars_clist
@@ -5883,7 +5807,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
\cs_set_eq:NN \@@_verb_CJKglue: \CJKglue
\cs_set_eq:NN \@@_verb_CJKecglue: \CJKecglue
\cs_set_eq:NN \@@_verb_check_for_glue: \xeCJK_check_for_glue:
- \cs_set_eq:NN \@@_verb_ignore_spaces:w \xeCJK_ignore_spaces:w
+ \cs_set_eq:NN \@@_verb_boundary:w \xeCJK_CJK_and_Boundary:w
\cs_set_protected_nopar:Npx \xeCJKOffVerbAddon
{
\@@_reset_char_class:n { FullLeft }
@@ -5899,7 +5823,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
\cs_set_eq:NN \CJKglue \@@_verb_CJKglue:
\cs_set_eq:NN \CJKecglue \@@_verb_CJKecglue:
\cs_set_eq:NN \xeCJK_check_for_glue: \@@_verb_check_for_glue:
- \cs_set_eq:NN \xeCJK_ignore_spaces:w \@@_verb_ignore_spaces:w
+ \cs_set_eq:NN \xeCJK_CJK_and_Boundary:w \@@_verb_boundary:w
}
}
\tex_output:D \exp_after:wN \exp_after:wN \exp_after:wN
@@ -5921,8 +5845,10 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
\cs_set_eq:NN \CJKecglue \@@_verb_ecglue:
}
\cs_set_eq:NN \xeCJK_check_for_glue: \CJKecglue
- \cs_set_eq:NN \xeCJK_ignore_spaces:w \CJKecglue
+ \cs_set_eq:NN \xeCJK_CJK_and_Boundary:w \@@_verb_CJK_and_Boundary:w
}
+\cs_new_protected_nopar:Npn \@@_verb_CJK_and_Boundary:w
+ { \xeCJK_class_group_end: \CJKecglue }
\cs_new_protected_nopar:Npn \@@_verb_ccglue:
{ \xeCJK_no_break: \skip_horizontal:N \l_@@_verb_exspace_skip }
\cs_new_protected_nopar:Npn \@@_verb_ecglue:
@@ -6218,7 +6144,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
% 执行宏包选项,并载入 \pkg{fontspec} 宏包和 \pkg{xunicode-addon}。
% \begin{macrocode}
\ProcessKeysOptions { xeCJK / options }
-\RequirePackage { fontspec } [ 2011/09/13 ]
+\RequirePackage { fontspec } [ 2012/05/01 ]
\RequirePackage { xunicode-addon }
% \end{macrocode}
%
@@ -6342,41 +6268,101 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
%
% \subsection{兼容性修补}
%
-% \begin{macro}[internal]{\(}
+% \begin{macro}[internal]{\fontspec_setup_maths:,\mathrm}
+% \changes{v3.2.6}{2013/08/02}{为 \cs{mathrm} 减少一个可能的数学字体族。}
+% 如果没有设置 \cs{setboldmathrm},即 \cs{g_fontspec_bfmathrm_tl} 为空,那么
+% \cs{mathrm} 的字体实际与 \texttt{operators} 字体族完全一致。这时候应该通过
+% \cs{DeclareSymbolFontAlphabet} 来定义 \cs{mathrm},避免使用它的时候再声明
+% 一个重复的数学字体族。
+% \begin{macrocode}
+\cs_if_free:NF \fontspec_setup_maths:
+ {
+ \cs_gset_protected_nopar:Npx \fontspec_setup_maths:
+ {
+ \exp_not:o
+ {
+ \fontspec_setup_maths:
+ \tl_if_empty:NT \g_fontspec_bfmathrm_tl
+ { \DeclareSymbolFontAlphabet \mathrm { operators } }
+ }
+ }
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}[internal]{\(,\),\math,\endmath,\ensuremath,\@@_math_robust:N}
% \changes{v3.2.5}{2013/07/25}
% {解决汉字后紧跟 \cs{(}\texttt{...}\cs{)} 形式的行内数学公式时,不能加入间距的问题。}
+% \changes{v3.2.6}{2013/08/03}{考虑 \pkg{ulem} 对 \cs{MakeRobust} 的不当定义。}
+% \changes{v3.2.6}{2013/08/03}{考虑 \cs{math} 和 \cs{ensuremath}。}
% \cs{(} 的在 \LaTeXe 中的定义是
% \begin{verbatim}
% \def\({\relax\ifmmode\@badmath\else$\fi}
% \end{verbatim}
% 这个定义最开始的 \cs{relax} 是为了防止 \cs{(} 出现在表格单元格的开始位置时,模式
-% 判断不正确(因为 \TeX 会先看单元格中第一个不可展的非空格记号是否是 \cs{omit} 或 \cs{noalign})。^^A
-% 但是它会造成一个边界,使 \pkg{xeCJK} 不能看到 \cs{relax} 后面出现的 |$|,从而不能
-% 加入间距\footnote{\url{http://tex.stackexchange.com/q/124773}}。使用 \hologo{eTeX}
-% 的 \cs{protected} 来定义它,可以不需要 \cs{relax},或者将 \cs{relax} 改成
-% \cs{scan_align_safe_stop:},都可以避免这些情况。同时 \pkg{fixltx2e}中还使用了
-% |\MakeRobust\(|,我们需要小心处理。
+% 判断不正确(因为 \TeX 会先看单元格中第一个不可展的非空格记号是否是 \cs{omit} 或
+% \cs{noalign})。但是它会造成一个边界,使 \pkg{xeCJK} 不能看到 \cs{relax} 后面出现的
+% |$|,从而不能加入间距\footnote{\url{http://tex.stackexchange.com/q/124773}}。使用
+% \hologo{eTeX} 的 \cs{protected} 来定义它,可以不需要 \cs{relax},或者将 \cs{relax}
+% 改成 \cs{scan_align_safe_stop:},都可以避免这些情况。同时 \pkg{fixltx2e} 中还使用了
+% |\MakeRobust\(|,我们需要小心处理。另外 \pkg{ulem} 也定义了一个 \cs{MakeRobust},
+% 如果它被放在 \pkg{fixltx2e} 之前载入,那么 \pkg{fixltx2e} 的定义就会失效(因为
+% \pkg{fixltx2e} 使用 \cs{providecommand*} 来定义 \cs{MakeRobust})。但是 \pkg{ulem}
+% 的定义并不完全正确,没有考虑 \TeX 不会略去控制符号后面的空格的情况。
% \begin{macrocode}
\cs_new_protected_nopar:Npn \@@_math_robust:N #1
- { \exp_args:NNc \@@_math_robust:NN #1 { \cs_to_str:N #1 ~ } }
+ { \exp_args:NNc \@@_math_robust_aux:NN #1 { \cs_to_str:N #1 ~ } }
+\cs_new_protected_nopar:Npn \@@_math_robust_aux:NN #1#2
+ {
+ \exp_args:Nx \str_case:nnTF { \token_get_replacement_spec:N #1 }
+ {
+ { \x@protect #1 \protect #2 } { }
+ { \protect #2 } { }
+ }
+ { \@@_math_robust:NN #1#2 }
+ { \@@_math_robust:NN #1#1 }
+ }
\cs_new_protected_nopar:Npn \@@_math_robust:NN #1#2
{
- \bool_if:nT
+ \str_if_eq_x:nnTF { \token_get_arg_spec:N #2 } { }
{
- \str_if_eq_x_p:nn
- { \token_get_replacement_spec:N #1 }
- { \exp_not:n { \x@protect #1 \protect #2 } } &&
- \exp_args:Nf \tl_if_empty_p:n { \token_get_arg_spec:N #2 } &&
- \exp_args:No \tl_if_head_eq_meaning_p:nN {#2} \scan_stop:
+ \exp_args:No \tl_if_head_eq_meaning:nNTF {#2} \scan_stop:
+ {
+ \cs_gset_protected_nopar:Npx #1
+ { \scan_align_safe_stop: \tl_tail:N #2 }
+ }
+ {
+ \cs_if_eq:NNTF #1 \ensuremath
+ {
+ \cs_gset_protected_nopar:Npx #1
+ { \scan_align_safe_stop: \exp_not:o {#2} }
+ }
+ {
+ \@@_warning:nxx { robust-failure }
+ { \token_to_str:N #1 } { \token_to_meaning:N #2 }
+ }
+ }
+ }
+ {
+ \@@_warning:nxx { robust-failure }
+ { \token_to_str:N #1 } { \token_to_meaning:N #2 }
}
- { \cs_gset_protected_nopar:Npx #1 { \scan_align_safe_stop: \tl_tail:N #2 } }
+ }
+\@@_msg_new:nnn { robust-failure }
+ { xeCJK~can~not~make~`#1'~robust. }
+ {
+ The~current~meaning~of~`#1'~is:\\
+ \iow_indent:n {#2}
}
\@@_math_robust:N \(
\@@_math_robust:N \)
+\@@_math_robust:N \math
+\@@_math_robust:N \endmath
+\@@_math_robust:N \ensuremath
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}[internal]{\[}
+% \begin{macro}[internal]{\[,\]}
% \changes{v3.2.5}{2013/07/25}{解决 \pkg{fixltx2e} 和 \pkg{amsthm} 的冲突。}
% 当 \pkg{amsmath} 没有在 \pkg{amsthm} 之前被调用时,\pkg{amsthm} 会展开 \cs{[},
% 并用 |$| 作为参数定界记号,相关代码为
@@ -6468,19 +6454,15 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
\RenewDocumentCommand \fontfamily { m }
{
\tl_set:Nx \f@family {#1}
- \@@_update_family:n
+ \@@_update_family:nn {#1}
{
- \str_case:nnn {#1}
- {
- { \rmdefault } { \xeCJK_switch_family:n { \CJKrmdefault } }
- { \sfdefault } { \xeCJK_switch_family:n { \CJKsfdefault } }
- { \ttdefault } { \xeCJK_switch_family:n { \CJKttdefault } }
- { \familydefault } { \xeCJK_switch_family:n { \CJKfamilydefault } }
- }
- { }
+ { \rmdefault } { \xeCJK_switch_family:n { \CJKrmdefault } }
+ { \sfdefault } { \xeCJK_switch_family:n { \CJKsfdefault } }
+ { \ttdefault } { \xeCJK_switch_family:n { \CJKttdefault } }
+ { \familydefault } { \xeCJK_switch_family:n { \CJKfamilydefault } }
}
}
-\cs_new_eq:NN \@@_update_family:n \use:n
+\cs_new_eq:NN \@@_update_family:nn \str_case:nn
% \end{macrocode}
% \end{macro}
%
@@ -6610,22 +6592,26 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
% \end{macrocode}
% \end{macro}
%
+% \begin{macro}[internal]{\textellipsis}
% 单独处理宽度有分歧的几个标点:包括省略号、破折号、间隔号、引号等中西文混用的
-% 符号, 保证其命令形式输出的是西文字体。并对一些编码的符号宏包做特殊处理。在
-% 使用 \texttt{T1} 编码的时候,|\r{u}| 的实际定义是 |\char183| 与常被用作中文
-% 间隔号的 \texttt{U+00B7} 冲突。
+% 符号, 保证其命令形式输出的是西文字体。
+% \begin{macrocode}
+\tl_map_inline:nn
+ {
+ \textellipsis \textemdash \textperiodcentered \textcentereddot
+ \textquoteleft \textquoteright \textquotedblleft \textquotedblright
+ }
+ {
+ \AtBeginUTFCommand [#1] { \@@_group_begin: \makexeCJKinactive }
+ \AtEndUTFCommand [#1] { \@@_group_end: }
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% 常被用作中文间隔号的 \texttt{U+00B7} 与 T1 等旧字体编码下定义的符号命令冲突。
% \begin{macrocode}
\@@_after_preamble:n
{
- \tl_map_inline:nn
- {
- \textellipsis \textemdash \textperiodcentered \textcentereddot
- \textquoteleft \textquoteright \textquotedblleft \textquotedblright
- }
- {
- \cs_gset_protected_nopar:Npx #1
- { \@@_group_begin: \makexeCJKinactive \exp_not:o {#1} \@@_group_end: }
- }
\tl_put_left:Nn \tipaencoding { \makexeCJKinactive }
\cs_new_eq:NN \@@_aux_r:n \r
\cs_set_nopar:Npn \r #1
@@ -6978,6 +6964,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
{
\xeCJK_if_ulem_patch:TF
{
+ \xeCJK_class_group_end:
\UL@stop \@@_ulem_hskip:n { \c_zero_skip } \UL@start
{ \xeCJK_make_node:n { CJK } }
}
@@ -7982,7 +7969,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
{
\@@_if_csname:nTF {#3}
{ \@@_declare_character:Nnn #3 }
- { \exp_args:Nc \@@_declare_character:Nnn { \tl_to_str:n {#3} } }
+ { \@@_declare_character:cnn { \tl_to_str:n {#3} } }
{#1} {#2}
}
% \end{macrocode}
@@ -8004,6 +7991,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
}
#1 { \token_to_str:N #1 } {#2}
}
+\cs_generate_variant:Nn \@@_declare_character:Nnn { c }
% \end{macrocode}
% \end{macro}
%
@@ -8044,10 +8032,10 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
{ \DeclareTextCommand #2 {#4} { \@@_text_character:nN {#3} {#1} } }
\cs_new_protected:Npn \@@_text_character:nN #1#2
{
- \tl_use:N \l_@@_begin_hook_tl
+ \@@_begin_hook:nn {#1} {#2}
\@@_glyph_if_exist:nTF { `#2 }
{#2} { \cs_if_exist_use:cF { ? #1 } {#2} }
- \tl_use:N \l_@@_end_hook_tl
+ \@@_end_hook:nn {#1} {#2}
}
\cs_generate_variant:Nn \@@_declare_character:NNnn { NNx }
% \end{macrocode}
@@ -8074,7 +8062,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
{
\@@_if_csname:nTF {#3}
{ \@@_declare_composite:Nnnn #3 }
- { \exp_args:Nc \@@_declare_composite:Nnnn { \tl_to_str:n {#3} } }
+ { \@@_declare_composite:cnnn { \tl_to_str:n {#3} } }
{#1} {#4} {#2}
}
% \end{macrocode}
@@ -8086,7 +8074,6 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
% \DeclareUTFcomposite[\UTFencname]{x02E8\char"02E5}{\tonebar}{25}
% \DeclareUTFcomposite[\UTFencname]{x02E5\char"02E8}{\tonebar}{52}
% \end{verbatim}
-% 但是这个定义原本就是无效的,|\tonebar{25}| 和 |\tonebar{2}| 的定义一样。
% 对复合符号命令的定义用的是 \cs{chardef},这有利于下面字符是否存在的判断。
% \begin{macrocode}
\cs_new_protected:Npn \@@_declare_composite:Nnnn #1#2#3#4
@@ -8100,6 +8087,44 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
\cs_new_protected:Npn \@@_chardef:Nn #1#2
{ \tex_chardef:D #1 = \etex_numexpr:D #2 \scan_stop: }
\cs_generate_variant:Nn \@@_chardef:Nn { c }
+\cs_generate_variant:Nn \@@_declare_composite:Nnnn { c }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}[internal]{\tonebar}
+% 使得 |\tonebar{25}| 和 |\tonebar{52}| 生效。
+% \begin{macrocode}
+\AtEndOfPackage
+ {
+ \DeclareUTFCompositeCommand \tonebar { 25 } { \tonebar { 2 } \tonebar { 5 } }
+ \DeclareUTFCompositeCommand \tonebar { 52 } { \tonebar { 5 } \tonebar { 2 } }
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}[internal]{\DeclareUTFCompositeCommand}
+% 设置编码 |#1| 下的符号命令 |#2| 与它的参数 |#3| 的复合对应结果是 |#4|。不能直接用
+% \cs{Declare\-Text\-Composite\-Command} 来定义,它与我们的机制冲突。
+% \begin{macrocode}
+\NewDocumentCommand \DeclareUTFCompositeCommand { O { \UTFencname } m m m }
+ {
+ \@@_if_csname:nTF {#2}
+ { \@@_declare_composite_command:Nnnn #2 }
+ { \@@_declare_composite_command:cnnn { \tl_to_str:n {#2} } }
+ {#1} {#3} {#4}
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}[internal]{\@@_declare_composite_command:Nnnn}
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_declare_composite_command:Nnnn #1#2#3#4
+ {
+ \cs_set_protected:cpn
+ { \token_to_str:c {#2} \token_to_str:N #1 - \tl_to_str:n {#3} }
+ {#4}
+ }
+\cs_generate_variant:Nn \@@_declare_composite_command:Nnnn { c }
% \end{macrocode}
% \end{macro}
%
@@ -8111,7 +8136,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
{
\@@_if_csname:nTF {#2}
{ \@@_declare_accent:Nnnn #2 }
- { \exp_args:Nc \@@_declare_accent:Nnnn { \tl_to_str:n {#2} } }
+ { \@@_declare_accent:cnnn { \tl_to_str:n {#2} } }
{#1} {#3} {#4}
}
% \end{macrocode}
@@ -8125,7 +8150,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
{
\@@_if_csname:nTF {#2}
{ \@@_declare_accent:Nnnn #2 }
- { \exp_args:Nc \@@_declare_accent:Nnnn { \tl_to_str:n {#2} } }
+ { \@@_declare_accent:cnnn { \tl_to_str:n {#2} } }
{#1} {#4} {#3}
}
% \end{macrocode}
@@ -8151,6 +8176,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
\DeclareTextCommand #3 {#6}
{ \@@_text_composite:nnNNn {#4} {#5} {#1} {#2} }
}
+\cs_generate_variant:Nn \@@_declare_accent:Nnnn { c }
\cs_generate_variant:Nn \@@_declare_accent:NNNnnn { NNNxx }
% \end{macrocode}
% \end{macro}
@@ -8161,21 +8187,25 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
% \begin{macrocode}
\cs_new_protected:Npn \@@_text_composite:nnNNn #1#2#3#4#5
{
- \tl_use:N \l_@@_begin_hook_tl
+ \@@_begin_hook:nn {#2} {#5}
\cs_if_exist:cTF { #1#2 - \tl_to_str:n {#5} }
{
- \token_if_chardef:cTF { #1#2 - \tl_to_str:n {#5} }
- {
- \@@_glyph_if_exist:nTF { \use:c { #1#2 - \tl_to_str:n {#5} } }
- { \use:c { #1#2 - \tl_to_str:n {#5} } }
- { \@@_add_accent:nnNN {#5} {#2} #3#4 }
- }
- { \use:c { #1#2 - \tl_to_str:n {#5} } }
+ \@@_text_composite_aux:cnNNn
+ { #1#2 - \tl_to_str:n {#5} } {#2} {#3} {#4} {#5}
}
- { \@@_add_accent:nnNN {#5} {#2} #3#4 }
- \tl_use:N \l_@@_end_hook_tl
+ { \@@_add_accent:nnNN {#5} {#2} {#3} {#4} }
+ \@@_end_hook:nn {#2} {#5}
}
-\cs_generate_variant:Nn \token_if_chardef:NTF { c }
+\cs_new_protected:Npn \@@_text_composite_aux:NnNNn #1#2#3#4#5
+ {
+ \token_if_chardef:NTF #1
+ {
+ \@@_glyph_if_exist:nTF {#1}
+ {#1} { \@@_add_accent:nnNN {#5} {#2} {#3} {#4} }
+ }
+ {#1}
+ }
+\cs_generate_variant:Nn \@@_text_composite_aux:NnNNn { c }
% \end{macrocode}
% \end{macro}
%
@@ -8216,25 +8246,73 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
% \end{macro}
%
% \begin{macro}[internal]{\AtBeginUTFCommand,\AtEndUTFCommand}
-% 在符号命令前后使用的钩子。
+% 设置在符号命令前后使用的钩子,可选参数用于指定单个符号命名。可以用 |#1|
+% 引用带参数的组合符号命令的参数或者符号命令对应的符号。
+% \changes{v3.2.6}{2013/08/15}{可以指定特定符号命令使用的钩子。}
% \begin{macrocode}
-\NewDocumentCommand \AtBeginUTFCommand { s +m }
+\NewDocumentCommand \AtBeginUTFCommand { s O { } +m }
{
- \IfBooleanTF {#1}
- { \tl_set:Nn \l_@@_begin_hook_tl {#2} }
- { \tl_put_right:Nn \l_@@_begin_hook_tl {#2} }
+ \tl_if_blank:nTF {#2}
+ {
+ \IfBooleanTF {#1}
+ { \tl_set:Nn \l_@@_begin_hook_tl {#3} }
+ { \tl_put_right:Nn \l_@@_begin_hook_tl {#3} }
+ }
+ { \@@_set_cmd_hook:nnn { begin } {#2} {#3} }
}
-\NewDocumentCommand \AtEndUTFCommand { s +m }
+\NewDocumentCommand \AtEndUTFCommand { s O { } +m }
{
- \IfBooleanTF {#1}
- { \tl_set:Nn \l_@@_end_hook_tl {#2} }
- { \tl_put_right:Nn \l_@@_end_hook_tl {#2} }
+ \tl_if_blank:nTF {#2}
+ {
+ \IfBooleanTF {#1}
+ { \tl_set:Nn \l_@@_end_hook_tl {#3} }
+ { \tl_put_right:Nn \l_@@_end_hook_tl {#3} }
+ }
+ { \@@_set_cmd_hook:nnn { end } {#2} {#3} }
}
\tl_new:N \l_@@_begin_hook_tl
\tl_new:N \l_@@_end_hook_tl
% \end{macrocode}
% \end{macro}
%
+% \begin{macro}[internal]{\@@_set_cmd_hook:nnn}
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_set_cmd_hook:nnn #1#2#3
+ {
+ \cs_set_protected:cpn
+ {
+ \tl_if_single:nTF {#2}
+ { \use:c { @@_#1_csname:n } { \token_to_str:N #2 } }
+ { \@@_set_cmd_hook_aux:Nnwn #2 \q_stop {#1} }
+ } ##1
+ {#3}
+ }
+\cs_new:Npn \@@_set_cmd_hook_aux:Nnwn #1#2 \q_stop #3
+ { \use:c { @@_#3_csname:n } { \token_to_str:N #1 - \tl_to_str:n {#2} } }
+\cs_new_nopar:Npn \@@_begin_csname:n #1 { @@_begin_#1_hook:n }
+\cs_new_nopar:Npn \@@_end_csname:n #1 { @@_end_#1_hook:n }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}[internal]{\@@_begin_hook:nn,\@@_end_hook:nn}
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_begin_hook:nn #1#2
+ {
+ \tl_use:N \l_@@_begin_hook_tl
+ \cs_if_exist_use:cF { \@@_begin_csname:n { #1 - \tl_to_str:n {#2} } }
+ { \cs_if_exist_use:cF { \@@_begin_csname:n {#1} } { \use_none:n } }
+ {#2}
+ }
+\cs_new_protected:Npn \@@_end_hook:nn #1#2
+ {
+ \cs_if_exist_use:cF { \@@_end_csname:n { #1 - \tl_to_str:n {#2} } }
+ { \cs_if_exist_use:cF { \@@_end_csname:n {#1} } { \use_none:n } }
+ {#2}
+ \tl_use:N \l_@@_end_hook_tl
+ }
+% \end{macrocode}
+% \end{macro}
+%
% \begin{macrocode}
%</xunicode>
% \end{macrocode}
@@ -8277,9 +8355,9 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
% \begin{macrocode}
\documentclass{article}
\usepackage[AutoFakeBold,AutoFakeSlant]{xeCJK}
-\setCJKmainfont[BoldFont=simhei.ttf, ItalicFont=simkai.ttf]{simsun.ttc}
+\setCJKmainfont[BoldFont=simhei.ttf, SlantedFont=simkai.ttf]{simsun.ttc}
\setCJKsansfont[AutoFakeSlant=false,
- BoldFont=simhei.ttf, ItalicFont=simkai.ttf]{simsun.ttc}
+ BoldFont=simhei.ttf, SlantedFont=simkai.ttf]{simsun.ttc}
\setCJKmonofont[ItalicFont=simkai.ttf]{simsun.ttc}
\begin{document}
\centering
diff --git a/Master/texmf-dist/source/xelatex/xecjk/xeCJK.ins b/Master/texmf-dist/source/xelatex/xecjk/xeCJK.ins
index 4285ca1f382..70a8176ed79 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: `install')
%%
-%% $Id: xeCJK.dtx 477 2013-07-25 22:15:20Z sobenlee $
+%% $Id: xeCJK.dtx 510 2013-08-15 23:20:17Z sobenlee $
%% $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
%% -----------------------------------------------------------------
%% Author:
@@ -37,7 +37,7 @@
\askforoverwritefalse
\preamble
-$Id: xeCJK.dtx 477 2013-07-25 22:15:20Z sobenlee $
+$Id: xeCJK.dtx 510 2013-08-15 23:20:17Z sobenlee $
$URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
-----------------------------------------------------------------
Author: