summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2021-10-01 22:04:50 +0000
committerKarl Berry <karl@freefriends.org>2021-10-01 22:04:50 +0000
commitb5362fdbc95674f99baad0a585f01ef1d93a89aa (patch)
tree4079e5248c77c62380e02f5a2efd2c3d785bbee2 /Master/texmf-dist/tex
parentfba4edfadf86335fc7d1a4fdd7a9dce38809e001 (diff)
zitie (2oct21)
git-svn-id: svn://tug.org/texlive/trunk@60676 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex')
-rw-r--r--Master/texmf-dist/tex/xelatex/zitie/zitie.luatex.def90
-rw-r--r--Master/texmf-dist/tex/xelatex/zitie/zitie.sty689
-rw-r--r--Master/texmf-dist/tex/xelatex/zitie/zitie.xetex.def52
3 files changed, 648 insertions, 183 deletions
diff --git a/Master/texmf-dist/tex/xelatex/zitie/zitie.luatex.def b/Master/texmf-dist/tex/xelatex/zitie/zitie.luatex.def
new file mode 100644
index 00000000000..9a312019871
--- /dev/null
+++ b/Master/texmf-dist/tex/xelatex/zitie/zitie.luatex.def
@@ -0,0 +1,90 @@
+% maybe use pdf_literal will be better
+\cs_new:Npn \zitie_stroke_chars:nn #1#2
+ { \special { pdf:code ~ q ~ #1 } #2 \special { pdf:code ~ Q } }
+\cs_new:Npn \zitiestrokechars { \zitie_stroke_chars:nn }
+
+% \RequirePackage {luatexja-fontspec} % using ctex currently
+%%% require on ctex
+\RequirePackage {ctex}
+%% copy from xeCJK
+\prg_new_conditional:Npnn \__zitie_if_blank_x:n #1 { p , T , F , TF }
+ {
+ \if_case:w \tex_strcmp:D { } {#1} \exp_stop_f:
+ \prg_return_true:
+ \else:
+ \if_case:w \tex_strcmp:D { ~ } {#1} \exp_stop_f:
+ \prg_return_true: \else: \prg_return_false: \fi:
+ \fi:
+ }
+\cs_new_protected:Npn \__zitie_check_num_range:nnNN #1#2#3#4
+ {
+ \bool_lazy_or:nnTF
+ { \__zitie_if_blank_x_p:n {#1} }
+ { \__zitie_if_blank_x_p:n {#2} }
+ {
+ \int_set:Nn #3 { \__zitie_if_blank_x:nTF {#1} {#2} {#1} }
+ \int_set_eq:NN #3 #4
+ }
+ {
+ \int_set:Nn #3 { \int_min:nn {#1} { \tl_if_novalue:nTF {#2} {#1} {#2} } }
+ \int_set:Nn #4 { \int_max:nn {#1} { \tl_if_novalue:nTF {#2} {#1} {#2} } }
+ }
+ }
+% dosen't work
+\prg_new_conditional:Npnn \zitie_glyph_if_exist:N #1 { p , T , F , TF }
+ { \prg_return_true: }
+\cs_set_eq:NN \__zitie_int_until_do:nn \int_until_do:nn
+%%
+
+\tl_new:N \l__zitie_cfg_tmp_tl
+\str_new:N \l__zitie_cfg_tmp_str
+\newfontfeature{FallBack}{}
+\NewDocumentCommand \zitierawCJKfamily { t+ t- m } { \CJKfamily {#3} }
+\prg_new_protected_conditional:Npnn \zitie_family_if_exist:n #1 { T , F , TF }
+ {
+ \prop_if_in:NnTF \g__ctex_ltj_family_name_prop {#1}
+ { \prg_return_true: }
+ {
+ \cs_if_exist_use:cTF { \__ctex_ltj_family_csname:n {#1} }
+ { \prg_return_true: } { \prg_return_false: }
+ }
+ }
+\cs_new:Npn \__zitie_font_select:nN #1
+ {
+ \exp_args:Nx \zitie_family_if_exist:nTF { \c_zitie_font_name_prefix_tl #1 }
+ { \fontfamily { \c_zitie_font_name_prefix_tl #1 } }
+ { \fontfamily {#1} }
+ % { \zitierawCJKfamily { \c_zitie_font_name_prefix_tl #1 } }
+ % { \zitierawCJKfamily {#1} }
+ }
+\NewDocumentCommand \zitieCJKfamily { t+ t- m }
+ { \__zitie_font_select:nN {#3} }
+\cs_generate_variant:Nn \ctex_ltj_set_family:nnn { onn }
+\cs_new:Npn \__zitie_new_font_family:nnn #1#2#3
+ {
+ \tl_set:Nx \l__zitie_cfg_tmp_tl { \c_zitie_font_name_prefix_tl #1 }
+ \__ctex_ltj_pass_args:nnnn
+ { \ctex_ltj_set_family:onn { \l__zitie_cfg_tmp_tl } } {#3} {#2}
+ { }
+ }
+\cs_new:Npn \__zitie_new_font_family_validate:nnn #1#2#3
+ {
+ \zitie_font_if_exist:nTF {#2} { \__zitie_new_font_family:nnn {#1} {#2} {#3} }
+ { \msg_warning:nnn { zitie } { font-exist } {#2} }
+ }
+%%%
+
+%% to support luatex without ctex, need to implement those functions:
+\cs_new_protected:Npn \xeCJKResetPunctClass { }
+\cs_new:Npn \zitie_token_class_dispatch:Nnnnn #1#2#3#4#5
+ { \use_ii:nnnn }
+\prg_new_conditional:Npnn \zitie_token_if_punctuation:N #1 { p, T, F, TF }
+ { \prg_return_false: }
+\cs_new:Npn \xeCJKDeclareCharClass #1#2 { }
+% \cs_new:Npn \zitierawCJKfamily { } %\CJKfamily
+% \prg_new_conditional:Npnn \zitie_family_if_exist:n #1 { T, F, TF } { }
+% \cs_new_nopar:Nn \__zitie_font_select:nN #1#2 { }
+% \NewDocumentCommand \zitieCJKfamily { t+ t- m } { }
+% \cs_new:Nn \__zitie_new_font_family:nnn #1#2#3 { }
+% \cs_new:Nn \__zitie_new_font_family_validate:nnn #1#2#3 { }
+%% \ No newline at end of file
diff --git a/Master/texmf-dist/tex/xelatex/zitie/zitie.sty b/Master/texmf-dist/tex/xelatex/zitie/zitie.sty
index 0dfe9d137c2..a61d19d7100 100644
--- a/Master/texmf-dist/tex/xelatex/zitie/zitie.sty
+++ b/Master/texmf-dist/tex/xelatex/zitie/zitie.sty
@@ -2,42 +2,44 @@
\NeedsTeXFormat{LaTeX2e}[2020/10/01]
\RequirePackage{ xparse , l3keys2e }
\RequirePackage{ l3draw }
-\ProvidesExplPackage {zitie} {2021/09/23} {v1.1} {CJK character calligraphy sheet}
-\RequirePackage { xeCJK }
-\@ifpackageloaded { ctex } { }
- { \RequirePackage { ctexsize } \sys_if_platform_windows:T { \setCJKmainfont {SimSun} } }
+\ProvidesExplPackage {zitie} {2021/10/01} {v1.4.0} {CJK character calligraphy sheet}
\@ifpackageloaded { xcolor }
{
- \cs_set_nopar:Npn \zitie_color_select:nn #1#2 { \colorlet{#1}{#2} \color_set:nn {#1} {#2} }
- \cs_set_nopar:Npn \zitie_color_select:nnn #1#2#3 { \colorlet{#1}[#2]{#3} \color_set:nnn {#1} {#2} {#3} }
+ \cs_set_nopar:Npn \zitie_color_set:nn #1#2 { \colorlet{#1}{#2} \color_set:nn {#1} {#2} }
+ \cs_set_nopar:Npn \zitie_color_set:nnn #1#2#3 { \colorlet{#1}[#2]{#3} \color_set:nnn {#1} {#2} {#3} }
}
{
\hook_gput_code:nnn { package/after/xcolor } { package }
{
- \cs_set_nopar:Npn \zitie_color_select:nn #1#2 { \colorlet{#1}{#2} \color_set:nn {#1} {#2} }
- \cs_set_nopar:Npn \zitie_color_select:nnn #1#2#3 { \colorlet{#1}[#2]{#3} \color_set:nnn {#1} {#2} {#3} }
+ \cs_set_nopar:Npn \zitie_color_set:nn #1#2 { \colorlet{#1}{#2} \color_set:nn {#1} {#2} }
+ \cs_set_nopar:Npn \zitie_color_set:nnn #1#2#3 { \colorlet{#1}[#2]{#3} \color_set:nnn {#1} {#2} {#3} }
}
- \cs_set_nopar:Npn \zitie_color_select:nn #1#2 { \color_set:nn {#1} {#2} }
- \cs_set_nopar:Npn \zitie_color_select:nnn #1#2#3 { \color_set:nnn {#1} {#2} {#3} }
+ \cs_set_nopar:Npn \zitie_color_set:nn #1#2 { \color_set:nn {#1} {#2} }
+ \cs_set_nopar:Npn \zitie_color_set:nnn #1#2#3 { \color_set:nnn {#1} {#2} {#3} }
}
\NewDocumentCommand \zitiecolorlet { m o m }
- { \IfNoValueTF {#2} { \zitie_color_select:nn {#1} {#3} } { \zitie_color_select:nnn {#1} {#2} {#3} } }
+ { \IfNoValueTF {#2} { \zitie_color_set:nn {#1} {#3} } { \zitie_color_set:nnn {#1} {#2} {#3} } }
+\tl_new:N \zitiebasechar
+\tl_new:N \l__zitie_basechar_fontsize_tl
\box_new:N \l_zitie_basebox_box
\tl_new:N \l_zitie_frame_type_tl
\tl_new:N \l_zitie_resize_method_tl
\clist_new:N \g__zitie_frame_list_clist
\clist_new:N \g__zitie_resize_method_clist
-\dim_new:N \l__zitie_char_width_dim
-\dim_new:N \l__zitie_char_height_dim
\dim_new:N \l__zitie_box_width_dim
\dim_new:N \l__zitie_box_height_dim
\coffin_new:N \l__zitie_box_coffin
\dim_new:N \l__zitie_linewidth_dim
\cs_new_nopar:Nn \__zitie_aux_color_fill: { }
\ior_new:N \g__zitie_file_read_ior
-\clist_new:N \g__zitie_fallback_font_clist
+\clist_new:N \l__zitie_fallback_font_clist
+\int_new:N \l__zitie_repeat_int
+\dim_new:N \l__zitie_tolerance_dim
+\int_new:N \l__zitie_tallheight_int
+\dim_new:N \zitiebasecharwidth
+\dim_new:N \zitiebasecharheight
\dim_new:N \zitiewidth
\dim_new:N \zitieheight
\dim_new:N \zitieboxwd
@@ -58,58 +60,19 @@
\tl_const:Nn \c_zitie_font_name_prefix_tl { 字帖@ }
-%%% fontspec, xeCJK, xetex
-\cs_new:Npn \zitie_stroke_chars:nn #1#2 % operator, chars
- { \special { pdf:code ~ q ~ #1 } #2 \special { pdf:code ~ Q } }
-\cs_new:Npn \zitiestrokechars { \zitie_stroke_chars:nn }
-\prg_set_eq_conditional:NNn \zitie_font_if_exist:n \fontspec_font_if_exist:n { T, F, TF }
-\cs_new_nopar:Npn \__zitie_zihao:n #1 { \zihao {#1} }
-\cs_set_eq:NN \__zitie_check_num_range:nnNN \__xeCJK_check_num_range:nnNN
-\cs_set_eq:NN \__zitie_int_until_do:nn \xeCJK_int_until_do:nn
-\cs_new_nopar:Npn \__zitie_font_select:nN #1
- {
- \xeCJK_family_if_exist:nTF { \c_zitie_font_name_prefix_tl #1 }
- { \CJKfamily+ { \c_zitie_font_name_prefix_tl #1 } }
- { \CJKfamily+ {#1} }
- }
-\NewDocumentCommand \zitieCJKfamily { t+ t- m }
+\sys_if_engine_xetex:TF { \tex_input:D zitie.xetex.def \prg_do_nothing: }
{
- \xeCJK_family_if_exist:nTF { \c_zitie_font_name_prefix_tl #3 }
- { \xeCJK_family:NNx #1 #2 { \c_zitie_font_name_prefix_tl #3 } }
- { \xeCJK_family:NNx #1 #2 {#3} }
- \tex_ignorespaces:D
+ \sys_if_engine_luatex:TF { \tex_input:D zitie.luatex.def \prg_do_nothing: }
+ { \msg_fatal:nnx { zitie } { engine } { \c_sys_engine_str } }
}
+\prg_set_eq_conditional:NNn \zitie_font_if_exist:n \fontspec_font_if_exist:n { T, F, TF }
+\cs_new_nopar:Npn \__zitie_zihao:n #1 { \zihao {#1} }
+\msg_new:nnn { zitie } { engine } { Engine~ must~ be~ `xetex'~ or~ `luatex', while~ you~ use~ `#1'. }
\msg_new:nnn { zitie } { font-exist } { Font~ `#1'~ not~ exist, has~ been~ ignored. }
-\cs_new:Npn \__zitie_new_font_family:nnn #1#2#3 % family name, font name, feature
- { \__xeCJK_pass_args:nnnn { \xeCJK_set_family:nnn { \c_zitie_font_name_prefix_tl #1 } } {#3} {#2} { } }
-\cs_new:Npn \__zitie_new_font_family_validate:nnn #1#2#3
- {
- \zitie_font_if_exist:nTF {#2} { \__zitie_new_font_family:nnn {#1} {#2} {#3} }
- { \msg_warning:nnn { zitie } { font-exist } {#2} }
- }
-\cs_new:Npn \zitie_token_class_dispatch:Nnnnn #1
- {
- \if_case:w \xeCJK_token_value_class:N #1 \exp_stop_f:
- \exp_after:wN \use_none:nnn % other
- \or: \exp_after:wN \use_i:nnnn % CJK
- \or: \exp_after:wN \use_ii:nnnn % FullLeft
- \or: \exp_after:wN \use_iii:nnnn % FullRight
- \else: \exp_after:wN \use_none:nnn % other
- \fi:
- }
\cs_new:Npn \zitie_token_class_dispatch_o:Nnnnn #1
{ \exp_after:wN \zitie_token_class_dispatch:Nnnnn #1 }
\cs_new:Npn \zitie_token_class_dispatch_f:Nnnnn #1
{ \exp_args:Nf \zitie_token_class_dispatch:Nnnnn #1 }
-\prg_new_conditional:Npnn \zitie_token_if_punctuation:N #1 { p, T, F, TF }
- {
- \int_compare:nNnTF { \xeCJK_token_value_class:N #1 } > 1
- {
- \int_compare:nNnTF { \xeCJK_token_value_class:N #1 } < 6
- { \prg_return_true: } { \prg_return_false: }
- }
- { \prg_return_false: }
- }
\cs_set:Npn \zitie_token_if_punctuation_o:NTF
{ \exp_after:wN \zitie_token_if_punctuation:NTF }
\cs_set:Npn \zitie_token_if_punctuation_o:NT
@@ -134,9 +97,34 @@
}
\cs_new:Npn \__zitie_calc_basechar_w_h:
{
- \dim_set:Nn \l__zitie_char_width_dim { \box_wd:N \l_zitie_basebox_box }
- \dim_set:Nn \l__zitie_char_height_dim { \box_ht_plus_dp:N \l_zitie_basebox_box }
+ \hbox_set:Nn \l_zitie_basebox_box { \l__zitie_basechar_fontsize_tl \zitiebasechar }
+ \dim_set:Nn \zitiebasecharwidth { \box_wd:N \l_zitie_basebox_box }
+ \dim_set:Nn \zitiebasecharheight { \box_ht_plus_dp:N \l_zitie_basebox_box }
+ }
+\dim_new:N \l__zitie_linetotal_dim
+\dim_new:N \l__zitie_linemax_dim
+\cs_new:Npn \__zitie_break_max_calc:
+ {
+ \dim_set:Nn \l__zitie_linemax_dim
+ {
+ .5\paperwidth + .5\textwidth
+ - \marginparwidth - \marginparsep
+ + \l__zitie_tolerance_dim
+ }
}
+\cs_new_protected:Npn \__zitie_break_default:
+ {
+ \if_dim:w \l__zitie_linemax_dim > \l__zitie_linetotal_dim
+ \tex_advance:D \l__zitie_linetotal_dim by 1.1\zitieboxwd
+ \if_dim:w \l__zitie_linemax_dim < \l__zitie_linetotal_dim
+ \dim_zero:N \l__zitie_linetotal_dim \break
+ \else: \nobreak
+ \fi:
+ \else:
+ \dim_zero:N \l__zitie_linetotal_dim \break
+ \fi:
+ }
+
\cs_new_nopar:Npn \zitie_frame_type:n #1 { __zitie_frame_construct_type_ #1 :nnnnnn } % x1, y1, x2, y2, x times, y times
\cs_new_nopar:Npn \zitie_frame_type_c:n #1 { \use:c { __zitie_frame_construct_type_ #1 :nnnnnn } }
\cs_new_nopar:Npn \__zitie_resize:n #1 { __zitie_processor_resize_ #1 :n }
@@ -166,17 +154,17 @@
}
\cs_new_nopar:Npn \__zitie_cjk_glyph_use_aux:N #1
{
- \exp_args:Nf \xeCJK_glyph_if_exist:NTF #1 {#1}
+ \exp_args:Nf \zitie_glyph_if_exist:NTF #1 {#1}
{
- \clist_pop:NNTF \g__zitie_fallback_font_clist \l__zitie_tmpa_tl
+ \clist_pop:NNTF \l__zitie_fallback_font_clist \l__zitie_tmpa_tl
{
- \xeCJK_family_if_exist:nTF { \c_zitie_font_name_prefix_tl \l__zitie_tmpa_tl }
+ \zitie_family_if_exist:nTF { \c_zitie_font_name_prefix_tl \l__zitie_tmpa_tl }
{
- \CJKfamily+ { \c_zitie_font_name_prefix_tl \l__zitie_tmpa_tl }
+ \zitierawCJKfamily+ { \c_zitie_font_name_prefix_tl \l__zitie_tmpa_tl }
\__zitie_cjk_glyph_use_aux:N #1
}
{
- \CJKfamily+ { \l__zitie_tmpa_tl }
+ \zitierawCJKfamily+ { \l__zitie_tmpa_tl }
\__zitie_cjk_glyph_use_aux:N #1
}
}
@@ -200,12 +188,16 @@
\keys_define:nn { zitie }
{
- basechar .code:n = { \tl_gset:Nx \c_zitie_basechar_tl {#1} \__zitie_calc_basechar_w_h: } ,
- zihao .code:n =
- {
- \hbox_gset:Nn \l_zitie_basebox_box { \__zitie_zihao:n {#1} \c_zitie_basechar_tl }
- \__zitie_calc_basechar_w_h:
- } ,
+ basechar .code:n = { \tl_set:Nx \zitiebasechar {#1} \__zitie_calc_basechar_w_h: } ,
+ basechar .initial:n = 好 ,
+ basecharfontsize .code:n = { \tl_set:Nn \l__zitie_basechar_fontsize_tl {#1} \__zitie_calc_basechar_w_h: } ,
+ basecharfontsize .initial:n = \normalsize ,
+ basecharfontsize .default:n = \normalsize ,
+ zihao .meta:n = { basecharfontsize = \__zitie_zihao:n {#1} } ,
+ position .choice: ,
+ position / unknown .code:n = { \cs_set_eq:cc { \zitie_processor:n { position } } {#1} } ,
+ position* .cs_set:cp = { \zitie_processor:n { position } } #1 ,
+ anchor .meta:n = { position = anchor-#1 } ,
punctuation .choice: ,
punctuation / ignore .code:n = { \cs_set_eq:cN { \zitie_processor:n { punctuation } } \use_none:n } ,
punctuation / leave .code:n = { \cs_set_eq:cN { \zitie_processor:n { punctuation } } \use:n } ,
@@ -227,7 +219,7 @@
} ,
font .tl_set:N = \l__zitie_font_tl ,
font .initial:n = 宋体 ,
- font .default:n = { } , % { \l_xeCJK_family_tl } ,
+ font .default:n = { } ,
xscale .tl_set:N = \l__zitie_x_scale_tl ,
xscale .initial:n = 1 ,
yscale .tl_set:N = \l__zitie_y_scale_tl ,
@@ -237,26 +229,33 @@
height .dim_set:N = \l__zitie_box_height_dim ,
linewidth .dim_set:N = \l__zitie_linewidth_dim ,
linewidth .initial:n = 0.4pt ,
- framecolor .code:n = { \zitie_color_select:nn { zitieframecolor } {#1} } ,
+ holdbasecharwidth .bool_set:N = \l__zitie_holdbasechar_width_bool ,
+ holdbasecharwidth .default:n = true ,
+ holdbasecharheight .bool_set:N = \l__zitie_holdbasechar_height_bool ,
+ holdbasecharheight .default:n = true ,
+ holdbasechar .meta:n = { holdbasecharwidth = #1 , holdbasecharheight = #1 } ,
+ holdbasechar .initial:n = false ,
+ holdbasechar .default:n = true ,
+ framecolor .code:n = { \zitie_color_set:nn { zitieframecolor } {#1} } ,
framecolor .initial:n = black ,
- framecolor* .code:n = { \zitie_color_select:nnn { zitieframecolor } #1 } ,
- charcolor .code:n = { \zitie_color_select:nn { zitiecharcolor } {#1} } ,
+ framecolor* .code:n = { \zitie_color_set:nnn { zitieframecolor } #1 } ,
+ charcolor .code:n = { \zitie_color_set:nn { zitiecharcolor } {#1} } ,
charcolor .initial:n = black ,
- charcolor* .code:n = { \zitie_color_select:nnn { zitieframecolor } {#1} } ,
+ charcolor* .code:n = { \zitie_color_set:nnn { zitieframecolor } {#1} } ,
color .meta:n = { framecolor = #1, charcolor = #1 } ,
color* .meta:n = { framecolor* = #1, charcolor* = #1 } ,
fillcolor .code:n =
{
\exp_args:Nx \tl_if_empty:nTF {#1}
- { \zitie_color_select:nn { zitiefillcolor } { white } \cs_set_nopar:Npn \__zitie_aux_color_fill: { } }
+ { \zitie_color_set:nn { zitiefillcolor } { white } \cs_set_nopar:Npn \__zitie_aux_color_fill: { } }
{
- \zitie_color_select:nn { zitiefillcolor } {#1}
+ \zitie_color_set:nn { zitiefillcolor } {#1}
\cs_set_nopar:Npn \__zitie_aux_color_fill: { \color_fill:n {#1} }
}
} ,
fillcolor* .code:n =
{
- \zitie_color_select:nnn { zitiefillcolor } #1
+ \zitie_color_set:nnn { zitiefillcolor } #1
\cs_set_nopar:Npn \__zitie_aux_color_fill: { \color_fill:nn #1 }
} ,
dashpattern .tl_set:N = \l__zitie_dash_pattern_tl ,
@@ -283,22 +282,37 @@
debug .bool_set:N = \l__zitie_debug_bool ,
debug .initial:n = false ,
debug .default:n = true ,
+ repeat .int_set:N = \l__zitie_repeat_int ,
+ repeat .initial:n = 1 ,
+ tolerance .dim_set:N = \l__zitie_tolerance_dim ,
+ tolerance .initial:n = 1em ,
+ break .choice: ,
+ break / default .code:n = { \cs_set_eq:NN \__zitie_break: \__zitie_break_default: } ,
+ break / allowbreak .code:n = { \cs_set_eq:NN \__zitie_break: \allowbreak } ,
+ break / unknown .code:n = { \cs_set_eq:NN \__zitie_break: #1 } ,
+ break .initial:n = allowbreak ,
+ tallheight .int_set:N = \l__zitie_tallheight_int ,
+ tallheight .initial:n = 1000 ,
+
savefontname .bool_set:N = \l__zitie_savefontname_bool ,
savefontname .initial:n = false ,
savefontname .default:n = true ,
fallback .bool_set:N = \l__zitie_font_fallback_bool ,
fallback .initial:n = false ,
fallback .default:n = true ,
- fallbackfont .clist_set:N = \g__zitie_fallback_font_clist ,
+ fallbackfont .clist_set:N = \l__zitie_fallback_font_clist ,
fallbackfont .initial:n = { 宋体 } ,
- fallbackfont+ .code:n = { \clist_put_right:Nn \g__zitie_fallback_font_clist {#1} } ,
+ fallbackfont+ .code:n = { \clist_put_right:Nn \l__zitie_fallback_font_clist {#1} } ,
+ validateglyph .bool_set:N = \l__zitie_validate_glyph_bool ,
+ validateglyph .initial:n = false ,
+ validateglyph .default:n = true ,
}
\hook_new_pair:nn { zitie/processor/before } { zitie/processor/after }
\cs_new:Npn \zitie_new_process_rule:nnn #1#2#3 % processor, id, code
{
- \cs_set:cpn { __zitie_processor_ #1 @ #2 :n } ##1
- { \hook_use:n { zitie/processor/before } #3 \hook_use:n { zitie/processor/after } }
+ \cs_set:cpn { __zitie_processor_ #1 @ #2 :n } ##1 {#3}
+ % { \hook_use:n { zitie/processor/before } #3 \hook_use:n { zitie/processor/after } }
\keys_define:nn { zitie }
{ #1/#2 .code:n = { \cs_set_eq:cc { \zitie_processor:n {#1} } { __zitie_processor_ #1 @ #2 :n } } }
}
@@ -309,8 +323,11 @@
\keys_define:nn { zitie }
{ #1/#2 .code:n = { \cs_set_eq:cc { \zitie_processor:n {#1} } { \zitie_processor:nnn {#1} {#2} {#3} } } }
}
-\NewDocumentCommand \zitienewrule { O{1} >{\TrimSpaces} m > {\TrimSpaces} m m }
+\NewDocumentCommand \zitienewprocessorrule { O{1} >{\TrimSpaces} m > {\TrimSpaces} m m }
{ \zitie_new_process_rule:nnnn {#2} {#3} {#1} {#4} }
+\cs_new_protected:Npn \zitienewrule { \zitienewprocessorrule }
+\NewDocumentCommand \zitieuseprocessorrule { O{1} m m }
+ { \zitie_processor_c:nnn {#1} {#2} {#3} }
\zitie_new_process_rule:nnn { punctuation } { onlast }
{ \tex_penalty:D 10000\smash{ \makebox[0pt]{ \color_select:n { zitiecharcolor } \zitieCJKfamily{\zitiefontname} #1 } } }
\zitie_new_process_rule:nnn { punctuation } { scale }
@@ -326,6 +343,37 @@
{ \zitie_stroke_chars:nn { 2 ~ Tr ~ 0.25 ~ w ~ [] ~ 0 ~ d ~ 1 ~ J ~ 1 ~ 1 ~ 1 ~ rg } {#1} }
\zitie_new_process_rule:nnn { charstroke } { whitedashed }
{ \zitie_stroke_chars:nn { 2 ~ Tr ~ 0.25 ~ w ~ [.8] ~ 0 ~ d ~ 1 ~ J ~ 1 ~ 1 ~ 1 ~ rg } {#1} }
+\zitie_new_process_rule:nnn { charstroke } { thicksolid }
+ { \zitie_stroke_chars:nn { 1 ~ Tr ~ 0.15 ~ w ~ [] ~ 0 ~ d ~ 1 ~ J } {#1} }
+\zitie_new_process_rule:nnn { charstroke } { thickdashed }
+ { \zitie_stroke_chars:nn { 1 ~ Tr ~ 0.15 ~ w ~ [.8] ~ 0 ~ d ~ 1 ~ J } {#1} }
+\zitie_new_process_rule:nnn { charstroke } { thickwhitesolid }
+ { \zitie_stroke_chars:nn { 2 ~ Tr ~ 0.15 ~ w ~ [] ~ 0 ~ d ~ 1 ~ J ~ 1 ~ 1 ~ 1 ~ rg } {#1} }
+\zitie_new_process_rule:nnn { charstroke } { thickwhitedashed }
+ { \zitie_stroke_chars:nn { 2 ~ Tr ~ 0.15 ~ w ~ [.8] ~ 0 ~ d ~ 1 ~ J ~ 1 ~ 1 ~ 1 ~ rg } {#1} }
+\zitie_new_process_rule:nnn { charstroke } { invisible }
+ { \zitie_stroke_chars:nn { 3 ~ Tr } {#1} }
+%% position processor need new first
+\cs_new:cpn { \zitie_processor:n { position } } #1
+ { \coffin_typeset:Nnnnn #1 { l } { b } { 0pt } { 0pt } }
+\zitie_new_process_rule:nnn { position } { anchor-center }
+ { \coffin_typeset:Nnnnn #1 { hc } { vc } { 0pt } { 0pt } }
+\zitie_new_process_rule:nnn { position } { anchor-east }
+ { \coffin_typeset:Nnnnn #1 { r } { vc } { 0pt } { 0pt } }
+\zitie_new_process_rule:nnn { position } { anchor-southeast }
+ { \coffin_typeset:Nnnnn #1 { r } { b } { 0pt } { 0pt } }
+\zitie_new_process_rule:nnn { position } { anchor-south }
+ { \coffin_typeset:Nnnnn #1 { hc } { b } { 0pt } { 0pt } }
+\zitie_new_process_rule:nnn { position } { anchor-southwest }
+ { \coffin_typeset:Nnnnn #1 { l } { b } { 0pt } { 0pt } }
+\zitie_new_process_rule:nnn { position } { anchor-west }
+ { \coffin_typeset:Nnnnn #1 { l } { vc } { 0pt } { 0pt } }
+\zitie_new_process_rule:nnn { position } { anchor-northwest }
+ { \coffin_typeset:Nnnnn #1 { l } { t } { 0pt } { 0pt } }
+\zitie_new_process_rule:nnn { position } { anchor-north }
+ { \coffin_typeset:Nnnnn #1 { hc } { t } { 0pt } { 0pt } }
+\zitie_new_process_rule:nnn { position } { anchor-northeast }
+ { \coffin_typeset:Nnnnn #1 { r } { t } { 0pt } { 0pt } }
\cs_new:Npn \__zitie_new_font_family:nn #1#2 { \__zitie_new_font_family:nnn {#1} {#2} { } }
@@ -367,6 +415,8 @@
\clist_put_right:Nn \g__zitie_resize_method_clist {#1}
\cs_new:cpn { \__zitie_resize:n {#1} }
}
+\cs_new:Npn \zitie_resize_method_set_eq:nn #1#2
+ { \cs_set_eq:cc { \__zitie_resize:n {#1} } { \__zitie_resize:n {#2} } }
\zitie_new_resize_method:nn { none } { }
\cs_new:Npn \zitie_new_frame_construct:nn #1
{
@@ -374,12 +424,12 @@
\cs_new:cn { \zitie_frame_type:n {#1} }
}
\zitie_new_frame_construct:nn { none } { }
+\cs_new:Npn \zitie_frame_type_set_eq:nn #1#2
+ { \cs_set_eq:cc { \zitie_frame_type:n {#1} } { \zitie_frame_type:n {#2} } }
\zitie_font_if_exist:nT { SimSun } { \zitie_new_font:n { {宋体}{SimSun} } }
\keys_set:nn { zitie }
{
- basechar = 好 ,
- zihao = 4 ,
frametype = none ,
resize = none ,
}
@@ -388,16 +438,66 @@
\cs_new:Npn \zitie_single_construct:nN #1#2
{
\group_begin:
+ \__zitie_calc_basechar_w_h:
\tl_if_empty:nF {#1} { \keys_set:nn { zitie } {#1} }
\tl_set:Nf \l__zitie_curr_char_tl {#2}
- \__zitie_single_construct_o:N \l__zitie_curr_char_tl
+ \hcoffin_set:Nn \l__zitie_box_coffin
+ { \__zitie_single_construct_o:N \l__zitie_curr_char_tl }
+ \zitie_processor_c:n { position } \l__zitie_box_coffin
\group_end:
}
+\cs_new_protected:Npn \zitie_single_construct_f:nN
+ { \exp_args:Nnf \zitie_single_construct:nN }
\cs_new:Npn \zitie_single_construct:N #1
{
\group_begin:
+ \__zitie_calc_basechar_w_h:
\tl_set:Nf \l__zitie_curr_char_tl {#1}
- \__zitie_single_construct_o:N \l__zitie_curr_char_tl
+ \hcoffin_gset:Nn \l__zitie_box_coffin
+ { \__zitie_single_construct_o:N \l__zitie_curr_char_tl }
+ \zitie_processor_c:n { position } \l__zitie_box_coffin
+ \group_end:
+ }
+\cs_new_protected:Npn \zitie_single_construct_f:N
+ { \exp_args:Nf \zitie_single_construct:N }
+\bool_new:N \g__zitie_glyph_exist_bool
+\cs_new:Npn \zitie_single_validate_glyph_construct:nN #1#2
+ {
+ \group_begin:
+ \tl_if_empty:nF {#1} { \keys_set:nn { zitie } {#1} }
+ {
+ \zitieCJKfamily+ { \l__zitie_font_tl }
+ \exp_after:wN \zitie_glyph_if_exist:NTF #2
+ { \bool_gset_true:N \g__zitie_glyph_exist_bool }
+ { \bool_gset_false:N \g__zitie_glyph_exist_bool }
+ }
+ \bool_if:NT \g__zitie_glyph_exist_bool
+ {
+ \__zitie_calc_basechar_w_h:
+ \tl_set:Nf \l__zitie_curr_char_tl {#2}
+ \hcoffin_set:Nn \l__zitie_box_coffin
+ { \__zitie_single_construct_o:N \l__zitie_curr_char_tl }
+ \zitie_processor_c:n { position } \l__zitie_box_coffin
+ }
+ \group_end:
+ }
+\cs_new:Npn \zitie_single_validate_glyph_construct:N #1
+ {
+ \group_begin:
+ {
+ \zitieCJKfamily+ { \l__zitie_font_tl }
+ \exp_after:wN \zitie_glyph_if_exist:NTF #1
+ { \bool_gset_true:N \g__zitie_glyph_exist_bool }
+ { \bool_gset_false:N \g__zitie_glyph_exist_bool }
+ }
+ \bool_if:NT \g__zitie_glyph_exist_bool
+ {
+ \__zitie_calc_basechar_w_h:
+ \tl_set:Nf \l__zitie_curr_char_tl {#1}
+ \hcoffin_gset:Nn \l__zitie_box_coffin
+ { \__zitie_single_construct_o:N \l__zitie_curr_char_tl }
+ \zitie_processor_c:n { position } \l__zitie_box_coffin
+ }
\group_end:
}
\cs_new:Npn \__zitie_single_construct:N #1
@@ -405,19 +505,29 @@
\zitie_token_if_punctuation_f:NTF #1
{ \zitie_processor_c:n { punctuation } {#1} }
{
- \hcoffin_set:Nn \l__zitie_box_coffin
+ \hcoffin_set:Nn \l__zitie_tmpb_coffin
{
+ \bool_if:NT \l__zitie_holdbasechar_height_bool { \vphantom \zitiebasechar }
\color_select:n { zitiecharcolor }
- \zitie_processor_c:n { charstroke }
- { \zitie_cjk_glyph_use:nN { \l__zitie_font_tl } \l__zitie_curr_char_tl }
+ \bool_if:NTF \l__zitie_holdbasechar_width_bool
+ {
+ \makebox [ \dim_use:N \zitiebasecharwidth ] [c] {
+ \zitie_processor_c:n { charstroke }
+ { \zitie_cjk_glyph_use:nN { \l__zitie_font_tl } \l__zitie_curr_char_tl }
+ }
+ }
+ {
+ \zitie_processor_c:n { charstroke }
+ { \zitie_cjk_glyph_use:nN { \l__zitie_font_tl } \l__zitie_curr_char_tl }
+ }
}
- \tl_set:Nx \zitiexscaleratio { \dim_to_decimal:n { \coffin_wd:N \l__zitie_box_coffin} }
- \tl_set:Nx \zitieyscaleratio { \dim_to_decimal:n { \__zitie_coffin_ht_plus_dp:N \l__zitie_box_coffin } }
+ \tl_set:Nx \zitiexscaleratio { \dim_to_decimal:n { \coffin_wd:N \l__zitie_tmpb_coffin} }
+ \tl_set:Nx \zitieyscaleratio { \dim_to_decimal:n { \__zitie_coffin_ht_plus_dp:N \l__zitie_tmpb_coffin } }
\__zitie_resize_c:n { \l_zitie_resize_method_tl }
- \dim_gset:Nn \zitiewidth { \coffin_wd:N \l__zitie_box_coffin }
+ \dim_gset:Nn \zitiewidth { \coffin_wd:N \l__zitie_tmpb_coffin }
\dim_gset_eq:NN \zitieboxwd \zitiewidth
- \dim_gset:Nn \zitieboxht { \coffin_ht:N \l__zitie_box_coffin }
- \dim_gset:Nn \zitieboxdp { \coffin_dp:N \l__zitie_box_coffin }
+ \dim_gset:Nn \zitieboxht { \coffin_ht:N \l__zitie_tmpb_coffin }
+ \dim_gset:Nn \zitieboxdp { \coffin_dp:N \l__zitie_tmpb_coffin }
\dim_gset:Nn \zitieheight { \zitieboxht + \zitieboxdp }
\tl_gset:Nx \zitiexscaleratio { \fp_eval:n { \dim_to_fp:n { \zitiewidth } / \zitiexscaleratio } }
\tl_gset:Nx \zitieyscaleratio { \fp_eval:n { \dim_to_fp:n { \zitieheight } / \zitieyscaleratio } }
@@ -457,54 +567,54 @@
\zitie_new_resize_method:nn { real }
{
\__zitie_force_size_dispatch:nnnn
- { \coffin_resize:Nnn \l__zitie_box_coffin \l__zitie_box_width_dim \l__zitie_box_height_dim }
+ { \coffin_resize:Nnn \l__zitie_tmpb_coffin \l__zitie_box_width_dim \l__zitie_box_height_dim }
{
- \coffin_scale:Nnn \l__zitie_box_coffin
- { \dim_ratio:nn { \l__zitie_box_height_dim } { \__zitie_coffin_ht_plus_dp:N \l__zitie_box_coffin } }
- { \dim_ratio:nn { \l__zitie_box_height_dim } { \__zitie_coffin_ht_plus_dp:N \l__zitie_box_coffin } }
+ \coffin_scale:Nnn \l__zitie_tmpb_coffin
+ { \dim_ratio:nn { \l__zitie_box_height_dim } { \__zitie_coffin_ht_plus_dp:N \l__zitie_tmpb_coffin } }
+ { \dim_ratio:nn { \l__zitie_box_height_dim } { \__zitie_coffin_ht_plus_dp:N \l__zitie_tmpb_coffin } }
}
{
- \coffin_scale:Nnn \l__zitie_box_coffin
- { \dim_ratio:nn { \l__zitie_box_width_dim } { \coffin_wd:N \l__zitie_box_coffin } }
- { \dim_ratio:nn { \l__zitie_box_width_dim } { \coffin_wd:N \l__zitie_box_coffin } }
+ \coffin_scale:Nnn \l__zitie_tmpb_coffin
+ { \dim_ratio:nn { \l__zitie_box_width_dim } { \coffin_wd:N \l__zitie_tmpb_coffin } }
+ { \dim_ratio:nn { \l__zitie_box_width_dim } { \coffin_wd:N \l__zitie_tmpb_coffin } }
}
- { \coffin_scale:Nnn \l__zitie_box_coffin { \l__zitie_x_scale_tl } { \l__zitie_y_scale_tl } }
+ { \coffin_scale:Nnn \l__zitie_tmpb_coffin { \l__zitie_x_scale_tl } { \l__zitie_y_scale_tl } }
}
\zitie_new_resize_method:nn { base }
{
\__zitie_force_size_dispatch:nnnn
- { \coffin_resize:Nnn \l__zitie_box_coffin \l__zitie_box_width_dim \l__zitie_box_height_dim }
+ { \coffin_resize:Nnn \l__zitie_tmpb_coffin \l__zitie_box_width_dim \l__zitie_box_height_dim }
{
- \coffin_resize:Nnn \l__zitie_box_coffin
- { \l__zitie_char_width_dim * \dim_ratio:nn { \l__zitie_box_height_dim } { \__zitie_coffin_ht_plus_dp:N \l__zitie_box_coffin } }
+ \coffin_resize:Nnn \l__zitie_tmpb_coffin
+ { \zitiebasecharwidth * \dim_ratio:nn { \l__zitie_box_height_dim } { \__zitie_coffin_ht_plus_dp:N \l__zitie_tmpb_coffin } }
{ \l__zitie_box_height_dim }
}
{
- \coffin_resize:Nnn \l__zitie_box_coffin
+ \coffin_resize:Nnn \l__zitie_tmpb_coffin
{ \l__zitie_box_width_dim }
- { \l__zitie_char_height_dim * \dim_ratio:nn { \l__zitie_box_width_dim } { \coffin_wd:N \l__zitie_box_coffin } }
+ { \zitiebasecharheight * \dim_ratio:nn { \l__zitie_box_width_dim } { \coffin_wd:N \l__zitie_tmpb_coffin } }
}
{
- \coffin_resize:Nnn \l__zitie_box_coffin
- { \l__zitie_x_scale_tl \l__zitie_char_width_dim }
- { \l__zitie_y_scale_tl \l__zitie_char_height_dim }
+ \coffin_resize:Nnn \l__zitie_tmpb_coffin
+ { \l__zitie_x_scale_tl \zitiebasecharwidth }
+ { \l__zitie_y_scale_tl \zitiebasecharheight }
}
}
\zitie_new_resize_method:nn { square }
{
- \hcoffin_set:Nn \l__zitie_tmpa_coffin { \phantom { \c_zitie_basechar_tl } }
- \dim_set:Nn \zitiewidth { \coffin_wd:N \l__zitie_box_coffin }
- \dim_set:Nn \zitieheight { \__zitie_coffin_ht_plus_dp:N \l__zitie_box_coffin }
+ \hcoffin_set:Nn \l__zitie_tmpa_coffin { \phantom { \zitiebasechar } }
+ \dim_set:Nn \zitiewidth { \coffin_wd:N \l__zitie_tmpb_coffin }
+ \dim_set:Nn \zitieheight { \__zitie_coffin_ht_plus_dp:N \l__zitie_tmpb_coffin }
\__zitie_resize_method_square_aux:
\tl_set:Nx \zitiexscaleratio { \dim_to_decimal:n \zitiewidth }
\tl_set_eq:NN \zitieyscaleratio \zitiexscaleratio
\__zitie_force_size_dispatch:nnnn
- { \coffin_resize:Nnn \l__zitie_box_coffin \l__zitie_box_width_dim \l__zitie_box_height_dim }
- { \coffin_resize:Nnn \l__zitie_box_coffin \l__zitie_box_height_dim \l__zitie_box_height_dim }
- { \coffin_resize:Nnn \l__zitie_box_coffin \l__zitie_box_width_dim \l__zitie_box_width_dim }
- { \coffin_scale:Nnn \l__zitie_box_coffin \l__zitie_x_scale_tl \l__zitie_y_scale_tl }
+ { \coffin_resize:Nnn \l__zitie_tmpb_coffin \l__zitie_box_width_dim \l__zitie_box_height_dim }
+ { \coffin_resize:Nnn \l__zitie_tmpb_coffin \l__zitie_box_height_dim \l__zitie_box_height_dim }
+ { \coffin_resize:Nnn \l__zitie_tmpb_coffin \l__zitie_box_width_dim \l__zitie_box_width_dim }
+ { \coffin_scale:Nnn \l__zitie_tmpb_coffin \l__zitie_x_scale_tl \l__zitie_y_scale_tl }
}
\cs_new:Npn \__zitie_resize_method_square_aux:
{
@@ -512,15 +622,15 @@
\coffin_resize:Nnn \l__zitie_tmpa_coffin
{ ( \zitieheight - \zitiewidth ) / 2 }
{ \zitieheight }
- \coffin_join:NnnNnnnn \l__zitie_box_coffin { r } { vc } \l__zitie_tmpa_coffin { l } { vc } { 0pt } { 0pt }
- \coffin_join:NnnNnnnn \l__zitie_box_coffin { l } { vc } \l__zitie_tmpa_coffin { r } { vc } { 0pt } { 0pt }
+ \coffin_join:NnnNnnnn \l__zitie_tmpb_coffin { r } { vc } \l__zitie_tmpa_coffin { l } { vc } { 0pt } { 0pt }
+ \coffin_join:NnnNnnnn \l__zitie_tmpb_coffin { l } { vc } \l__zitie_tmpa_coffin { r } { vc } { 0pt } { 0pt }
\dim_set_eq:NN \zitiewidth \zitieheight
\else: \if_dim:w \zitiewidth > \zitieheight
\coffin_resize:Nnn \l__zitie_tmpa_coffin
{ \zitiewidth }
{ ( \zitiewidth - \zitieheight ) / 2 }
- \coffin_join:NnnNnnnn \l__zitie_box_coffin { hc } { t } \l__zitie_tmpa_coffin { hc } { b } { 0pt } { 0pt }
- \coffin_join:NnnNnnnn \l__zitie_box_coffin { hc } { b } \l__zitie_tmpa_coffin { hc } { t } { 0pt } { 0pt }
+ \coffin_join:NnnNnnnn \l__zitie_tmpb_coffin { hc } { t } \l__zitie_tmpa_coffin { hc } { b } { 0pt } { 0pt }
+ \coffin_join:NnnNnnnn \l__zitie_tmpb_coffin { hc } { b } \l__zitie_tmpa_coffin { hc } { t } { 0pt } { 0pt }
\dim_set_eq:NN \zitieheight \zitiewidth
\fi: \fi:
}
@@ -530,25 +640,28 @@
{
\draw_begin:
\draw_linewidth:n { \l__zitie_linewidth_dim }
- \__zitie_aux_color_fill:
\color_stroke:n { zitieframecolor }
\tl_if_empty:NF \l__zitie_dash_pattern_tl { \exp_args:No \draw_dash_pattern:nn { \l__zitie_dash_pattern_tl } { 0pt } }
\exp_after:wN \draw_path_corner_arc:nn \l__zitie_frame_arc_tl
+ \cs_if_eq:NNF \__zitie_aux_color_fill: \c_empty_tl
+ {
+ \__zitie_aux_color_fill:
+ \draw_path_rectangle_corners:nn { 0 , 0 } { \zitiewidth , \zitieheight }
+ \draw_path_use_clear:n { fill }
+ }
\zitie_frame_type_c:n { \l_zitie_frame_type_tl } { 0 } { 0 } { \zitiewidth } { \zitieheight } { 1 } { 1 }
- \draw_coffin_use:Nnn \l__zitie_box_coffin { l } { b }
+ \draw_coffin_use:Nnn \l__zitie_tmpb_coffin { l } { b }
\draw_end:
}
\zitie_new_frame_construct:nn { 口 }
{
\draw_path_rectangle_corners:nn { #1 , #2 } { #3 , #4 }
- \cs_if_eq:NNTF \__zitie_aux_color_fill: \c_empty_tl
- { \draw_path_use_clear:n { stroke } }
- { \draw_path_use_clear:n { stroke , fill } }
+ \draw_path_use_clear:n { stroke , clip }
}
\zitie_new_frame_construct:nn { 十 }
{
\draw_path_moveto:n { (#3)/2 , #2 }
- \draw_path_lineto:n { #3/2 , #4 }
+ \draw_path_lineto:n { (#3)/2 , #4 }
\draw_path_moveto:n { #1 , (#4)/2 }
\draw_path_lineto:n { #3 , (#4)/2 }
\draw_path_use_clear:n { stroke }
@@ -578,19 +691,68 @@
\zitie_frame_type_c:n { 十 } {#1} {#2} {#3} {#4} {#5} {#6}
}
+\cs_new:Npn \zitie_repeat:Nnn #1#2#3 % repeat, code, mid
+ {
+ \if_int_compare:w #1 = 1 \exp_stop_f: #2
+ \else:
+ \if_int_compare:w #1 > 1 \exp_stop_f:
+ #2 #3 \int_decr:N #1
+ \zitie_repeat:Nnn {#1} {#2} {#3}
+ \fi:
+ \fi:
+ }
+
\NewDocumentCommand \zitienewfont { s } { \IfBooleanTF {#1} { \zitie_new_font:nnn } { \zitie_new_font:n } }
+\hook_new:n { zitie/repeat }
+\hook_new_pair:nn { zitie/framesingle/before } { zitie/framesingle/after }
+\NewDocumentCommand \framesingle { O{} m }
+ {
+ \group_begin:
+ \keys_set_filter:nnn { zitie } { geometry } {#1}
+ \hook_use:n { zitie/framesingle/before }
+ \bool_if:NTF \l__zitie_savefontname_bool
+ { \tl_gset_eq:NN \zitiefontname \l__zitie_font_tl }
+ { \tl_gset_eq:NN \zitiefontname \c_empty_tl }
+ \bool_if:NTF \l__zitie_validate_glyph_bool
+ {
+ \zitieCJKfamily+ { \l__zitie_font_tl }
+ \exp_args:Nf \zitie_glyph_if_exist:NT #2
+ {
+ \zitie_repeat:Nnn \l__zitie_repeat_int
+ { \zitie_single_construct_f:N #2 }
+ { \hook_use:n { zitie/repeat } }
+ }
+ }
+ {
+ \zitie_repeat:Nnn \l__zitie_repeat_int
+ { \zitie_single_construct_f:N #2 }
+ { \hook_use:n { zitie/repeat } }
+ }
+ \hook_use:n { zitie/framesingle/after }
+ \group_end:
+ }
\hook_new_pair:nn { zitie/framezi/before } { zitie/framezi/after }
\NewDocumentCommand \framezi { s O{} m }
{
\group_begin:
\tl_if_empty:nF {#2} { \keys_set_filter:nnn { zitie } { geometry } {#2} }
+ \tex_pretolerance:D = 10000
+ \__zitie_break_max_calc:
\hook_use:n { zitie/framezi/before }
\bool_if:NTF \l__zitie_savefontname_bool
{ \tl_gset_eq:NN \zitiefontname \l__zitie_font_tl }
{ \tl_gset_eq:NN \zitiefontname \c_empty_tl }
\IfBooleanTF {#1}
- { \tl_map_inline:Nn #3 { \zitie_single_construct:N ##1 \allowbreak } }
- { \tl_map_inline:nn {#3} { \zitie_single_construct:N ##1 \allowbreak } }
+ {
+ \zitie_repeat:Nnn \l__zitie_repeat_int
+ { \tl_map_inline:Nn #3 { \zitie_single_construct:N ##1 \__zitie_break: } }
+ { \hook_use:n { zitie/repeat } }
+ }
+ {
+ \zitie_repeat:Nnn \l__zitie_repeat_int
+ { \tl_map_inline:nn {#3} { \zitie_single_construct:N ##1 \__zitie_break: } }
+ { \hook_use:n { zitie/repeat } }
+ }
\hook_use:n { zitie/framezi/after }
\group_end:
}
@@ -600,36 +762,100 @@
{
\group_begin:
\tl_if_empty:nF {#1} { \keys_set_filter:nnn { zitie } { geometry } {#1} }
+ \tex_pretolerance:D = 10000
+ \__zitie_break_max_calc:
\hook_use:n { zitie/framerange/before }
\bool_if:NTF \l__zitie_savefontname_bool
{ \tl_gset_eq:NN \zitiefontname \l__zitie_font_tl }
{ \tl_gset_eq:NN \zitiefontname \c_empty_tl }
- \clist_map_inline:nn {#2}
+ \zitie_repeat:Nnn \l__zitie_repeat_int
{
- \str_if_eq:nnF {##1} { -> }
- {
- \__zitie_frame_range_aux:Nnw \__zitie_check_num_range:nnNN {##1}
- \l__zitie_begin_int \l__zitie_end_int
- \__zitie_int_until_do:nn { \l__zitie_begin_int > \l__zitie_end_int }
- {
- \group_begin:
- \tl_set:Nf \l__zitie_curr_char_tl { \tex_Uchar:D \l__zitie_begin_int }
- \__zitie_single_construct_o:N \l__zitie_curr_char_tl
- \group_end: \allowbreak
- \int_incr:N \l__zitie_begin_int
- }
+ \clist_map_inline:nn {#2}
+ {
+ \str_if_eq:nnF {##1} { -> }
+ {
+ \__zitie_frame_range_aux:Nnw \__zitie_check_num_range:nnNN {##1}
+ \l__zitie_begin_int \l__zitie_end_int
+ \__zitie_int_until_do:nn { \l__zitie_begin_int > \l__zitie_end_int }
+ {
+ \group_begin:
+ \tl_set:Nf \l__zitie_curr_char_tl { \tex_Uchar:D \l__zitie_begin_int }
+ \zitie_single_construct_f:N \l__zitie_curr_char_tl
+ \group_end: \__zitie_break:
+ \int_incr:N \l__zitie_begin_int
+ }
+ }
+ \hook_use:n { zitie/framerange/range }
}
- \hook_use:n { zitie/framerange/range }
}
+ { \hook_use:n { zitie/repeat } }
\hook_use:n { zitie/framerange/after }
\group_end:
}
\NewDocumentCommand \__zitie_frame_range_aux:Nnw { m >{ \SplitArgument { 1 } { -> } } m } { #1 #2 }
+\hook_new_pair:nn { zitie/frametallrange/before } { zitie/frametallrange/after }
+\hook_new:n { zitie/frametallrange/range }
+\int_new:N \l__zitie_tall_tmp_int
+\NewDocumentCommand \frametallrange { O{} m }
+ {
+ \group_begin:
+ \tl_if_empty:nF {#1} { \keys_set_filter:nnn { zitie } { geometry } {#1} }
+ \tex_pretolerance:D = 10000
+ \__zitie_break_max_calc:
+ \hook_use:n { zitie/frametallrange/before }
+ \bool_if:NTF \l__zitie_savefontname_bool
+ { \tl_gset_eq:NN \zitiefontname \l__zitie_font_tl }
+ { \tl_gset_eq:NN \zitiefontname \c_empty_tl }
+ \int_decr:N \l__zitie_tallheight_int
+ \zitie_repeat:Nnn \l__zitie_repeat_int
+ {
+ \clist_map_inline:nn {#2}
+ {
+ \str_if_eq:nnF {##1} { -> }
+ {
+ \__zitie_frame_range_aux:Nnw \__zitie_check_num_range:nnNN {##1}
+ \l__zitie_begin_int \l__zitie_end_int
+ \__zitie_split_range:nnnNn \l__zitie_begin_int \l__zitie_end_int { \l__zitie_tallheight_int }
+ \__zitie_tallrange_split_do:nn
+ { \__zitie_tall_par: }
+ }
+ \hook_use:n { zitie/frametallrange/range }
+ }
+ }
+ { \hook_use:n { zitie/repeat } }
+ \hook_use:n { zitie/frametallrange/after }
+ \group_end:
+ }
+\cs_new:Npn \__zitie_tallrange_split_do:nn #1#2
+ {
+ \int_set:Nn \l__zitie_tall_tmp_int {#1}
+ \int_until_do:nn { \l__zitie_tall_tmp_int > #2 }
+ {
+ \group_begin:
+ \tl_set:Nf \l__zitie_curr_char_tl { \tex_Uchar:D \l__zitie_tall_tmp_int }
+ \zitie_single_construct_f:N \l__zitie_curr_char_tl
+ \group_end: \__zitie_break:
+ \int_incr:N \l__zitie_tall_tmp_int
+ }
+ }
+\cs_new:Npn \__zitie_split_range:nnnNn #1#2#3#4#5
+ {
+ \int_set:Nn \l__zitie_begin_int {#1}
+ \int_compare:nNnTF { \l__zitie_begin_int + #3 } > {#2}
+ { #4 { \l__zitie_begin_int } {#2} #5 }
+ {
+ #4 { \l__zitie_begin_int } { \l__zitie_begin_int + #3 }
+ #5
+ \__zitie_split_range:nnnNn { \l__zitie_begin_int + #3 + 1 } {#2} {#3} #4 {#5}
+ }
+ }
+\cs_new:Npn \__zitie_tall_par: % TeXbook 14.15
+ { {\parfillskip=0pt\par\parskip=0pt\noindent} }
\cs_new:Npn \__zitie_construct_loop:N #1
{
\tl_if_eq:nnTF #1 \par { \par \hook_use:n { zitie/zitieframe/par } \__zitie_construct_loop:N }
- { \quark_if_nil:nF {#1} { \zitie_single_construct:N #1 \allowbreak \__zitie_construct_loop:N } }
+ { \quark_if_nil:nF {#1} { \zitie_single_construct:N #1 \__zitie_break: \__zitie_construct_loop:N } }
}
\hook_new_pair:nn { zitie/zitieframe/before } { zitie/zitieframe/after }
\hook_new:n { zitie/zitieframe/par }
@@ -638,12 +864,16 @@
\group_begin:
\lineskip=0pt \parindent=0pt \parskip=0pt \raggedright
\tl_if_empty:nF {#2} { \keys_set:nn { zitie } {#2} }
+ \tex_pretolerance:D = 10000
+ \__zitie_break_max_calc:
\hook_use:n { zitie/zitieframe/before }
#1
\bool_if:NTF \l__zitie_savefontname_bool
{ \tl_gset_eq:NN \zitiefontname \l__zitie_font_tl }
{ \tl_gset_eq:NN \zitiefontname \c_empty_tl }
- \__zitie_construct_loop:N #3 \q_nil
+ \zitie_repeat:Nnn \l__zitie_repeat_int
+ { \__zitie_construct_loop:N #3 \q_nil }
+ { \hook_use:n { zitie/repeat } }
} { \hook_use:n { zitie/zitieframe/after } \group_end: }
\hook_new_pair:nn { zitie/framezifile/before } { zitie/framezifile/after }
@@ -651,6 +881,8 @@
{
\group_begin:
\tl_if_empty:nF {#2} { \keys_set_filter:nnn { zitie } { geometry } {#2} }
+ \tex_pretolerance:D = 10000
+ \__zitie_break_max_calc:
\hook_use:n { zitie/framezifile/before }
\bool_if:NTF \l__zitie_savefontname_bool
{ \tl_gset_eq:NN \zitiefontname \l__zitie_font_tl }
@@ -658,17 +890,85 @@
\IfBooleanTF {#1}
{
\file_get:nnN {#3} { } \l__zitie_file_chars_tl
- \tl_map_inline:Nn \l__zitie_file_chars_tl { \zitie_single_construct:N ##1 \allowbreak }
+ \zitie_repeat:Nnn \l__zitie_repeat_int
+ { \tl_map_inline:Nn \l__zitie_file_chars_tl { \zitie_single_construct:N ##1 \__zitie_break: } }
+ { \hook_use:n { zitie/repeat } }
}
{
\ior_open:Nn \g__zitie_file_read_ior {#3}
- \ior_map_inline:Nn \g__zitie_file_read_ior
- { \tl_map_inline:nn {##1} { \zitie_single_construct:N ####1 \allowbreak } }
+ \zitie_repeat:Nnn \l__zitie_repeat_int
+ {
+ \ior_map_inline:Nn \g__zitie_file_read_ior
+ { \tl_map_inline:nn {##1} { \zitie_single_construct:N ####1 \__zitie_break: } }
+ }
+ { \hook_use:n { zitie/repeat } }
\ior_close:N \g__zitie_file_read_ior
}
\hook_use:n { zitie/framezifile/after }
\group_end:
}
+\hook_new_pair:nn { zitie/framezitallfile/before } { zitie/framezitallfile/after }
+\NewDocumentCommand \framezitallfile { s O{} m }
+ {
+ \group_begin:
+ \tl_if_empty:nF {#2} { \keys_set_filter:nnn { zitie } { geometry } {#2} }
+ \tex_pretolerance:D = 10000
+ \__zitie_break_max_calc:
+ \hook_use:n { zitie/framezitallfile/before }
+ \bool_if:NTF \l__zitie_savefontname_bool
+ { \tl_gset_eq:NN \zitiefontname \l__zitie_font_tl }
+ { \tl_gset_eq:NN \zitiefontname \c_empty_tl }
+ \int_decr:N \l__zitie_tallheight_int
+ \IfBooleanTF {#1}
+ {
+ \file_get:nnN {#3} { } \l__zitie_file_chars_tl
+ \zitie_repeat:Nnn \l__zitie_repeat_int
+ { \__zitie_tallfile_get_aux:N \l__zitie_file_chars_tl }
+ { \hook_use:n { zitie/repeat } }
+ }
+ {
+ \ior_open:Nn \g__zitie_file_read_ior {#3}
+ \zitie_repeat:Nnn \l__zitie_repeat_int
+ { \__zitie_tallfile_ior_aux:N \g__zitie_file_read_ior }
+ { \hook_use:n { zitie/repeat } }
+ \ior_close:N \g__zitie_file_read_ior
+ }
+ \hook_use:n { zitie/framezitallfile/after }
+ \group_end:
+ }
+\cs_new:Npn \__zitie_tallfile_get_aux:N #1
+ {
+ \int_zero:N \l__zitie_tall_tmp_int
+ \tl_map_inline:Nn #1
+ {
+ \zitie_single_construct:N ##1
+ \if_int_compare:w \l__zitie_tall_tmp_int < \l__zitie_tallheight_int
+ \int_incr:N \l__zitie_tall_tmp_int
+ \__zitie_break:
+ \else:
+ \int_zero:N \l__zitie_tall_tmp_int
+ \__zitie_tall_par:
+ \fi:
+ }
+ }
+\cs_new:Npn \__zitie_tallfile_ior_aux:N #1
+ {
+ \int_zero:N \l__zitie_tall_tmp_int
+ \ior_map_inline:Nn #1
+ {
+ \tl_map_inline:nn {##1}
+ {
+ \zitie_single_construct:N ####1
+ \if_int_compare:w \l__zitie_tall_tmp_int < \l__zitie_tallheight_int
+ \int_incr:N \l__zitie_tall_tmp_int
+ \__zitie_break:
+ \else:
+ \int_zero:N \l__zitie_tall_tmp_int
+ \__zitie_tall_par:
+ \fi:
+ }
+ }
+ }
\if_bool:N \g__zitie_enable_background_bool
@@ -774,23 +1074,23 @@
} ,
frametype .tl_gset:N = \g__zitie_background_frametype_tl ,
linewidth .dim_gset:N = \g__zitie_background_linewidth_dim ,
- framecolor .code:n = { \zitie_color_select:nn { zitiebackgroundframecolor } {#1} } ,
- framecolor* .code:n = { \zitie_color_select:nnn { zitiebackgroundframecolor } #1 } ,
+ framecolor .code:n = { \zitie_color_set:nn { zitiebackgroundframecolor } {#1} } ,
+ framecolor* .code:n = { \zitie_color_set:nnn { zitiebackgroundframecolor } #1 } ,
fillcolor .code:n =
{
\exp_args:Nx \tl_if_empty:nTF {#1}
{
- \zitie_color_select:nn { zitiebackgroundfillcolor } { white }
+ \zitie_color_set:nn { zitiebackgroundfillcolor } { white }
\cs_gset_nopar:Npn \__zitie_background_aux_color_fill: { }
}
{
- \zitie_color_select:nn { zitiebackgroundfillcolor } {#1}
+ \zitie_color_set:nn { zitiebackgroundfillcolor } {#1}
\cs_gset_nopar:Npn \__zitie_background_aux_color_fill: { \color_fill:n {#1} }
}
} ,
fillcolor* .code:n =
{
- \zitie_color_select:nnn { zitiebackgroundfillcolor } #1
+ \zitie_color_set:nnn { zitiebackgroundfillcolor } #1
\cs_gset_nopar:Npn \__zitie_background_aux_color_fill: { \color_fill:nn #1 }
} ,
dashpattern .tl_gset:N = \g__zitie_background_dash_pattern_tl ,
@@ -849,10 +1149,10 @@
\hook_gput_code:nnn { shipout/#1 } { zitie/background }
{ \put ( \dim_eval:n {#2} , \dim_eval:n {#3} ) { \__zitie_background_construct_draw: } }
}
-\cs_new_protected:Npn \__zitie_background_construct:nnnn #1#2#3#4
+\cs_new_protected:Npn \__zitie_background_construct:nnnnn #1#2#3#4#5
{
\hook_gput_code:nnn { shipout/#1 } { zitie/background/#2 }
- { \put ( \dim_eval:n {#3} , \dim_eval:n {#4} ) { \__zitie_background_construct_draw: } }
+ { \put ( \dim_eval:n {#3} , \dim_eval:n {#4} ) {#5} }
}
\cs_new_protected:Npn \__zitie_background_next_construct:nnn #1#2#3
{
@@ -871,18 +1171,29 @@
\tl_if_empty:NF \g__zitie_background_dash_pattern_tl
{ \exp_args:No \draw_dash_pattern:nn { \g__zitie_background_dash_pattern_tl } { 0pt } }
\draw_linewidth:n { \g__zitie_background_linewidth_dim }
- \__zitie_background_aux_color_fill:
+ \draw_path_rectangle_corners:nn
+ { 0cm - .5\g__zitie_background_linewidth_dim , 0cm - .5\g__zitie_background_linewidth_dim }
+ {
+ \g__zitie_background_x_right_dim - \g__zitie_background_x_left_dim + .5\g__zitie_background_linewidth_dim ,
+ \g__zitie_background_y_bottom_dim - \g__zitie_background_y_top_dim + .5\g__zitie_background_linewidth_dim
+ }
+ \cs_if_eq:NNTF \__zitie_background_aux_color_fill: \c_empty_tl
+ { \draw_path_use_clear:n { clip } }
+ { \color_fill:n { zitiebackgroundfillcolor } \draw_path_use_clear:n { clip , fill } }
\color_stroke:n { zitiebackgroundframecolor }
\zitie_background_frame_type_c:n { \g__zitie_background_frametype_tl }
- { 0cm } { 0cm }
- { \g__zitie_background_x_right_dim - \g__zitie_background_x_left_dim }
- { \g__zitie_background_y_bottom_dim - \g__zitie_background_y_top_dim }
+ { 0cm - .5\g__zitie_background_linewidth_dim }
+ { 0cm - .5\g__zitie_background_linewidth_dim }
+ { \g__zitie_background_x_right_dim - \g__zitie_background_x_left_dim + .5\g__zitie_background_linewidth_dim }
+ { \g__zitie_background_y_bottom_dim - \g__zitie_background_y_top_dim + .5\g__zitie_background_linewidth_dim }
{ \g__zitie_background_boxwidth_dim }
{ \g__zitie_background_boxheight_dim }
\draw_end:
}
\cs_new:Npn \zitie_background_new_frame_construct:nn #1
{ \cs_set:cn { \zitie_background_frame_type:n {#1} } }
+\cs_new:Npn \zitie_background_frame_type_set_eq:nn #1#2
+ { \cs_set_eq:cc { \zitie_background_frame_type:n {#1} } { \zitie_background_frame_type:n {#2} } }
\int_new:N \l__zitie_background_tmpa_int
\int_new:N \l__zitie_background_tmpb_int
\fp_new:N \l__zitie_background_tmpa_fp
@@ -890,13 +1201,7 @@
\zitie_background_new_frame_construct:nn { none } { }
\zitie_background_new_frame_construct:nn { 口 }
{
- \cs_if_eq:NNF \__zitie_background_aux_color_fill: \c_empty_tl
- {
- \draw_path_rectangle_corners:nn { #1 , #2 } { #3 , #4 }
- \draw_path_use_clear:n { stroke , fill }
- }
- \draw_path_grid:nnnn { #5 } { #6 } { #1 , #2 }
- { #3+\g__zitie_background_linewidth_dim, #4+\g__zitie_background_linewidth_dim }
+ \draw_path_grid:nnnn { #5 } { #6 } { #1 , #2 } { #3 , #4 }
\draw_path_use_clear:n { stroke }
}
\zitie_background_new_frame_construct:nn { 十 }
@@ -924,10 +1229,12 @@
\int_set:Nn \l__zitie_background_tmpb_int { \fp_to_int:n { ceil( \dim_ratio:nn {(#4)-(#2)} {#6} ) } }
\if_int_compare:w \l__zitie_background_tmpa_int < \l__zitie_background_tmpb_int
\__zitie_background_frame_construct_aux_cross:nnnnnnnn
- {#1} {#2} {#3} {#4} {#5} {#6} { \l__zitie_background_tmpb_int } { }
+ {#1+\g__zitie_background_linewidth_dim} {#2+\g__zitie_background_linewidth_dim}
+ {#3} {#4} {#5} {#6} { \l__zitie_background_tmpb_int } { }
\else:
\__zitie_background_frame_construct_aux_cross:nnnnnnnn
- {#1} {#2} {#3} {#4} {#5} {#6} { \l__zitie_background_tmpa_int } { }
+ {#1+\g__zitie_background_linewidth_dim} {#2+\g__zitie_background_linewidth_dim}
+ {#3} {#4} {#5} {#6} { \l__zitie_background_tmpa_int } { }
\fi:
\draw_path_use_clear:n { stroke }
}
@@ -936,7 +1243,7 @@
\int_step_inline:nn {#7}
{
\draw_path_moveto:n { #1 , #2 + ##1*(#6) }
- \draw_path_lineto:n { #1 + ##1*#5 , #2 }
+ \draw_path_lineto:n { #1 + ##1*(#5) , #2 }
}
\int_step_inline:nn {#7}
{
@@ -945,12 +1252,12 @@
}
\int_step_inline:nn {#7}
{
- \draw_path_moveto:n { #1+#7*(#5)-##1 #5 , #2 }
+ \draw_path_moveto:n { #1+#7*(#5)-##1*(#5) , #2 }
\draw_path_lineto:n { #1+#7*(#5) , #2+(##1)*#6 }
}
\int_step_inline:nn {#7}
{
- \draw_path_moveto:n { #1 , #2+#7*#6-##1*(#6) }
+ \draw_path_moveto:n { #1 , #2+#7*(#6)-##1*(#6) }
\draw_path_lineto:n { #1+##1*(#5) , #2+#7*(#6) }
}
}
@@ -965,6 +1272,16 @@
\zitie_background_frame_type_c:n { 十 } {#1} {#2} {#3} {#4} {#5} {#6}
\zitie_background_frame_type_c:n { × } {#1} {#2} {#3} {#4} {#5} {#6}
}
+\zitie_background_new_frame_construct:nn { 二 }
+ {
+ \draw_path_grid:nnnn { #3-#1 } { #6 } { #1 , #2 } { #3 , #4 }
+ \draw_path_use_clear:n { stroke }
+ }
+\zitie_background_new_frame_construct:nn { || }
+ {
+ \draw_path_grid:nnnn { #5 } { #4-#2 } { #1 , #2 } { #3 , #4 }
+ \draw_path_use_clear:n { stroke }
+ }
%%% end of background
\else:
\msg_new:nnn { zitie } { background }
@@ -985,23 +1302,29 @@
\zhlipsum_if_exist:nTF {#3}
{
\tl_if_empty:nF {#1} { \keys_set_filter:nnn { zitie } { geometry } {#1} }
+ \tex_pretolerance:D = 10000
+ \__zitie_break_max_calc:
\hook_use:n { zitie/framezhlipsum/before }
\bool_if:NTF \l__zitie_savefontname_bool
{ \tl_gset_eq:NN \zitiefontname \l__zitie_font_tl }
{ \tl_gset_eq:NN \zitiefontname \c_empty_tl }
- \__zhlipsum_parse_par:nn {#3} {#2}
- \seq_if_empty:NF \l__zhlipsum_par_num_seq
+ \zitie_repeat:Nnn \l__zitie_repeat_int
{
- \seq_pop_right:NN \l__zhlipsum_par_num_seq \l__zhlipsum_tmpa_tl
- \seq_map_inline:Nn \l__zhlipsum_par_num_seq
+ \__zhlipsum_parse_par:nn {#3} {#2}
+ \seq_if_empty:NF \l__zhlipsum_par_num_seq
{
- \tl_map_inline:cn { \__zitie_zhlipsum_paras:nn {#3} {##1} }
- { \zitie_single_construct:N ####1 \allowbreak }
- \hook_use:n { zitie/framezhlipsum/paragraph }
+ \seq_pop_right:NN \l__zhlipsum_par_num_seq \l__zhlipsum_tmpa_tl
+ \seq_map_inline:Nn \l__zhlipsum_par_num_seq
+ {
+ \tl_map_inline:cn { \__zitie_zhlipsum_paras:nn {#3} {##1} }
+ { \zitie_single_construct:N ####1 \__zitie_break: }
+ \hook_use:n { zitie/framezhlipsum/paragraph }
+ }
+ \tl_map_inline:cn { \__zitie_zhlipsum_paras:nn {#3} { \l__zhlipsum_tmpa_tl } }
+ { \zitie_single_construct:N ##1 \__zitie_break: }
}
- \tl_map_inline:cn { \__zitie_zhlipsum_paras:nn {#3} { \l__zhlipsum_tmpa_tl } }
- { \zitie_single_construct:N ##1 \allowbreak }
}
+ { \hook_use:n { zitie/repeat } }
\hook_use:n { zitie/framezhlipsum/after }
}
{ \__zhlipsum_error:nn { invalid-name } {#3} }
diff --git a/Master/texmf-dist/tex/xelatex/zitie/zitie.xetex.def b/Master/texmf-dist/tex/xelatex/zitie/zitie.xetex.def
new file mode 100644
index 00000000000..fcb7dfa69b0
--- /dev/null
+++ b/Master/texmf-dist/tex/xelatex/zitie/zitie.xetex.def
@@ -0,0 +1,52 @@
+\RequirePackage { xeCJK }
+\bool_lazy_and:nnT { \sys_if_platform_windows_p: }
+ { \tl_if_eq_p:NN \CJK@family \c_empty_tl }
+ { \setCJKmainfont {SimSun} }
+\cs_new:Npn \zitie_stroke_chars:nn #1#2 % operator, chars
+ { \special { pdf:code ~ q ~ #1 } #2 \special { pdf:code ~ Q } }
+\cs_new:Npn \zitiestrokechars { \zitie_stroke_chars:nn }
+
+\cs_set_eq:NN \__zitie_check_num_range:nnNN \__xeCJK_check_num_range:nnNN
+\cs_set_eq:NN \__zitie_int_until_do:nn \xeCJK_int_until_do:nn
+\cs_set_eq:NN \zitierawCJKfamily \CJKfamily
+\prg_set_eq_conditional:NNn \zitie_family_if_exist:n \xeCJK_family_if_exist:n { T, F, TF }
+\prg_set_eq_conditional:NNn \zitie_glyph_if_exist:N \xeCJK_glyph_if_exist:N { p, T, F, TF }
+\cs_new_nopar:Npn \__zitie_font_select:nN #1
+ {
+ \zitie_family_if_exist:nTF { \c_zitie_font_name_prefix_tl #1 }
+ { \zitierawCJKfamily+ { \c_zitie_font_name_prefix_tl #1 } }
+ { \zitierawCJKfamily+ {#1} }
+ }
+\NewDocumentCommand \zitieCJKfamily { t+ t- m }
+ {
+ \zitie_family_if_exist:nTF { \c_zitie_font_name_prefix_tl #3 }
+ { \xeCJK_family:NNx #1 #2 { \c_zitie_font_name_prefix_tl #3 } }
+ { \xeCJK_family:NNx #1 #2 {#3} }
+ \tex_ignorespaces:D
+ }
+\cs_new:Npn \__zitie_new_font_family:nnn #1#2#3 % family name, font name, feature
+ { \__xeCJK_pass_args:nnnn { \xeCJK_set_family:nnn { \c_zitie_font_name_prefix_tl #1 } } {#3} {#2} { } }
+\cs_new:Npn \__zitie_new_font_family_validate:nnn #1#2#3
+ {
+ \zitie_font_if_exist:nTF {#2} { \__zitie_new_font_family:nnn {#1} {#2} {#3} }
+ { \msg_warning:nnn { zitie } { font-exist } {#2} }
+ }
+\cs_new:Npn \zitie_token_class_dispatch:Nnnnn #1
+ {
+ \if_case:w \xeCJK_token_value_class:N #1 \exp_stop_f:
+ \exp_after:wN \use_none:nnn % other
+ \or: \exp_after:wN \use_i:nnnn % CJK
+ \or: \exp_after:wN \use_ii:nnnn % FullLeft
+ \or: \exp_after:wN \use_iii:nnnn % FullRight
+ \else: \exp_after:wN \use_none:nnn % other
+ \fi:
+ }
+\prg_new_conditional:Npnn \zitie_token_if_punctuation:N #1 { p, T, F, TF }
+ {
+ \int_compare:nNnTF { \xeCJK_token_value_class:N #1 } > 1
+ {
+ \int_compare:nNnTF { \xeCJK_token_value_class:N #1 } < 6
+ { \prg_return_true: } { \prg_return_false: }
+ }
+ { \prg_return_false: }
+ } \ No newline at end of file