Debian Codegraph @

texmf-dist/tex/latex/ctex/engine/ctex-engine-xetex.def

raw
1 %%
2 %% This is file `ctex-engine-xetex.def',
3 %% generated with the docstrip utility.
4 %%
5 %% The original source files were:
6 %%
7 %% ctex.dtx (with options: `xetex')
8 %%
9 %% Copyright (C) 2003--2022
10 %% CTEX.ORG and any individual authors listed in the documentation.
11 %% ---------------------------------------------------------------------
12 %%
13 %% This work may be distributed and/or modified under the
14 %% conditions of the LaTeX Project Public License, either
15 %% version 1.3c of this license or (at your option) any later
16 %% version. This version of this license is in
17 %% http://www.latex-project.org/lppl/lppl-1-3c.txt
18 %% and the latest version of this license is in
19 %% http://www.latex-project.org/lppl.txt
20 %% and version 1.3 or later is part of all distributions of
21 %% LaTeX version 2005/12/01 or later.
22 %%
23 %% This work has the LPPL maintenance status "maintained".
24 %%
25 %% ---------------------------------------------------------------------
26 %%
27 \GetIdInfo$Id: ctex.dtx 13a2256 2022-07-14 18:54:09 +0800 Qing Lee <[email protected]> $
28 {XeLaTeX adapter (CTEX)}
29 \ProvidesExplFile{ctex-engine-xetex.def}
30 {\ExplFileDate}{2.5.10}{\ExplFileDescription}
31 \RequirePackage { xeCJK }
32 \exp_args:Ne \xeCJKsetup
33 {
34 LoadFandol = false ,
35 PunctStyle = \l__ctex_punct_tl
36 }
37 \@ifpackagelater { fontspec } { 2014/05/25 } { }
38 { \msg_error:nnn { ctex } { package-too-old } { fontspec } }
39 \ctex_hypersetup:n { pdfencoding = unicode }
40 \ctex_at_end_package:nn { xeCJKfntef }
41 {
42 \@ifpackagelater { xeCJKfntef } { 2014/11/04 }
43 {
44 \cs_new_protected:Npn \__ctex_clear_fntef_color:n #1
45 { \xeCJKsetup { #1 / format = { } } }
46 }
47 {
48 \cs_new_protected:Npn \__ctex_clear_fntef_color:n #1
49 { \tl_clear:c { CJK#1color } }
50 }
51 \clist_map_inline:nn
52 { underdot , underline , underdblline , underwave , sout , xout }
53 { \__ctex_clear_fntef_color:n {#1} }
54 }
55 \cs_new_protected:Npn \ctex_update_ccwd:
56 {
57 \hbox_set:Nn \l__ctex_tmp_box { \CJKglue }
58 \dim_set:Nn \ccwd { \box_wd:N \l__ctex_tmp_box + \f@size \p@ }
59 }
60 \dim_new:N \ccwd
61 \cs_new_protected:Npn \ctex_update_ccglue:
62 {
63 \cs_set_protected:Npn \CJKglue
64 { \skip_horizontal:N \l__ctex_ccglue_skip }
65 }
66 \skip_new:N \l__ctex_ccglue_skip
67 \prg_new_conditional:Npnn \ctex_if_ccglue_touched: { TF }
68 {
69 \if_meaning:w \CJKglue \__ctex_ccglue:
70 \prg_return_false: \else: \prg_return_true: \fi:
71 }
72 \ctex_at_end:n { \cs_new_eq:NN \__ctex_ccglue: \CJKglue }
73 \cs_new_protected:Npn \ctex_update_em_unit:
74 { \dim_set:Nn \ccwd { \f@size \p@ } }
75 \cs_new_protected:Npn \ctex_add_to_selectfont:n #1
76 {
77 \cs_set_protected:Npx \CTEX@selectfont@hook
78 { \exp_not:o { \CTEX@selectfont@hook #1 } }
79 }
80 \cs_new_eq:NN \CTEX@selectfont@hook \prg_do_nothing:
81 \bool_if:NTF \c__ctex_everysel_loaded_bool
82 {
83 \cs_if_free:NF \@EverySelectfont@Init
84 {
85 \group_begin:
86 \cs_set:Npn \__ctex_tmp:N #1
87 {
88 \tl_set:Nn \l__ctex_tmp_tl {#1}
89 \cs_new_eq:NN \CTEX@selectfont@save #1
90 \cs_new_protected:Npn \__ctex_restore_selectfont:
91 {
92 \cs_if_free:NF \scr@new@selectfont
93 {
94 \cs_set_eq:NN \scr@new@selectfont #1
95 \cs_set_eq:NN \CTEX@selectfont@save \scr@selectfont
96 }
97 \tl_put_left:Nn \@EverySelectfont@Init
98 { \cs_set_eq:NN #1 \CTEX@selectfont@save }
99 \cs_undefine:N \__ctex_restore_selectfont:
100 }
101 }
102 \ctex_parse_name:NN \__ctex_tmp:N \selectfont
103 \exp_last_unbraced:NNo \group_end:
104 \ctex_patch_cmd_once:NnnnTF { \l__ctex_tmp_tl }
105 { \ExplSyntaxOff }
106 { \size@update }
107 { \CTEX@selectfont@hook \size@update }
108 { \__ctex_restore_selectfont: }
109 { \ctex_patch_failure:N \selectfont }
110 }
111 \cs_new_protected:Npn \ctex_gadd_selectfont_hook:n
112 { \EverySelectfont }
113 }
114 {
115 \cs_new_protected:Npn \ctex_gadd_selectfont_hook:n
116 { \ctex_gadd_ltxhook:nn { selectfont } }
117 }
118 \ctex_gadd_selectfont_hook:n { \CTEX@selectfont@hook }
119 \ctex_define:n
120 {
121 space .choice: ,
122 space / true .code:n =
123 { \xeCJKsetup { CJKspace = true } } ,
124 space / auto .code:n =
125 { \xeCJKsetup { CJKspace = false } } ,
126 space / false .code:n =
127 { \xeCJKsetup { CJKspace = false } } ,
128 space .default:n = { true } ,
129 space .initial:n = { auto }
130 }
131 \ctex_define:n
132 {
133 punct .code:n =
134 {
135 \tl_set:Nx \l__ctex_punct_tl {#1}
136 \xeCJKsetup { PunctStyle = \l__ctex_punct_tl }
137 } ,
138 punct .default:n = { quanjiao } ,
139 }
140 %%
141 %%
142 %% End of file `ctex-engine-xetex.def'.