summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/xelatex/xecjk/xeCJK.dtx
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2016-11-22 22:50:32 +0000
committerKarl Berry <karl@freefriends.org>2016-11-22 22:50:32 +0000
commit1a2e7be1784cdd093a722b0f80ee7e09b18f5e14 (patch)
tree9ef9e7ce6b5c685329e0c67712a45ddcc009f117 /Master/texmf-dist/source/xelatex/xecjk/xeCJK.dtx
parentf476e2547d6f421f3f59e812adb855596f668eb5 (diff)
xecjk (22nov16)
git-svn-id: svn://tug.org/texlive/trunk@42557 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/xelatex/xecjk/xeCJK.dtx')
-rw-r--r--Master/texmf-dist/source/xelatex/xecjk/xeCJK.dtx151
1 files changed, 107 insertions, 44 deletions
diff --git a/Master/texmf-dist/source/xelatex/xecjk/xeCJK.dtx b/Master/texmf-dist/source/xelatex/xecjk/xeCJK.dtx
index 745380178bb..41df67d7c94 100644
--- a/Master/texmf-dist/source/xelatex/xecjk/xeCJK.dtx
+++ b/Master/texmf-dist/source/xelatex/xecjk/xeCJK.dtx
@@ -194,7 +194,7 @@ Copyright and Licence
%<*package|config|fntef|listings|xunicode|xunextra>
%<!(config|xunextra)>\NeedsTeXFormat{LaTeX2e}
%<!(config|xunextra)>\RequirePackage{expl3}
-%<+!driver>\GetIdInfo$Id: xeCJK.dtx 7cdefd6 2016-10-25 17:38:55 +0800 Qing Lee <sobenlee@gmail.com> $
+%<+!driver>\GetIdInfo$Id: xeCJK.dtx f0c9d10 2016-11-20 23:00:07 +0800 Qing Lee <sobenlee@gmail.com> $
%<package> {Typesetting CJK scripts with XeLaTeX}
%<config> {Configuration file for xeCJK package}
%<fntef> {xeCJK font effect}
@@ -207,7 +207,7 @@ Copyright and Licence
%<listings>\ProvidesExplPackage{xeCJK-listings}
%<xunicode>\ProvidesExplPackage{xunicode-addon}
%<xunextra>\ProvidesExplFile{xunicode-extra.def}
-%<!driver> {\ExplFileDate}{3.4.2}{\ExplFileDescription}
+%<!driver> {\ExplFileDate}{3.4.3}{\ExplFileDescription}
%</package|config|fntef|listings|xunicode|xunextra>
%<*driver>
\documentclass{ctxdoc}
@@ -275,7 +275,7 @@ Copyright and Licence
% \changes{v3.3.2}{2015/05/15}{随 Unicode 7.0.0 更新简繁汉字映射。}
% \changes{v3.3.3}{2015/09/25}{更新 \hologo{LaTeX3} 代码。}
%
-% \CheckSum{10138}
+% \CheckSum{10153}
% \GetFileId{xeCJK.sty}
%
% \title{\bfseries\pkg{xeCJK} 宏包}
@@ -656,8 +656,9 @@ Copyright and Licence
% \subsection{字体设置与选择}
% \label{subsec:fontset}
%
-% \begin{function}[EXP]{\setCJKmainfont}
+% \begin{function}[EXP,updated=2016-11-18]{\setCJKmainfont}
% \begin{syntax}
+% \tn{setCJKmainfont} \Arg{font name}\oarg{font features} 或\\
% \tn{setCJKmainfont} \oarg{font features} \Arg{font name}
% \end{syntax}
% 设置正文罗马族的 CJK 字体,影响 \tn{rmfamily} 和 \tn{textrm} 的字体。后面两个
@@ -666,6 +667,9 @@ Copyright and Licence
% 找字体名见 \ref{subsubsec:fontsearch}~节;可用的字体属性选项参见
% \pkg{fontspec} 宏包的文档。需要说明的是 \pkg{xeCJK} 修改了 |AutoFakeBold|
% 和 |AutoFakeSlant| 选项,以便配合全局伪粗体和伪斜体的设定。
+%
+% 出于兼容性考虑,字体属性可选项可以放在字体名称前面,也可以放在后面。
+% 如果可选项放在后面,字体名称与可选项之间不要有空格或者换行。
% \end{function}
%
% \begin{function}[label = ]{AutoFakeBold,AutoFakeSlant}
@@ -690,22 +694,25 @@ Copyright and Licence
% 请参考 TECKit 的文档。
% \end{function}
%
-% \begin{function}[EXP]{\setCJKsansfont}
+% \begin{function}[EXP,updated=2016-11-18]{\setCJKsansfont}
% \begin{syntax}
+% \tn{setCJKsansfont} \Arg{font name}\oarg{font features} 或\\
% \tn{setCJKsansfont} \oarg{font features} \Arg{font name}
% \end{syntax}
% 设置正文无衬线族的 CJK 字体,影响 \tn{sffamily} 和 \tn{textsf} 的字体。
% \end{function}
%
-% \begin{function}[EXP]{\setCJKmonofont}
+% \begin{function}[EXP,updated=2016-11-18]{\setCJKmonofont}
% \begin{syntax}
-% \tn{setCJKmonofont} \oarg{font features} \Arg{font name}
+% \tn{setCJKmonofont} \Arg{font name}\oarg{font features} 或\\
+% \tn{setCJKmonofont} \oarg{font features} \Arg{font name}
% \end{syntax}
% 设置正文等宽族的 CJK 字体,影响 \tn{ttfamily} 和 \tn{texttt} 的字体。
% \end{function}
%
-% \begin{function}[EXP]{\setCJKfamilyfont}
+% \begin{function}[EXP,updated=2016-11-18]{\setCJKfamilyfont}
% \begin{syntax}
+% \tn{setCJKfamilyfont} \Arg{family} \Arg{font name}\oarg{font features} 或\\
% \tn{setCJKfamilyfont} \Arg{family} \oarg{font features} \Arg{font name}
% \end{syntax}
% 声明新的 CJK 字体族 \meta{family} 并指定字体。
@@ -722,13 +729,17 @@ Copyright and Licence
% 符类有效。当 \tn{CJKfamily}|+| 和 \tn{CJKfamily}|-| 的参数为空时,则使用当前的 |CJK| 字体族。
% \end{function}
%
-% \begin{function}[EXP]{\newCJKfontfamily}
+% \begin{function}[EXP,updated=2016-11-18]{\newCJKfontfamily}
% \begin{syntax}
+% \tn{newCJKfontfamily} \oarg{family} \cs{\meta{font-switch}} \Arg{font name}\oarg{font features} 或\\
% \tn{newCJKfontfamily} \oarg{family} \cs{\meta{font-switch}} \oarg{font features} \Arg{font name}
% \end{syntax}
% 声明新的 CJK 字体族 \meta{family} 并指定字体,并定义 \cs{\meta{font-switch}},在
% 文档中可以使用它来切换 CJK 字体族。可以不必指定 \meta{family},这时候 \meta{family}
-% 将等于 \meta{font-switch}。事实上,\tn{newCJKfontfamily} 是 \tn{setCJKfamilyfont} 和
+% 将等于 \meta{font-switch}。
+% \end{function}
+%
+% 事实上,\tn{newCJKfontfamily} 是 \tn{setCJKfamilyfont} 和
% \tn{CJKfamily} 的合并。例如
% \begin{ctexexam}
% \newCJKfontfamily[song]\songti{SimSun}
@@ -738,10 +749,10 @@ Copyright and Licence
% \setCJKfamilyfont{song}{SimSun}
% \newcommand*{\songti}{\CJKfamily{song}}
% \end{ctexexam}
-% \end{function}
%
-% \begin{function}{\CJKfontspec}
+% \begin{function}[updated=2016-11-18]{\CJKfontspec}
% \begin{syntax}
+% \tn{CJKfontspec} \Arg{font name}\oarg{font features} 或\\
% \tn{CJKfontspec} \oarg{font features} \Arg{font name}
% \end{syntax}
% 在文档中随机定义新的 CJK 字体族,并马上使用它。
@@ -799,8 +810,9 @@ Copyright and Licence
% 就可以将全文的 CJK 和西文默认字体都改为无衬线字体族。
% \end{function}
%
-% \begin{function}[EXP]{\setCJKmathfont}
+% \begin{function}[EXP,updated=2016-11-18]{\setCJKmathfont}
% \begin{syntax}
+% \tn{setCJKmathfont} \Arg{font name}\oarg{font features} 或\\
% \tn{setCJKmathfont} \oarg{font features} \Arg{font name}
% \end{syntax}
% 设置数学公式中的 CJK 字体族。如果使用了 |CJKmath| 选项,但是没有使用
@@ -808,8 +820,9 @@ Copyright and Licence
% 作为数学公式中的 CJK 字体。
% \end{function}
%
-% \begin{function}[EXP, label = ]{\setCJKfallbackfamilyfont}
+% \begin{function}[EXP, label=, updated=2016-11-18]{\setCJKfallbackfamilyfont}
% \begin{syntax}
+% \tn{setCJKfallbackfamilyfont} \Arg{family} \Arg{font name}\oarg{font features} 或\\
% \tn{setCJKfallbackfamilyfont} \Arg{family} \oarg{font features} \Arg{font name}
% \end{syntax}
% 设置 CJK 字体族 \meta{family} 的备用字体。例如,使用
@@ -841,6 +854,12 @@ Copyright and Licence
%
% \begin{function}[EXP,updated=2013-06-30]{\setCJKfallbackfamilyfont}
% \begin{syntax}
+% \tn{setCJKfallbackfamilyfont} \Arg{family}
+% \ \{
+% \ \{\oarg{font features_1} \Arg{font name_1}\} ,
+% \ \{\oarg{font features_2} \Arg{font name_2}\} ,
+% \ ......
+% \ \}\oarg{common font features} 或\\
% \tn{setCJKfallbackfamilyfont} \Arg{family} \oarg{common font features}
% \ \{
% \ \{\oarg{font features_1} \Arg{font name_1}\} ,
@@ -5291,8 +5310,9 @@ Copyright and Licence
% \end{macro}
%
% \begin{macro}[internal]{\xeCJK_calc_punct_dimen:N}
+% \changes{v3.4.3}{2016/10/27}{考虑破折号边界为负值的情况。}
% 计算标点的左右实际边距和实际尺寸。对于破折号,计算两标点之间的空白,保证它中间
-% 不被断开。
+% 不被断开。注意,破折号的边界可能为负值(比如方正新书宋),此时不必压缩。
% \begin{macrocode}
\cs_new_protected_nopar:Npn \xeCJK_calc_punct_dimen:N #1
{
@@ -5316,7 +5336,7 @@ Copyright and Licence
\str_case:nnTF {#1}
{ { ^^^^2025 } { } { ^^^^2026 } { } }
{ \c_zero_dim }
- { - \l_@@_tmp_dim }
+ { \dim_min:nn { - \l_@@_tmp_dim } { \c_zero_dim } }
}
\@@_save_punct_dim:nnnn { kern } {#1} {#1} { \l_@@_tmp_dim }
\@@_save_punct_skip:nnnn { kern } {#1} {#1} { \l_@@_tmp_dim }
@@ -5528,13 +5548,18 @@ Copyright and Licence
% \end{macro}
%
% \begin{macro}{\setCJKfallbackfamilyfont}
+% \changes{v3.4.3}{2016/11/18}{允许字体属性可选项在后的新语法。}
% \begin{macrocode}
-\NewDocumentCommand \setCJKfallbackfamilyfont { m O { } m }
- { \use:x { \xeCJK_set_family_fallback:nnn {#1} {#2} {#3} } }
+\NewDocumentCommand \setCJKfallbackfamilyfont { m o m }
+ {
+ \@@_pass_args:nnnn
+ { \xeCJK_set_family_fallback:nnn {#1} } {#2} {#3}
+ { }
+ }
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}[internal]{\xeCJK_set_family_fallback:nnn}
+% \begin{macro}[int]{\xeCJK_set_family_fallback:nnn,}
% \begin{macrocode}
\cs_new_protected_nopar:Npn \xeCJK_set_family_fallback:nnn #1#2#3
{
@@ -5773,9 +5798,7 @@ Copyright and Licence
\tl_new:N \l_@@_family_name_tl
\tl_new:N \l_@@_font_name_tl
\clist_new:N \l_@@_font_options_clist
-\cs_generate_variant:Nn \xeCJK_set_family:nnn { Vnn , VVV , Voo }
-\cs_new_protected_nopar:Npn \xeCJK_set_family:xxx #1#2#3
- { \use:x { \xeCJK_set_family:nnn {#1} {#2} {#3} } }
+\cs_generate_variant:Nn \xeCJK_set_family:nnn { x , VVV , Voo }
% \end{macrocode}
% \end{macro}
%
@@ -6197,25 +6220,50 @@ Copyright and Licence
% \end{macrocode}
% \end{macro}
%
+% \begin{macro}[int]{\@@_pass_args:nnnn}
+% 为了支持字体属性可选项在前在后两种语法,给出两个辅助工具,类似
+% \package{fontspec} 的实现。自带展开功能,额外参数 |#4| 用于后处理。
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_pass_args:nnnn #1#2#3#4
+ {
+ \IfNoValueTF {#2}
+ { \@@_post_arg:w {#1} {#3} {#4} }
+ {
+ \use:x { #1 {#2} {#3} }
+ #4
+ }
+ }
+\NewDocumentCommand \@@_post_arg:w { m m m O { } }
+ {
+ \use:x { #1 {#4} {#2} }
+ #3
+ }
+% \end{macrocode}
+% \end{macro}
+%
% \begin{macro}{\setCJKmainfont,\setCJKsansfont,\setCJKmonofont}
% 设置文档的 CJK 普通字体、无衬线和等宽字体。
% \changes{v3.2.0}{2013/04/14}{定义中加入 \tn{normalfont}。}
+% \changes{v3.4.3}{2016/11/18}{允许字体属性可选项在后的新语法。}
% \begin{macrocode}
-\NewDocumentCommand \setCJKmainfont { O { } m }
+\NewDocumentCommand \setCJKmainfont { o m }
{
- \xeCJK_set_family:xxx { \CJKrmdefault } {#1} {#2}
- \normalfont
+ \@@_pass_args:nnnn
+ { \xeCJK_set_family:nnn { \CJKrmdefault } } {#1} {#2}
+ { \normalfont }
}
\cs_new_eq:NN \setCJKromanfont \setCJKmainfont
-\NewDocumentCommand \setCJKsansfont { O { } m }
+\NewDocumentCommand \setCJKsansfont { o m }
{
- \xeCJK_set_family:xxx { \CJKsfdefault } {#1} {#2}
- \normalfont
+ \@@_pass_args:nnnn
+ { \xeCJK_set_family:nnn { \CJKsfdefault } } {#1} {#2}
+ { \normalfont }
}
-\NewDocumentCommand \setCJKmonofont { O { } m }
+\NewDocumentCommand \setCJKmonofont { o m }
{
- \xeCJK_set_family:xxx { \CJKttdefault } {#1} {#2}
- \normalfont
+ \@@_pass_args:nnnn
+ { \xeCJK_set_family:nnn { \CJKttdefault } } {#1} {#2}
+ { \normalfont }
}
% \end{macrocode}
% \end{macro}
@@ -6229,20 +6277,28 @@ Copyright and Licence
% \end{macrocode}
%
% \begin{macro}{\setCJKfamilyfont, \newCJKfontfamily, \CJKfontspec}
+% \changes{v3.4.3}{2016/11/18}{允许字体属性可选项在后的新语法。}
% 分别用于预声明 CJK 字体和随机调用 CJK 字体。
% \begin{macrocode}
-\NewDocumentCommand \setCJKfamilyfont { m O { } m }
- { \xeCJK_set_family:xxx {#1} {#2} {#3} }
-\NewDocumentCommand \newCJKfontfamily { o m O { } m }
+\NewDocumentCommand \setCJKfamilyfont { m o m }
+ {
+ \@@_pass_args:nnnn
+ { \xeCJK_set_family:nnn {#1} } {#2} {#3}
+ { }
+ }
+\NewDocumentCommand \newCJKfontfamily { o m o m }
{
\tl_set:Nx \l_@@_tmp_tl { \IfNoValueTF {#1} { \cs_to_str:N #2 } {#1} }
\cs_new_protected_nopar:Npx #2 { \xeCJK_switch_family:n { \l_@@_tmp_tl } }
- \xeCJK_set_family:xxx { \l_@@_tmp_tl } {#3} {#4}
+ \@@_pass_args:nnnn
+ { \xeCJK_set_family:nnn { \l_@@_tmp_tl } } {#3} {#4}
+ { }
}
-\NewDocumentCommand \CJKfontspec { O { } m }
+\NewDocumentCommand \CJKfontspec { o m }
{
- \use:x { \xeCJK_fontspec:nn {#1} {#2} }
- \tex_ignorespaces:D
+ \@@_pass_args:nnnn
+ { \xeCJK_fontspec:nn } {#1} {#2}
+ { \tex_ignorespaces:D }
}
% \end{macrocode}
% \end{macro}
@@ -6389,11 +6445,13 @@ Copyright and Licence
{ LoadFandol .bool_gset:N = \g_@@_fandol_bool }
\cs_new_protected_nopar:Npn \@@_load_fandol:
{
- \setCJKmainfont
- [ Extension = .otf , BoldFont = FandolSong-Bold , ItalicFont = FandolKai-Regular ]
+ \xeCJK_set_family:xnn { \CJKrmdefault }
+ { Extension = .otf , BoldFont = FandolSong-Bold , ItalicFont = FandolKai-Regular }
{ FandolSong-Regular }
- \setCJKsansfont [ Extension = .otf , BoldFont = FandolHei-Bold ] { FandolHei-Regular }
- \setCJKmonofont [ Extension = .otf ] { FandolFang-Regular }
+ \xeCJK_set_family:xnn { \CJKsfdefault }
+ { Extension = .otf , BoldFont = FandolHei-Bold } { FandolHei-Regular }
+ \xeCJK_set_family:xnn { \CJKttdefault }
+ { Extension = .otf } { FandolFang-Regular }
}
% \end{macrocode}
% \end{macro}
@@ -6491,10 +6549,15 @@ Copyright and Licence
% \end{macro}
%
% \begin{macro}{\setCJKmathfont}
+% \changes{v3.4.3}{2016/11/18}{允许字体属性可选项在后的新语法。}
% 设置 CJK 数学字体。
% \begin{macrocode}
-\NewDocumentCommand \setCJKmathfont { O { } m }
- { \xeCJK_set_family:xxx { \c_@@_math_tl } {#1} {#2} }
+\NewDocumentCommand \setCJKmathfont { o m }
+ {
+ \@@_pass_args:nnnn
+ { \xeCJK_set_family:nnn { \c_@@_math_tl } } {#1} {#2}
+ { }
+ }
\tl_const:Nn \c_@@_math_tl { CJKmath }
% \end{macrocode}
% \end{macro}