summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/xelatex/xecjk/xeCJK.sty
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2012-10-30 00:35:55 +0000
committerKarl Berry <karl@freefriends.org>2012-10-30 00:35:55 +0000
commit0cab1dfa4f709e056ae6171885b7fc03bd26a3b2 (patch)
tree64a3fc3576507a3772817a558c8a9b0edefea931 /Master/texmf-dist/tex/xelatex/xecjk/xeCJK.sty
parent63c2e4c2b9c2fddab2f4db4ef370348376142fc1 (diff)
xecjk (29oct12)
git-svn-id: svn://tug.org/texlive/trunk@28115 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/xelatex/xecjk/xeCJK.sty')
-rw-r--r--Master/texmf-dist/tex/xelatex/xecjk/xeCJK.sty653
1 files changed, 356 insertions, 297 deletions
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