summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/xelatex/xecjk/xeCJKfntef.sty
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/xelatex/xecjk/xeCJKfntef.sty')
-rw-r--r--Master/texmf-dist/tex/xelatex/xecjk/xeCJKfntef.sty718
1 files changed, 598 insertions, 120 deletions
diff --git a/Master/texmf-dist/tex/xelatex/xecjk/xeCJKfntef.sty b/Master/texmf-dist/tex/xelatex/xecjk/xeCJKfntef.sty
index 360b8611364..5261b858507 100644
--- a/Master/texmf-dist/tex/xelatex/xecjk/xeCJKfntef.sty
+++ b/Master/texmf-dist/tex/xelatex/xecjk/xeCJKfntef.sty
@@ -6,7 +6,7 @@
%%
%% xeCJK.dtx (with options: `fntef')
%%
-%% $Id: xeCJK.dtx 692 2014-06-20 12:25:35Z sobenlee $
+%% $Id: xeCJK.dtx 729 2014-11-05 13:46:36Z sobenlee@gmail.com $
%% $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
%% -----------------------------------------------------------------
%% Author:
@@ -33,32 +33,39 @@
%%
\NeedsTeXFormat{LaTeX2e}
\RequirePackage{expl3}
-\GetIdInfo$Id: xeCJK.dtx 692 2014-06-20 12:25:35Z sobenlee $
- {xeCJK patch file for ulem/CJKfntef}
+\GetIdInfo$Id: xeCJK.dtx 729 2014-11-05 13:46:36Z sobenlee@gmail.com $
+ {xeCJK font effect}
\ProvidesExplPackage
{xeCJKfntef}
- {\ExplFileDate}{3.2.13}{\ExplFileDescription}
+ {\ExplFileDate}{3.2.14}{\ExplFileDescription}
\PassOptionsToPackage { normalem } { ulem }
\DeclareOption* { \PassOptionsToPackage { \CurrentOption } { ulem } }
\ProcessOptions \scan_stop:
\RequirePackage { xeCJK }
\RequirePackage { ulem }
-\RequirePackage { CJKfntef }
\RequirePackage { environ }
+\file_if_exist:nT { CJKfntef.sty }
+ { \RequirePackage { CJKfntef } }
\addto@hook \UL@hook { \xeCJK_hook_for_ulem: }
\cs_new_protected_nopar:Npn \xeCJK_hook_for_ulem:
{
\bool_if:NF \l__xeCJK_ulem_hook_used_bool
{
\bool_set_true:N \l__xeCJK_ulem_hook_used_bool
- \xeCJKsetup { CheckFullRight = false , xCJKecglue = false }
- \bool_if:NTF \l__xeCJK_ulem_skip_punct_bool
- { \cs_set_eq:NN \__xeCJK_ulem_leader_type: \UL@leadtype }
+ \__xeCJK_ulem_initial:
+ \bool_if:NT \l__xeCJK_ulem_subtract_bool
{
+ \cs_set_eq:NN \xeCJK_ulem_leaders: \UL@leaders
+ \cs_set_eq:NN \UL@leaders \xeCJK_ulem_var_leaders:
+ \cs_set_eq:NN \xeCJK_ulem_right_skip: \__xeCJK_ulem_right_skip:
+ }
+ \bool_if:NF \l__xeCJK_ulem_skip_bool
+ {
+ \xeCJK_swap_cs:NN \__xeCJK_punct_kern:n \__xeCJK_ulem_punct_kern:n
+ \xeCJK_swap_cs:NN \__xeCJK_punct_hskip:n \__xeCJK_ulem_punct_hskip:n
\xeCJK_cs_clear:N \__xeCJK_ulem_skip_punct_begin:
\xeCJK_cs_clear:N \__xeCJK_ulem_skip_punct_end:
}
- \__xeCJK_ulem_initial:
\xeCJK_glue_to_skip:nN
{
\cs_set_eq:NN \ \tex_space:D
@@ -73,24 +80,201 @@
\cs_set_eq:NN \hskip \skip_horizontal:N
\CJKecglue
} \l__xeCJK_ecglue_skip
+ \xeCJK_glue_to_skip:nN { \xeCJK_space_glue: } \l__xeCJK_space_skip
\cs_set_protected_nopar:Npn \CJKglue
{ \__xeCJK_ulem_glue:n \l__xeCJK_ccglue_skip }
\cs_set_protected_nopar:Npn \CJKecglue
{ \__xeCJK_ulem_glue:n \l__xeCJK_ecglue_skip }
+ \cs_set_protected_nopar:Npn \xeCJK_space_glue:
+ { \__xeCJK_ulem_glue:n \l__xeCJK_space_skip }
+ \xeCJKsetup { CheckFullRight = false , xCJKecglue = false }
+ \xeCJK_ulem_detect_node:
}
}
+\skip_new:N \l__xeCJK_space_skip
\bool_new:N \l__xeCJK_ulem_hook_used_bool
-\cs_set_eq:NN \CJK@UL \CJK@@UL
-\tl_replace_once:Nnn \CJK@UL { \ULon }
- { \bool_set_true:N \l__xeCJK_ulem_skip_punct_bool \ULon }
-\tl_replace_once:Nnn \CJK@@UL { \ULon }
- { \bool_set_false:N \l__xeCJK_ulem_skip_punct_bool \ULon }
-\bool_new:N \l__xeCJK_ulem_skip_punct_bool
+\cs_new_protected_nopar:Npn \xeCJK_ulem_word:nw #1 ~
+ {
+ \exp_after:wN \UL@start #1 ~
+ \exp_after:wN \if_meaning:w \exp_after:wN \UL@end #1
+ \exp_after:wN \__xeCJK_ulem_end:
+ \else:
+ \exp_after:wN \__xeCJK_ulem_loop:nw
+ \fi:
+ }
+\cs_new_protected_nopar:Npn \__xeCJK_ulem_end:
+ {
+ \c_group_end_token
+ \hbox_set_end:
+ \tex_unskip:D \tex_unskip:D \tex_unskip:D
+ \xeCJK_ulem_right_skip:
+ \xeCJK_ulem_right_node:
+ \int_set:Nn \tex_spacefactor:D { \UL@spfactor }
+ \c_group_end_token
+ }
+\cs_new_protected_nopar:Npn \__xeCJK_ulem_loop:nw
+ {
+ \reverse_if:N \if_mode_math:
+ \reverse_if:N \if_dim:w \tex_lastskip:D = \c_zero_dim
+ \skip_gset_eq:NN \UL@skip \tex_lastskip:D
+ \tex_unskip:D
+ \UL@stop \UL@leaders
+ \fi:
+ \fi:
+ \xeCJK_ulem_word:nw \prg_do_nothing:
+ }
+\cs_set_eq:NN \UL@word \xeCJK_ulem_word:nw
+\cs_new_protected_nopar:Npn \xeCJK_ulem_left:
+ {
+ \xeCJK_ulem_left_node:
+ \xeCJK_make_group_tag:
+ }
+\cs_new_eq:NN \xeCJK_ulem_left_node: \prg_do_nothing:
+\cs_new_protected_nopar:Npn \xeCJK_ulem_detect_node:
+ {
+ \scan_stop:
+ \dim_compare:nNnTF \tex_lastkern:D = \c_zero_dim
+ {
+ \xeCJK_cs_clear:N \xeCJK_ulem_left_node:
+ \cs_set_eq:NN \__xeCJK_ulem_hskip:n \xeCJK_ulem_hskip:n
+ }
+ {
+ \dim_set_eq:NN \l__xeCJK_tmp_dim \tex_lastkern:D
+ \tex_unkern:D
+ \dim_compare:nNnTF \tex_lastkern:D = { - \l__xeCJK_tmp_dim }
+ {
+ \tex_unkern:D
+ { \xeCJK_make_node:n { ulem-left } }
+ \cs_set_protected_nopar:Npx \xeCJK_ulem_left_node:
+ {
+ \tex_kern:D - \dim_use:N \l__xeCJK_tmp_dim \exp_stop_f:
+ \tex_kern:D \dim_use:N \l__xeCJK_tmp_dim \exp_stop_f:
+ }
+ \cs_set_eq:NN \__xeCJK_ulem_hskip:n \__xeCJK_ulem_hskip_first:n
+ }
+ {
+ \tex_kern:D \l__xeCJK_tmp_dim
+ \xeCJK_cs_clear:N \xeCJK_ulem_left_node:
+ \cs_set_eq:NN \__xeCJK_ulem_hskip:n \xeCJK_ulem_hskip:n
+ }
+ }
+ }
+\xeCJK_declare_node:n { ulem-left }
+\cs_new_protected_nopar:Npn \__xeCJK_ulem_hskip_first:n #1
+ {
+ \xeCJK_if_last_node:nTF { ulem-left }
+ {
+ \xeCJK_remove_node:
+ \skip_horizontal:n {#1}
+ }
+ { \xeCJK_ulem_hskip:n {#1} }
+ \cs_set_eq:NN \__xeCJK_ulem_hskip:n \xeCJK_ulem_hskip:n
+ }
+\cs_new_eq:NN \__xeCJK_ulem_hskip:n \__xeCJK_ulem_hskip_first:n
+\cs_new_protected_nopar:Npn \xeCJK_ulem_hskip:n #1
+ { \skip_set:Nn \UL@skip {#1} \UL@leaders }
+\cs_new_protected_nopar:Npn \xeCJK_ulem_right:
+ {
+ \scan_stop:
+ \dim_compare:nNnTF \tex_lastkern:D = \c_zero_dim
+ { \xeCJK_cs_gclear:N \xeCJK_ulem_right_node: }
+ {
+ \dim_compare:nNnTF \tex_lastkern:D = { 3 sp }
+ { \xeCJK_cs_gclear:N \xeCJK_ulem_right_node: }
+ {
+ \exp_after:wN \tex_unkern:D
+ \exp_after:wN \__xeCJK_ulem_right_aux:n
+ \exp_after:wN { \dim_use:N \tex_lastkern:D }
+ }
+ }
+ }
+\cs_new_protected_nopar:Npn \__xeCJK_ulem_right_aux:n #1
+ {
+ \dim_compare:nNnTF \tex_lastkern:D = { - #1 }
+ {
+ \tex_unkern:D
+ \cs_gset_protected_nopar:Npn \xeCJK_ulem_right_node:
+ {
+ \tex_kern:D - #1 \exp_stop_f:
+ \tex_kern:D #1 \exp_stop_f:
+ }
+ \tl_gset:Nx \UL@spfactor { \int_use:N \tex_spacefactor:D }
+ }
+ {
+ \tex_kern:D #1 \exp_stop_f:
+ \xeCJK_cs_gclear:N \xeCJK_ulem_right_node:
+ }
+ }
+\cs_new_eq:NN \xeCJK_ulem_right_node: \prg_do_nothing:
+\cs_new_eq:NN \xeCJK_ulem_leaders: \UL@leaders
+\cs_new_protected_nopar:Npn \xeCJK_ulem_var_leaders:
+ {
+ \scan_stop:
+ \skip_if_eq:nnF { \UL@skip } { \c_zero_skip }
+ {
+ \UL@leadtype \skip_horizontal:n { \UL@skip + \UL@pixel }
+ \skip_horizontal:n { - \UL@pixel }
+ \cs_gset_eq:NN \UL@leaders \xeCJK_ulem_leaders:
+ }
+ }
+\cs_new_eq:NN \xeCJK_ulem_right_skip: \prg_do_nothing:
+\cs_new_protected_nopar:Npn \__xeCJK_ulem_right_skip:
+ {
+ \int_case:nn { \etex_lastnodetype:D }
+ {
+ { \c_one } { \__xeCJK_ulem_right_skip_hbox: }
+ { \c_eleven } { \__xeCJK_ulem_right_skip_glue: }
+ { \c_thirteen } { \__xeCJK_ulem_right_skip_penalty: }
+ }
+ }
+\cs_new_protected_nopar:Npn \__xeCJK_ulem_right_skip_hbox:
+ {
+ \box_set_to_last:N \l__xeCJK_tmp_box
+ \dim_set:Nn \l__xeCJK_tmp_dim { - \box_wd:N \l__xeCJK_tmp_box }
+ \dim_compare:nNnT \tex_lastkern:D = \l__xeCJK_tmp_dim
+ {
+ \tex_unkern:D
+ \__xeCJK_ulem_right_skip_glue:
+ \tex_kern:D \l__xeCJK_tmp_dim
+ }
+ \box_use_clear:N \l__xeCJK_tmp_box
+ }
+\cs_new_protected_nopar:Npn \__xeCJK_ulem_right_skip_glue:
+ {
+ \skip_if_eq:nnT { \tex_lastskip:D } { - \UL@pixel }
+ {
+ \tex_unskip:D
+ \skip_set:Nn \l__xeCJK_tmp_skip { \tex_lastskip:D - \UL@pixel }
+ \tex_unskip:D
+ \UL@leadtype \skip_horizontal:N \l__xeCJK_tmp_skip
+ }
+ }
+\cs_new_protected_nopar:Npn \__xeCJK_ulem_right_skip_penalty:
+ {
+ \int_set_eq:NN \l__xeCJK_tmp_int \tex_lastpenalty:D
+ \tex_unpenalty:D
+ \int_compare:nNnT \etex_lastnodetype:D = \c_one
+ { \__xeCJK_ulem_right_skip_hbox: }
+ \tex_penalty:D \l__xeCJK_tmp_int
+ }
\cs_new_protected_nopar:Npn \__xeCJK_ulem_skip_punct_begin:
- { \xeCJK_cs_clear:N \UL@leadtype }
+ {
+ \cs_set_eq:NN \__xeCJK_ulem_putbox: \UL@putbox
+ \cs_set_eq:NN \UL@putbox \__xeCJK_ulem_skip_putbox:
+ \cs_set_eq:NN \__xeCJK_ulem_hskip_aux:n \xeCJK_ulem_hskip:n
+ \cs_set_eq:NN \xeCJK_ulem_hskip:n \skip_horizontal:n
+ }
\cs_new_protected_nopar:Npn \__xeCJK_ulem_skip_punct_end:
- { \cs_set_eq:NN \UL@leadtype \__xeCJK_ulem_leader_type: }
-\xeCJK_cs_clear:N \__xeCJK_ulem_leader_type:
+ {
+ \cs_set_eq:NN \UL@putbox \__xeCJK_ulem_putbox:
+ \cs_set_eq:NN \xeCJK_ulem_hskip:n \__xeCJK_ulem_hskip_aux:n
+ }
+\cs_new_eq:NN \__xeCJK_ulem_putbox: \UL@putbox
+\cs_new_protected_nopar:Npn \__xeCJK_ulem_skip_putbox:
+ {
+ \tl_if_empty:NF \UL@start
+ { \box_use_clear:N \UL@box }
+ }
\cs_new_protected_nopar:Npn \__xeCJK_ulem_initial:
{
\__xeCJK_ulem_swap_cs:NN
@@ -99,13 +283,9 @@
\xeCJK_FullRight_and_Default: \__xeCJK_ulem_FullRight_and_Default:
\xeCJK_FullRight_and_CJK: \__xeCJK_ulem_FullRight_and_CJK:
\xeCJK_CJK_and_CJK:N \__xeCJK_ulem_CJK_and_CJK:N
- \xeCJK_Boundary_and_Default: \__xeCJK_ulem_Boundary_and_Default:
- \xeCJK_Boundary_and_NormalSp: \__xeCJK_ulem_Boundary_and_NormalSp:
+ \xeCJK_CJK_and_Boundary:w \__xeCJK_ulem_CJK_and_Boundary:w
\xeCJK@fix@penalty \__xeCJK_ulem_fix_penalty:
- \__xeCJK_punct_kern:n \__xeCJK_ulem_punct_kern:n
- \__xeCJK_punct_hskip:n \__xeCJK_ulem_punct_hskip:n
\__xeCJK_punct_breakable_kern:n \__xeCJK_ulem_punct_breakable_kern:n
- \__xeCJK_CJK_and_Boundary_aux: \__xeCJK_ulem_CJK_and_Boundary_aux:
\__xeCJK_Default_and_FullLeft_glue:N \__xeCJK_ulem_Default_and_FullLeft_glue:N
\__xeCJK_Default_and_FullRight_glue:N \__xeCJK_ulem_Default_and_FullRight_glue:N
\__xeCJK_CJK_and_FullLeft_glue:N \__xeCJK_ulem_CJK_and_FullLeft_glue:N
@@ -144,31 +324,26 @@
\exp_after:wN \use_i:nn
\fi:
}
-\cs_new_protected_nopar:Npn \__xeCJK_ulem_Boundary_and_Default:
- {
- \xeCJK_if_ulem_patch:TF
- {
- \xeCJK_if_last_node:nTF { CJK }
- { \xeCJK_remove_node: \skip_horizontal:N \l__xeCJK_ecglue_skip }
- { \xeCJK_if_last_node:nT { CJK-space } { \xeCJK_remove_node: \c_space_tl } }
- }
- { \__xeCJK_ulem_Boundary_and_Default: }
- }
-\cs_new_protected_nopar:Npn \__xeCJK_ulem_Boundary_and_NormalSp:
- {
- \xeCJK_if_ulem_patch:TF
- { \xeCJK_if_last_node:nT { CJK-space } { \xeCJK_remove_node: \c_space_tl } }
- { \__xeCJK_ulem_Boundary_and_NormalSp: }
- }
-\cs_new_protected_nopar:Npn \__xeCJK_ulem_CJK_and_Boundary_aux:
+\cs_new_protected_nopar:Npn \__xeCJK_ulem_CJK_and_Boundary:w
{
\xeCJK_if_ulem_patch:TF
{
- \xeCJK_class_group_end:
- \UL@stop \__xeCJK_ulem_hskip:n { \c_zero_skip } \UL@start
- { \xeCJK_make_node:n { CJK } }
+ \xeCJK_peek_catcode_ignore_spaces:NTF \c_math_toggle_token
+ { }
+ {
+ \bool_if:NTF \l__xeCJK_peek_ignore_spaces_bool
+ {
+ \xeCJK_class_group_end: \UL@stop
+ \UL@start { \xeCJK_make_node:n { CJK-space } }
+ }
+ {
+ \xeCJK_class_group_end: \UL@stop
+ \UL@start { \xeCJK_make_node:n { CJK } }
+ }
+ \xeCJK_make_group_tag:
+ }
}
- { \__xeCJK_ulem_CJK_and_Boundary_aux: }
+ { \__xeCJK_ulem_CJK_and_Boundary:w }
}
\cs_new_protected_nopar:Npn \__xeCJK_ulem_fix_penalty:
{
@@ -228,9 +403,7 @@
{
\UL@stop
\__xeCJK_ulem_skip_punct_begin:
- \int_compare:nNnTF \etex_lastnodetype:D = \c_one
- { \__xeCJK_zero_glue: }
- { \__xeCJK_punct_glue:NN \c__xeCJK_left_tl {#1} }
+ \__xeCJK_punct_glue:NN \c__xeCJK_left_tl {#1}
\UL@start
}
{ \__xeCJK_ulem_Boundary_and_FullLeft_glue:N #1 }
@@ -341,21 +514,24 @@
\cs_new_protected_nopar:Npn \__xeCJK_ulem_punct_hskip:n
{
\xeCJK_if_ulem_patch:TF
- { \__xeCJK_ulem_hskip:n }
+ { \xeCJK_ulem_hskip:n }
{ \__xeCJK_ulem_punct_hskip:n }
}
-\cs_new_protected_nopar:Npn \__xeCJK_ulem_punct_kern:n
+\cs_new_protected_nopar:Npn \__xeCJK_ulem_punct_kern:n #1
{
\xeCJK_if_ulem_patch:TF
- { \__xeCJK_ulem_hskip:n }
- { \__xeCJK_ulem_punct_kern:n }
+ {
+ \dim_compare:nNnF {#1} = \c_zero_dim
+ { \xeCJK_ulem_hskip:n {#1} }
+ }
+ { \__xeCJK_ulem_punct_kern:n {#1} }
}
\cs_new_protected_nopar:Npn \__xeCJK_ulem_punct_breakable_kern:n #1
{
\xeCJK_if_ulem_patch:TF
{
\xeCJK_class_group_end:
- \UL@stop \__xeCJK_ulem_hskip:n {#1} \UL@start
+ \UL@stop \xeCJK_ulem_hskip:n {#1} \UL@start
\__xeCJK_ulem_class_group_begin:
}
{ \__xeCJK_ulem_punct_breakable_kern:n {#1} }
@@ -363,98 +539,392 @@
\cs_new_protected_nopar:Npn \__xeCJK_ulem_glue:n #1
{
\xeCJK_if_ulem_patch:TF
- { \UL@stop \__xeCJK_ulem_hskip:n {#1} \UL@start }
+ {
+ \tl_if_empty:NTF \l__xeCJK_group_tag_tl
+ { \UL@stop \__xeCJK_ulem_hskip:n {#1} \UL@start }
+ {
+ \str_if_eq_x:nnTF { \l__xeCJK_group_tag_tl } { \c__xeCJK_group_tag_tl }
+ { \UL@stop \__xeCJK_ulem_hskip:n {#1} \UL@start }
+ { \skip_horizontal:n {#1} }
+ }
+ }
{ \skip_horizontal:n {#1} }
}
+\cs_new_protected_nopar:Npn \xeCJK_make_group_tag:
+ { \tl_set:Nx \l__xeCJK_group_tag_tl { \c__xeCJK_group_tag_tl } }
+\tl_new:N \l__xeCJK_group_tag_tl
+\tl_const:Nn \c__xeCJK_group_tag_tl
+ {
+ T \int_use:N \etex_currentgrouptype:D
+ L \int_use:N \etex_currentgrouplevel:D
+ }
\cs_new_protected_nopar:Npn \__xeCJK_ulem_ccglue:
{ \skip_set_eq:NN \UL@skip \l__xeCJK_ccglue_skip \UL@leaders }
-\cs_new_protected_nopar:Npn \__xeCJK_ulem_hskip:n #1
+\NewDocumentCommand \xeCJKfntefon
+ { > { \ReverseBoolean } s t- > { \ReverseBoolean } s }
+ {
+ \bool_set:Nn \l__xeCJK_ulem_skip_bool { #1 && #3 }
+ \bool_set_eq:NN \l__xeCJK_ulem_subtract_bool #2
+ \ULon
+ }
+\bool_new:N \l__xeCJK_ulem_subtract_bool
+\bool_new:N \l__xeCJK_ulem_skip_bool
+\cs_new_eq:NN \xeCJK_ulem_on:n \UL@on
+\cs_set_protected:Npn \UL@on #1
+ { \xeCJK_ulem_on:n { \xeCJK_ulem_left: #1 \xeCJK_ulem_right: } }
+\DeclareDocumentCommand \CJKunderline { s t- s o }
+ {
+ \c_group_begin_token
+ \xeCJK_fntef_boot:nnNNNn { underline } { uline } #1#2#3 {#4}
+ \xeCJK_fntef_initial:nnn
+ { \l__xeCJK_uline_depth_tl }
+ { \l__xeCJK_uline_sep_tl }
+ {
+ \l__xeCJK_uline_format_tl
+ \tex_vrule:D
+ height \dim_eval:n { \l__xeCJK_uline_thickness_tl }
+ depth \c_zero_dim
+ width .2em
+ }
+ \ULon
+ }
+\DeclareDocumentCommand \varCJKunderline { }
+ { \CJKunderline - }
+\DeclareDocumentCommand \CJKunderwave { s t- s o }
+ {
+ \c_group_begin_token
+ \xeCJK_fntef_boot:nnNNNn { underwave } { uwave } #1#2#3 {#4}
+ \xeCJK_fntef_initial:nnn
+ { \l__xeCJK_uwave_depth_tl }
+ { \l__xeCJK_uwave_sep_tl }
+ { \l__xeCJK_uwave_format_tl \l__xeCJK_uwave_symbol_tl }
+ \ULon
+ }
+\DeclareDocumentCommand \CJKunderdblline { s t- s o }
+ {
+ \c_group_begin_token
+ \xeCJK_fntef_boot:nnNNNn { underdblline } { udbline } #1#2#3 {#4}
+ \xeCJK_fntef_initial:nnn
+ { \l__xeCJK_udbline_depth_tl }
+ { \l__xeCJK_udbline_sep_tl }
+ {
+ \l__xeCJK_udbline_format_tl
+ \vbox_top:n
+ {
+ \tex_hrule:D
+ height \dim_eval:n { \l__xeCJK_udbline_thickness_tl }
+ depth \c_zero_dim
+ width .2em
+ \tex_kern:D \dim_eval:n { \l__xeCJK_udbline_gap_tl }
+ \tex_hrule:D
+ height \dim_eval:n { \l__xeCJK_udbline_thickness_tl }
+ depth \c_zero_dim
+ width .2em
+ }
+ }
+ \ULon
+ }
+\DeclareDocumentCommand \CJKsout { s t- s o }
+ {
+ \c_group_begin_token
+ \xeCJK_fntef_boot:nnNNNn { sout } { sout } #1#2#3 {#4}
+ \xeCJK_fntef_initial:nn
+ {
+ \l__xeCJK_sout_format_tl
+ \tex_vrule:D
+ height \dim_eval:n { \l__xeCJK_sout_thickness_tl }
+ depth \c_zero_dim
+ width .2em
+ }
+ {
+ \box_move_up:nn
+ { \l__xeCJK_sout_height_tl - \box_ht:N \l__xeCJK_fntef_box / 2 }
+ { \box_use:N \l__xeCJK_fntef_box }
+ }
+ \ULon
+ }
+\DeclareDocumentCommand \CJKxout { s t- s o }
+ {
+ \c_group_begin_token
+ \xeCJK_fntef_boot:nnNNNn { xout } { xout } #1#2#3 {#4}
+ \xeCJK_fntef_initial:nn
+ {
+ \l__xeCJK_xout_format_tl
+ \tex_kern:D -.1 em $/$
+ \tex_kern:D -.1 em
+ }
+ {
+ \box_move_up:nn
+ { \box_dp:N \l__xeCJK_fntef_box / 2 }
+ { \box_use:N \l__xeCJK_fntef_box }
+ }
+ \ULon
+ }
+\DeclareDocumentCommand \CJKunderanyline
+ { > { \ReverseBoolean } s t- > { \ReverseBoolean } s m m }
+ {
+ \c_group_begin_token
+ \xeCJK_fntef_initial:nn
+ {#5}
+ {
+ \box_move_down:nn
+ {#4}
+ { \box_use:N \l__xeCJK_fntef_box }
+ }
+ \bool_set:Nn \l__xeCJK_ulem_skip_bool { #1 && #3 }
+ \bool_set_eq:NN \l__xeCJK_ulem_subtract_bool #2
+ \ULon
+ }
+\cs_new_protected:Npn \xeCJK_fntef_boot:nnNNNn #1#2#3#4#5#6
+ {
+ \bool_if:nT { #3 || #5 }
+ { \bool_set_false:c { l__xeCJK_#2_skip_bool } }
+ \IfBooleanT #4
+ { \bool_set_true:c { l__xeCJK_#2_subtract_bool } }
+ \IfNoValueF {#6}
+ { \keys_set:nn { xeCJK / options / #1 } {#6} }
+ \bool_set_eq:Nc \l__xeCJK_ulem_skip_bool { l__xeCJK_#2_skip_bool }
+ \bool_set_eq:Nc \l__xeCJK_ulem_subtract_bool { l__xeCJK_#2_subtract_bool }
+ }
+\cs_new_protected_nopar:Npn \xeCJK_fntef_initial:n
+ {
+ \xeCJK_leave_vmode:
+ \bool_if:NTF \l__xeCJK_nest_bool
+ { \__xeCJK_warning:n { fntef-nesting } }
+ {
+ \bool_set_true:N \l__xeCJK_nest_bool
+ \__xeCJK_restore_shipout_fntef:
+ }
+ \xeCJK_fntef_sbox:n
+ }
+\cs_new_protected:Npn \xeCJK_fntef_initial:nn #1
{
- \int_compare:nNnTF \tex_lastkern:D = \c_three
- { \skip_horizontal:n {#1} }
- { \skip_set:Nn \UL@skip {#1} \UL@leaders }
+ \xeCJK_fntef_initial:n {#1}
+ \bool_if:NF \l__xeCJK_fntef_bool
+ { \dim_zero:N \l__xeCJK_fntef_dim }
+ \markoverwith
}
-\RenewDocumentCommand \CJKunderdot { m }
+\cs_new_protected:Npn \xeCJK_fntef_initial:nnn #1#2#3
{
- \bool_if:NT \l__xeCJK_ulem_hook_used_bool
- { \UL@stop \__xeCJK_ulem_restore_CJK_and_Boundary: }
- \CJK@preUnderdot
- \__xeCJK_make_under_symbol:n { \CJK@underdotSkip }
- \cs_gset_eq:NN \__xeCJK_save_under_CJKsymbol:N \CJKsymbol
- \cs_set_eq:NN \CJKsymbol \__xeCJK_under_CJKsymbol:N
- \__xeCJK_restore_shipout_CJKsymbol:
- \bool_if:NT \l__xeCJK_ulem_hook_used_bool { \UL@start }
- #1
- \bool_if:NT \l__xeCJK_ulem_hook_used_bool { \UL@stop }
- \cs_set_eq:NN \CJKsymbol \__xeCJK_save_under_CJKsymbol:N
- \tl_clear:N \l__xeCJK_fntef_shipout_tl
- \CJK@postUnderdot
- \bool_if:NT \l__xeCJK_ulem_hook_used_bool
- { \__xeCJK_ulem_restore_CJK_and_Boundary: \UL@start }
- \tex_ignorespaces:D
+ \xeCJK_fntef_initial:n {#3}
+ \bool_if:NF \l__xeCJK_fntef_bool
+ {
+ \bool_set_true:N \l__xeCJK_fntef_bool
+ \dim_set:Nn \l__xeCJK_fntef_dim {#1}
+ }
+ \markoverwith
+ {
+ \box_move_down:nn
+ { \l__xeCJK_fntef_dim + \box_ht:N \l__xeCJK_fntef_box }
+ { \box_use:N \l__xeCJK_fntef_box }
+ }
+ \dim_set:Nn \l__xeCJK_fntef_dim { #2 + \box_dp:N \ULC@box }
+ }
+\box_new:N \l__xeCJK_fntef_box
+\cs_new_eq:NN \xeCJKfntefbox \l__xeCJK_fntef_box
+\bool_new:N \l__xeCJK_nest_bool
+\bool_new:N \l__xeCJK_fntef_bool
+\__xeCJK_msg_new:nn { fntef-nesting }
+ { Nesting~is~not~supported. }
+\cs_new_eq:NN \l__xeCJK_fntef_dim \ULdepth
+\cs_new_protected:Npn \xeCJK_fntef_sbox:n #1
+ {
+ \hbox_set:Nn \l__xeCJK_fntef_box
+ {
+ \color_group_begin:
+ \color_ensure_current:
+ #1
+ \color_group_end:
+ }
}
-\box_new:N \g__xeCJK_under_symbol_box
-\cs_new_protected_nopar:Npn \__xeCJK_ulem_restore_CJK_and_Boundary:
+\cs_new_protected_nopar:Npn \xeCJK_leave_vmode:
{
- \xeCJK_if_ulem_patch:TF
+ \if_mode_vertical:
+ \exp_after:wN \tex_indent:D
+ \fi:
+ }
+\keys_define:nn { xeCJK / options }
+ {
+ underdot / symbol .tl_set:N = \l__xeCJK_udot_symbol_tl ,
+ underdot / depth .tl_set:N = \l__xeCJK_udot_depth_tl ,
+ underdot / sep .tl_set:N = \l__xeCJK_udot_sep_tl ,
+ underdot / format .tl_set:N = \l__xeCJK_udot_format_tl ,
+ underdot / boxdepth .tl_set:N = \l__xeCJK_udot_boxdepth_tl ,
+ symbol / sep .tl_set:N = \l__xeCJK_symbol_sep_tl ,
+ symbol / boxdepth .tl_set:N = \l__xeCJK_symbol_boxdepth_tl ,
+ underline / skip .bool_set:N = \l__xeCJK_uline_skip_bool ,
+ underline / subtract .bool_set:N = \l__xeCJK_uline_subtract_bool ,
+ underline / thickness .tl_set:N = \l__xeCJK_uline_thickness_tl ,
+ underline / depth .tl_set:N = \l__xeCJK_uline_depth_tl ,
+ underline / sep .tl_set:N = \l__xeCJK_uline_sep_tl ,
+ underline / format .tl_set:N = \l__xeCJK_uline_format_tl ,
+ underdblline / skip .bool_set:N = \l__xeCJK_udbline_skip_bool ,
+ underdblline / subtract .bool_set:N = \l__xeCJK_udbline_subtract_bool ,
+ underdblline / thickness .tl_set:N = \l__xeCJK_udbline_thickness_tl ,
+ underdblline / depth .tl_set:N = \l__xeCJK_udbline_depth_tl ,
+ underdblline / sep .tl_set:N = \l__xeCJK_udbline_sep_tl ,
+ underdblline / format .tl_set:N = \l__xeCJK_udbline_format_tl ,
+ underdblline / gap .tl_set:N = \l__xeCJK_udbline_gap_tl ,
+ underwave / skip .bool_set:N = \l__xeCJK_uwave_skip_bool ,
+ underwave / subtract .bool_set:N = \l__xeCJK_uwave_subtract_bool ,
+ underwave / symbol .tl_set:N = \l__xeCJK_uwave_symbol_tl ,
+ underwave / depth .tl_set:N = \l__xeCJK_uwave_depth_tl ,
+ underwave / sep .tl_set:N = \l__xeCJK_uwave_sep_tl ,
+ underwave / format .tl_set:N = \l__xeCJK_uwave_format_tl ,
+ sout / skip .bool_set:N = \l__xeCJK_sout_skip_bool ,
+ sout / subtract .bool_set:N = \l__xeCJK_sout_subtract_bool ,
+ sout / thickness .tl_set:N = \l__xeCJK_sout_thickness_tl ,
+ sout / height .tl_set:N = \l__xeCJK_sout_height_tl ,
+ sout / format .tl_set:N = \l__xeCJK_sout_format_tl ,
+ xout / skip .bool_set:N = \l__xeCJK_xout_skip_bool ,
+ xout / subtract .bool_set:N = \l__xeCJK_xout_subtract_bool ,
+ xout / format .tl_set:N = \l__xeCJK_xout_format_tl
+ }
+\clist_map_inline:nn
+ { underdot , underline , underdblline , underwave , sout , xout }
+ {
+ \keys_define:nn { xeCJK / options }
+ { #1 .meta:nn = { xeCJK / options / #1 } { ##1 } }
+ }
+\keys_set:nn { xeCJK / options }
+ {
+ underdot / symbol = \normalfont . ,
+ underdot / depth = 0.20 em ,
+ underdot / sep = 0.04 em ,
+ underdot / boxdepth = \c_max_dim ,
+ symbol / sep = \c_zero_dim ,
+ symbol / boxdepth = \c_max_dim ,
+ underline / skip = true ,
+ underline / thickness = \ULthickness ,
+ underline / depth = 0.20 em ,
+ underline / sep = 0.07 em ,
+ underdblline / skip = true ,
+ underdblline / thickness = \ULthickness ,
+ underdblline / depth = 0.20 em ,
+ underdblline / sep = 0.17 em ,
+ underdblline / gap = 1.1 pt ,
+ underwave / skip = true ,
+ underwave / symbol = \sixly \tex_char:D 58 \exp_stop_f: ,
+ underwave / depth = 0.20 em ,
+ underwave / sep = 0.00 em ,
+ sout / skip = true ,
+ sout / thickness = \ULthickness ,
+ sout / height = 0.35 em ,
+ xout / skip = true
+ }
+\cs_if_free:NF \color
+ {
+ \keys_set:nn { xeCJK / options }
{
- \xeCJK_swap_cs:NN
- \__xeCJK_CJK_and_Boundary_aux: \__xeCJK_ulem_CJK_and_Boundary_aux:
+ underdot / format = \color { red } ,
+ underline / format = \color { blue } ,
+ underdblline / format = \color { blue } ,
+ underwave / format = \color { blue } ,
+ sout / format = \color { red } ,
+ xout / format = \color { blue }
}
- { }
}
-\RenewDocumentCommand \CJKunderanysymbol { m m m }
+\DeclareDocumentCommand \CJKunderanysymbol { o m m m }
{
+ \xeCJK_under_symbol:nnnnnn { symbol } { symbol } {#1} {#2} {#3} {#4}
+ \tex_ignorespaces:D
+ }
+\DeclareDocumentCommand \CJKunderdot { o m }
+ {
+ \xeCJK_under_symbol:nnnnnn { underdot } { udot }
+ {#1}
+ { \l__xeCJK_udot_depth_tl }
+ { \l__xeCJK_udot_format_tl \l__xeCJK_udot_symbol_tl }
+ {#2}
+ \tex_ignorespaces:D
+ }
+\cs_new_protected_nopar:Npn \xeCJK_under_symbol:nnnnnn
+ {
+ \xeCJK_if_ulem_patch:TF
+ { \__xeCJK_under_symbol_auxi:nnnnnn }
+ { \__xeCJK_under_symbol_auxii:nnnnnn }
+ }
+\cs_new_protected:Npn \__xeCJK_under_symbol_auxi:nnnnnn #1#2#3#4#5#6
+ {
+ \xeCJK_ulem_right: \UL@stop
\group_begin:
- \hbox_set:Nn \CJK@underdotBox {#2}
- \__xeCJK_make_under_symbol:n {#1}
- \cs_set_eq:NN \__xeCJK_save_under_CJKsymbol:N \CJKsymbol
- \cs_set_eq:NN \CJKsymbol \__xeCJK_under_CJKsymbol:N
- \__xeCJK_restore_shipout_CJKsymbol:
- \tl_clear:N \l__xeCJK_underdot_shipout_tl
- #3
+ \xeCJK_under_symbol_initial:nnnnn {#1} {#2} {#3} {#4} {#5}
+ \UL@start \xeCJK_ulem_right_node:
+ #6
+ \xeCJK_ulem_right: \UL@stop
\group_end:
- \tex_ignorespaces:D
+ \UL@start \xeCJK_ulem_right_node:
}
-\cs_new_protected:Npn \__xeCJK_restore_shipout_CJKsymbol:
+\cs_new_protected:Npn \__xeCJK_under_symbol_auxii:nnnnnn #1#2#3#4#5#6
{
- \tl_set:Nn \l__xeCJK_fntef_shipout_tl
- {
- \l__xeCJK_underdot_shipout_tl
- \cs_set_eq:NN \CJKsymbol \__xeCJK_save_under_CJKsymbol:N
- }
+ \xeCJK_leave_vmode:
+ \group_begin:
+ \xeCJK_under_symbol_initial:nnnnn {#1} {#2} {#3} {#4} {#5}
+ #6
+ \group_end:
}
-\tl_new:N \l__xeCJK_fntef_shipout_tl
-\tl_new:N \l__xeCJK_underdot_shipout_tl
-\tl_set:Nn \l__xeCJK_underdot_shipout_tl
+\cs_new_protected:Npn \xeCJK_under_symbol_initial:nnnnn #1#2#3#4#5
{
- \cs_set_eq:NN \CJKf@global \scan_stop:
- \int_zero:N \CJK@nest \CJK@postUnderdot
+ \IfNoValueF {#3}
+ { \keys_set:nn { xeCJK / options / #1 } {#3} }
+ \xeCJK_fntef_sbox:n {#5}
+ \bool_if:NTF \l__xeCJK_fntef_bool
+ { \xeCJK_make_under_symbol:nn { \l__xeCJK_fntef_dim } }
+ {
+ \bool_set_true:N \l__xeCJK_fntef_bool
+ \xeCJK_make_under_symbol:nn {#4}
+ }
+ { \use:c { l__xeCJK_#2_boxdepth_tl } }
+ \dim_set:Nn \l__xeCJK_fntef_dim
+ { \use:c { l__xeCJK_#2_sep_tl } + \box_dp:N \l__xeCJK_under_symbol_box }
+ \xeCJK_swap_cs:NN \CJKsymbol \__xeCJK_under_CJKsymbol:N
+ \__xeCJK_restore_shipout_CJKsymbol:
}
-\xeCJK_add_to_shipout:n { \l__xeCJK_fntef_shipout_tl }
-\cs_new_protected:Npn \__xeCJK_make_under_symbol:n #1
+\box_new:N \l__xeCJK_under_symbol_box
+\cs_new_protected:Npn \xeCJK_make_under_symbol:nn #1#2
{
- \hbox_set:Nn \l__xeCJK_tmp_box { ^^^^4e00 }
- \vbox_gset_to_ht:Nnn \g__xeCJK_under_symbol_box \c_zero_dim
+ \hbox_set:Nn \l__xeCJK_under_symbol_box
{
- \skip_vertical:n {#1}
- \hbox_to_zero:n
+ \box_move_down:nn { #1 + \box_ht:N \l__xeCJK_fntef_box }
{
- \tex_kern:D \box_wd:N \l__xeCJK_tmp_box
- \tex_hss:D \box_use:N \CJK@underdotBox \tex_hss:D
+ \hbox_to_zero:n
+ {
+ \xeCJK_select_font:
+ \tex_kern:D \etex_fontcharwd:D \tex_font:D "4E00 \exp_stop_f:
+ \tex_hss:D \box_use:N \l__xeCJK_fntef_box \tex_hss:D
+ }
}
- \tex_vss:D
}
+ \dim_compare:nNnF {#2} = \c_max_dim
+ { \box_set_dp:Nn \l__xeCJK_under_symbol_box {#2} }
+ }
+\cs_new_protected:Npn \__xeCJK_restore_shipout_CJKsymbol:
+ {
+ \tl_put_right:Nn \l__xeCJK_fntef_shipout_tl
+ { \xeCJK_swap_cs:NN \CJKsymbol \__xeCJK_under_CJKsymbol:N }
+ \__xeCJK_restore_shipout_fntef:
+ \xeCJK_cs_clear:N \__xeCJK_restore_shipout_CJKsymbol:
+ }
+\cs_new_protected:Npn \__xeCJK_restore_shipout_fntef:
+ {
+ \tl_put_right:Nn \l__xeCJK_fntef_shipout_tl
+ {
+ \bool_set_false:N \l__xeCJK_fntef_bool
+ \dim_zero:N \l__xeCJK_fntef_dim
+ }
+ \xeCJK_cs_clear:N \__xeCJK_restore_shipout_fntef:
}
-\cs_new_protected_nopar:Npn \__xeCJK_under_CJKsymbol:N #1
+\tl_new:N \l__xeCJK_fntef_shipout_tl
+\xeCJK_add_to_shipout:n { \l__xeCJK_fntef_shipout_tl }
+\cs_new_protected_nopar:Npn \__xeCJK_under_CJKsymbol:N
{
- \hbox_overlap_right:n { \box_use:N \g__xeCJK_under_symbol_box }
- \xeCJK_no_break: \__xeCJK_save_under_CJKsymbol:N {#1}
+ \box_use:N \l__xeCJK_under_symbol_box
+ \xeCJK_no_break: \__xeCJK_under_CJKsymbol:N
}
-\RenewDocumentEnvironment { CJKfilltwosides } { O { c } m }
+\DeclareDocumentEnvironment { CJKfilltwosides } { O { c } m }
{
\use:x { \exp_not:N \minipage [#1] { \dim_eval:n {#2} } }
- \cs_set_eq:NN \CJKglue \tex_hfill:D
+ \cs_set_eq:NN \CJKglue \xeCJK_fntef_hfilll:
}
{
\endminipage
@@ -462,10 +932,15 @@
}
\NewEnviron { CJKfilltwosides* } [ 2 ] [ c ]
{
- \cs_set_eq:NN \CJKglue \tex_hfill:D
+ \cs_set_eq:NN \CJKglue \xeCJK_fntef_hfilll:
\tl_set:Nn \arraystretch { 1 }
- \token_if_dim_register:NT \extrarowheight
- { \dim_set_eq:NN \extrarowheight \c_zero_dim }
+ \cs_if_free:NF \extrarowheight
+ { \cs_set_eq:NN \extrarowheight \c_zero_dim }
+ \use:x { \__xeCJK_fill_two_sides:nn {#1} { \dim_eval:n {#2} } }
+ }
+ [ \ignorespacesafterend ]
+\cs_new_protected:Npn \__xeCJK_fill_two_sides:nn #1#2
+ {
\dim_compare:nNnTF {#2} > \c_zero_dim
{
\hbox_set:Nn \l__xeCJK_tmp_box
@@ -476,11 +951,11 @@
}
\dim_compare:nNnTF {#2} > { \box_wd:N \l__xeCJK_tmp_box }
{
- \tabular [#1] { @ { } p { \dim_eval:n {#2} } @ { } }
+ \tabular [#1] { @ { } p {#2} @ { } }
\BODY
\endtabular
}
- { \hbox_unpack:N \l__xeCJK_tmp_box }
+ { \box_use:N \l__xeCJK_tmp_box }
}
{
\tabular [#1] { @ { } c @ { } }
@@ -488,7 +963,10 @@
\endtabular
}
}
- [ \ignorespacesafterend ]
+\cs_new_protected_nopar:Npn \xeCJK_fntef_hfilll:
+ { \skip_horizontal:N \c__xeCJK_filll_skip }
+\skip_new:N \c__xeCJK_filll_skip
+\skip_set:Nn \c__xeCJK_filll_skip { \c_zero_dim plus 1 filll }
%%
%% This package consists of the file xeCJK.dtx,
%% full-stop.map,