Debian Codegraph @

texmf-dist/tex/xelatex/xecjk/xunicode-addon.sty

raw
1 %%
2 %% This is file `xunicode-addon.sty',
3 %% generated with the docstrip utility.
4 %%
5 %% The original source files were:
6 %%
7 %% xeCJK.dtx (with options: `xunicode')
8 %%
9 %% Copyright (C) 2007--2010 by Wenchang Sun <[email protected]>
10 %% Copyright (C) 2009--2022 by Leo Liu <[email protected]>
11 %% Copyright (C) 2012--2022 by Qing Lee <[email protected]>
12 %% ----------------------------------------------------------------------
13 %%
14 %% This work may be distributed and/or modified under the
15 %% conditions of the LaTeX Project Public License, either
16 %% version 1.3c of this license or (at your option) any later
17 %% version. This version of this license is in
18 %% http://www.latex-project.org/lppl/lppl-1-3c.txt
19 %% and the latest version of this license is in
20 %% http://www.latex-project.org/lppl.txt
21 %% and version 1.3 or later is part of all distributions of
22 %% LaTeX version 2005/12/01 or later.
23 %%
24 %% This work has the LPPL maintenance status "maintained".
25 %%
26 %% The Current Maintainers of this work are Leo Liu and Qing Lee.
27 %%
28 %% ----------------------------------------------------------------------
29 %%
30 \NeedsTeXFormat{LaTeX2e}
31 \RequirePackage{expl3}
32 \GetIdInfo$Id: xeCJK.dtx c4ccfae 2022-08-05 21:02:32 +0800 Qing Lee <[email protected]> $
33 {addon file for xunicode}
34 \ProvidesExplPackage{xunicode-addon}
35 {\ExplFileDate}{3.9.1}{\ExplFileDescription}
36 \bool_lazy_or:nnF
37 { \sys_if_engine_xetex_p: }
38 { \sys_if_engine_luatex_p: }
39 {
40 \msg_new:nnnn { xunicode-addon } { xetex-luatex }
41 { This~package~requires~either~XeTeX~or~LuaTeX~to~function.}
42 {
43 You~must~change~your~typesetting~engine~to,~e.g.,\\
44 "xelatex"~or~"lualatex"~instead~of~plain~"latex"~or~"pdflatex".
45 }
46 \msg_critical:nn { xunicode-addon } { xetex-luatex }
47 }
48 \RequirePackage { xparse }
49 \clist_new:N \g__xunadd_encname_clist
50 \tl_if_exist:NT \UTFencname
51 { \clist_gput_right:Nx \g__xunadd_encname_clist { \UTFencname } }
52 \DeclareOption*
53 { \clist_gput_right:No \g__xunadd_encname_clist \CurrentOption }
54 \ProcessOptions \scan_stop:
55 \@ifpackageloaded { xunicode } { }
56 {
57 \clist_get:NNF \g__xunadd_encname_clist \UTFencname
58 {
59 \cs_if_exist:NTF \UnicodeEncodingName
60 { \tl_set:Nx \UTFencname { \UnicodeEncodingName } }
61 {
62 \sys_if_engine_xetex:TF
63 { \tl_set:Nn \UTFencname { EU1 } }
64 { \tl_set:Nn \UTFencname { EU2 } }
65 }
66 \clist_gset_eq:NN \g__xunadd_encname_clist \UTFencname
67 }
68 \sys_if_engine_xetex:TF
69 { \RequirePackage { xunicode } }
70 {
71 \cs_set_eq:NN \__xunadd_tmp:w \XeTeXpicfile
72 \cs_set_eq:NN \XeTeXpicfile \prg_do_nothing:
73 \RequirePackage { xunicode }
74 \cs_set_eq:NN \XeTeXpicfile \__xunadd_tmp:w
75 }
76 }
77 \AtEndOfPackage { \__xunadd_reload:N \g__xunadd_encname_clist }
78 \RenewDocumentCommand \ReloadXunicode { m }
79 {
80 \clist_set:Nx \l__xunadd_encname_clist {#1}
81 \__xunadd_reload:N \l__xunadd_encname_clist
82 }
83 \cs_new_protected:Npn \__xunadd_reload:N #1
84 {
85 \cs_set_eq:NN \__xunadd_tmp:w \iftipaonetoken
86 \cs_set_eq:NN \iftipaonetoken \scan_stop:
87 \use:e
88 {
89 \ExplSyntaxOff
90 \char_set_catcode_letter:n { 64 }
91 \exp_not:N \clist_map_function:NN \exp_not:N #1 \__xunadd_reload_aux:n
92 \bool_if:NTF \l__kernel_expl_bool
93 { \ExplSyntaxOn }
94 { \ExplSyntaxOff }
95 \char_set_catcode:nn { 64 } { \char_value_catcode:n { 64 } }
96 }
97 \cs_set_eq:NN \iftipaonetoken \__xunadd_tmp:w
98 }
99 \cs_new_protected:Npn \__xunadd_reload_aux:n #1
100 {
101 \cs_if_exist:cTF { T@ #1 }
102 {
103 \tl_set:Nn \UTFencname {#1}
104 \clist_if_in:NnF \g__xunadd_encname_clist {#1}
105 { \clist_gput_right:Nn \g__xunadd_encname_clist {#1} }
106 \file_input:n { xunicode.sty }
107 \file_input:n { xunicode-extra.def }
108 }
109 { \msg_error:nnn { xunicode-addon } { encoding-unknown } {#1} }
110 }
111 \clist_new:N \l__xunadd_encname_clist
112 \msg_new:nnnn { xunicode-addon } { encoding-unknown }
113 { Encoding~scheme~"#1"~unknown. }
114 {
115 You~may~use \\\\
116 \token_to_str:N \usepackage [ #1 , \encodingdefault ] \{fontenc\} \\\\
117 before~xunicode-addon~or~xunicode.
118 }
119 \RenewDocumentCommand \DeclareUTFmathsymbols { m }
120 {
121 \bool_if:NT \l__xunadd_math_as_UTF_text_bool
122 {
123 \seq_map_inline:Nn \l__xunadd_math_as_UTF_text_seq
124 { \__xunadd_declare_math_as_UTF_text:n {##1} }
125 \bool_set_false:N \l__xunadd_math_as_UTF_text_bool
126 }
127 }
128 \seq_new:N \l__xunadd_math_as_UTF_text_seq
129 \seq_set_from_clist:Nn \l__xunadd_math_as_UTF_text_seq
130 { hbar , Finv , aleph , beth , gimel , daleth , Game }
131 \bool_new:N \l__xunadd_math_as_UTF_text_bool
132 \RenewDocumentCommand \UseMathAsText { }
133 {
134 \math@s@text@true
135 \bool_set_true:N \l__xunadd_math_as_UTF_text_bool
136 }
137 \@onlypreamble \UseMathAsText
138 \cs_new_protected:Npn \__xunadd_declare_math_as_UTF_text:n #1
139 {
140 \cs_if_exist:cTF {#1}
141 {
142 \cs_new_eq:cc { keepmathUTF #1 } {#1}
143 \cs_gset_protected:cpx {#1}
144 {
145 \exp_not:N \mode_if_math:TF
146 { \exp_not:c { keepmathUTF #1 } }
147 { \exp_not:c { text #1 } }
148 }
149 \tl_put_right:Nx \l__xunadd_hyperref_hook_tl
150 { \cs_set_eq:NN \exp_not:c {#1} \exp_not:c { text #1 } }
151 }
152 { \cs_new:cpx {#1} { \exp_not:c { text #1 } } }
153 }
154 \tl_new:N \l__xunadd_hyperref_hook_tl
155 \AtBeginDocument
156 {
157 \cs_if_free:NF \pdfstringdefDisableCommands
158 { \pdfstringdefDisableCommands { \l__xunadd_hyperref_hook_tl } }
159 }
160 \prg_new_conditional:Npnn \__xunadd_glyph_if_exist:n #1 { p , T , F , TF }
161 {
162 \tex_iffontchar:D \tex_font:D \tex_numexpr:D #1 \scan_stop:
163 \prg_return_true: \else: \prg_return_false: \fi:
164 }
165 \RenewDocumentCommand \UndeclareUTFcharacter { O { \UTFencname } m m }
166 {
167 \__xunadd_if_csname:nTF {#3}
168 { \UndeclareTextCommand {#3} }
169 { \exp_args:Nc \UndeclareTextCommand { \tl_to_str:n {#3} } }
170 {#1}
171 }
172 \RenewDocumentCommand \UndeclareUTFcomposite { O { \UTFencname } m m m }
173 {
174 \__xunadd_if_csname:nTF {#3}
175 { \__xunadd_undeclare_composite:Nnnn #3 }
176 { \exp_args:Nc \__xunadd_undeclare_composite:Nnnn { \tl_to_str:n {#3} } }
177 {#1} {#4} {#2}
178 }
179 \cs_new_protected:Npn \__xunadd_undeclare_composite:Nnnn #1#2#3#4
180 { \cs_undefine:c { \__xunadd_composite_cs:Nnn #1 {#2} {#3} } }
181 \cs_new:Npx \__xunadd_composite_cs:Nnn #1#2#3
182 { \c_backslash_str #2 \exp_not:N \token_to_str:N #1 - \exp_not:N \tl_to_str:n {#3} }
183 \cs_new:Npx \__xunadd_composite_cs:nnn #1#2#3
184 { \c_backslash_str #2 #1 - \exp_not:N \tl_to_str:n {#3} }
185 \prg_new_conditional:Npnn \__xunadd_if_csname:n #1 { TF }
186 {
187 \tl_if_single_token:nTF {#1}
188 {
189 \token_if_cs:NTF #1
190 { \prg_return_true: }
191 {
192 \token_if_active:NTF #1
193 { \prg_return_true: }
194 { \prg_return_false: }
195 }
196 }
197 { \prg_return_false: }
198 }
199 \RenewDocumentCommand \DeclareUTFcharacter { O { \UTFencname } m m }
200 {
201 \cs_if_exist_use:cF
202 { __xunadd_restore_ \tl_to_str:n {#3} : }
203 {
204 \__xunadd_if_csname:nTF {#3}
205 { \__xunadd_declare_character:Nnn #3 }
206 { \__xunadd_declare_character:cnn { \tl_to_str:n {#3} } }
207 {#1} {#2}
208 }
209 }
210 \cs_new_protected:cpn
211 { __xunadd_restore_ \tl_to_str:n { \hbar } : }
212 { \__xunadd_restore_cmd:N \hbar }
213 \cs_new_protected:cpn
214 { __xunadd_restore_ \tl_to_str:n { \nobreakspace } : }
215 { \__xunadd_restore_cmd:N \nobreakspace }
216 \cs_new_protected:Npn \__xunadd_restore_cmd:N #1
217 { \__xunadd_restore_cmd:Ne #1 { ? - \token_to_str:N #1 } }
218 \cs_new_protected:Npn \__xunadd_restore_cmd:Nn #1#2
219 {
220 \cs_if_free:cF {#2}
221 { \__xunadd_restore_cmd:Nc #1 {#2} }
222 }
223 \cs_new_protected:Npn \__xunadd_restore_cmd:NN #1#2
224 {
225 \cs_gset_eq:NN #1 #2
226 \cs_undefine:N #2
227 }
228 \cs_generate_variant:Nn \__xunadd_restore_cmd:Nn { Ne }
229 \cs_generate_variant:Nn \__xunadd_restore_cmd:NN { Nc }
230 \cs_new_protected:Npn \__xunadd_declare_character:Nnn #1#2#3
231 {
232 \__xunadd_provide_text_command_default:N #1
233 \exp_after:wN \__xunadd_declare_character:NNen
234 \tex_Uchar:D \__xunadd_check_slot:n {#3} \exp_stop_f:
235 #1 { \token_to_str:N #1 } {#2}
236 }
237 \cs_generate_variant:Nn \__xunadd_declare_character:Nnn { c }
238 \NewDocumentCommand \DeclareUTFSymbol { m O { \UTFencname } m }
239 { \__xunadd_declare_character:Nnn #1 {#2} {#3} }
240 \NewDocumentCommand \DeclareUTFCommand { m O { \UTFencname } m }
241 { \__xunadd_text_command:Nonn #1 { \token_to_str:N #1 } {#2} {#3} }
242 \cs_new_protected:Npn \__xunadd_text_command:Nnnn #1#2#3#4
243 { \DeclareTextCommand #1 {#3} { \__xunadd_text_command:nn {#2} {#4} } }
244 \cs_generate_variant:Nn \__xunadd_text_command:Nnnn { No }
245 \cs_new_protected:Npn \__xunadd_text_command:nn #1#2
246 {
247 \__xunadd_begin_hook:nn {#1} {#2}
248 #2
249 \__xunadd_end_hook:nn {#1} {#2}
250 }
251 \cs_new_protected:Npn \__xunadd_provide_text_command_default:N #1
252 {
253 \cs_if_exist:cF { ? \token_to_str:N #1 }
254 {
255 \cs_if_free:cF { ? - \token_to_str:N #1 }
256 {
257 \exp_args:NNv \ProvideTextCommandDefault #1
258 { ? - \token_to_str:N #1 }
259 }
260 }
261 }
262 \cs_new_protected:Npn \__xunadd_declare_character:NNnn #1#2#3#4
263 { \DeclareTextCommand #2 {#4} { \__xunadd_text_character:nN {#3} {#1} } }
264 \cs_new_protected:Npn \__xunadd_text_character:nN #1#2
265 {
266 \__xunadd_begin_hook:nn {#1} {#2}
267 \__xunadd_glyph_if_exist:nTF { `#2 }
268 {#2} { \cs_if_exist_use:cF { ? #1 } {#2} }
269 \__xunadd_end_hook:nn {#1} {#2}
270 }
271 \cs_generate_variant:Nn \__xunadd_declare_character:NNnn { NNe }
272 \cs_new:Npn \__xunadd_check_slot:n #1
273 {
274 \int_eval:n
275 {
276 \tl_if_head_eq_charcode:nNTF {#1} x
277 { " \use_none:n #1 } {#1}
278 }
279 }
280 \RenewDocumentCommand \DeclareUTFcomposite { O { \UTFencname } m m m }
281 {
282 \__xunadd_if_csname:nTF {#3}
283 { \__xunadd_declare_composite:Nnnn #3 }
284 { \__xunadd_declare_composite:cnnn { \tl_to_str:n {#3} } }
285 {#1} {#4} {#2}
286 }
287 \cs_new_protected:Npn \__xunadd_declare_composite:Nnnn #1#2#3#4
288 {
289 \tex_afterassignment:D \use_none_delimit_by_q_stop:w
290 \__xunadd_chardef:cn { \__xunadd_composite_cs:Nnn #1 {#2} {#3} }
291 { \__xunadd_check_slot:n {#4} }
292 \q_stop
293 }
294 \cs_new_protected:Npn \__xunadd_chardef:Nn #1#2
295 { \tex_chardef:D #1 = \tex_numexpr:D #2 \scan_stop: }
296 \cs_generate_variant:Nn \__xunadd_chardef:Nn { c }
297 \cs_generate_variant:Nn \__xunadd_declare_composite:Nnnn { c }
298 \NewDocumentCommand \DeclareUTFCompositeCommand { m O { \UTFencname } m m }
299 { \cs_set_protected:cpn { \__xunadd_composite_cs:Nnn #1 {#2} {#3} } {#4} }
300 \NewDocumentCommand \DeclareUTFCompositeSymbol { m O { \UTFencname } m m }
301 {
302 \__xunadd_chardef:cn { \__xunadd_composite_cs:Nnn #1 {#2} {#3} }
303 { \__xunadd_check_slot:n {#4} }
304 }
305 \NewDocumentCommand \DeclareUTFComposite { m O { \UTFencname } }
306 { \use:e { \__xunadd_declare_composite:Nnn \exp_not:N #1 { \token_to_str:N #1 } {#2} } }
307 \NewDocumentCommand \DeclareUTFEncodedAccent { m O { \UTFencname } m m }
308 { \__xunadd_declare_encoded:NNnnn \__xunadd_combine_accent:nnNNn #1 {#2} {#3} {#4} }
309 \NewDocumentCommand \DeclareUTFEncodedAccents { m O { \UTFencname } m m }
310 { \__xunadd_declare_encoded:NNnnn \__xunadd_combine_accents:nnNNn #1 {#2} {#3} {#4} }
311 \NewDocumentCommand \DeclareUTFEncodedSymbol { m O { \UTFencname } m m }
312 { \__xunadd_declare_encoded:NNnnn \__xunadd_combine_symbol:nnNNn #1 {#2} {#3} {#4} }
313 \NewDocumentCommand \DeclareUTFEncodedCircle { m O { \UTFencname } m m }
314 { \__xunadd_declare_encoded:NNnnn \__xunadd_combine_circle:nnNNn #1 {#2} {#3} {#4} }
315 \RenewDocumentCommand \DeclareEncodedCompositeCharacter { m m m m }
316 { \DeclareUTFEncodedSymbol #2 [#1] { "#3 } { "0#4 } }
317 \RenewDocumentCommand \DeclareEncodedCompositeAccents { m m m m }
318 { \DeclareUTFEncodedAccents #2 [#1] { "#4 } { "#3 } }
319 \NewDocumentCommand \DeclareUTFDoubleEncodedAccent { m O { \UTFencname } m m }
320 { \__xunadd_declare_encoded:NNnnn \__xunadd_combine_double_accent:nnNNn #1 {#2} {#3} {#4} }
321 \NewDocumentCommand \DeclareUTFDoubleEncodedSymbol { m O { \UTFencname } m m }
322 { \__xunadd_declare_encoded:NNnnn \__xunadd_combine_double_symbol:nnNNn #1 {#2} {#3} {#4} }
323 \cs_new_protected:Npn \__xunadd_declare_composite:Nnn #1#2#3
324 { \DeclareTextCommand #1 {#3} { \__xunadd_text_composite:nnn {#2} {#3} } }
325 \cs_new_protected:Npn \__xunadd_text_composite:nnn #1#2#3
326 {
327 \__xunadd_begin_hook:nn {#1} {#3}
328 \cs_if_exist:cTF { \__xunadd_composite_cs:nnn {#1} {#2} {#3} }
329 {
330 \__xunadd_text_composite:cnn
331 { \__xunadd_composite_cs:nnn {#1} {#2} {#3} } {#1} {#3}
332 }
333 { \cs_if_exist_use:cTF { ? #1 } { {#3} } {#3} }
334 \__xunadd_end_hook:nn {#1} {#3}
335 }
336 \cs_new_protected:Npn \__xunadd_text_composite:Nnn #1#2#3
337 {
338 \token_if_chardef:NTF #1
339 {
340 \__xunadd_glyph_if_exist:nTF {#1}
341 {#1} { \cs_if_exist_use:cTF { ? #2 } { {#3} } {#3} }
342 }
343 {#1}
344 }
345 \cs_generate_variant:Nn \__xunadd_text_composite:Nnn { c }
346 \cs_new_protected:Npn \__xunadd_declare_encoded:NNnnn #1#2#3#4#5
347 {
348 \exp_after:wN \__xunadd_declare_encoded:NNNNee
349 \tex_Uchar:D \__xunadd_check_slot:n {#4} \exp_after:wN \exp_stop_f:
350 \tex_Uchar:D \__xunadd_check_slot:n {#5} \exp_stop_f:
351 #1 #2 { \token_to_str:N #2 } {#3}
352 }
353 \cs_new_protected:Npn \__xunadd_declare_encoded:NNNNnn #1#2#3#4#5#6
354 { \DeclareTextCommand #4 {#6} { #3 {#5} {#6} {#1} {#2} } }
355 \cs_generate_variant:Nn \__xunadd_declare_encoded:NNnnn { c }
356 \cs_generate_variant:Nn \__xunadd_declare_encoded:NNNNnn { NNNNee }
357 \cs_new_protected:Npn \__xunadd_text_combine:NnnNNn #1#2#3#4#5#6
358 {
359 \__xunadd_begin_hook:nn {#2} {#6}
360 \cs_if_exist:cTF { \__xunadd_composite_cs:nnn {#2} {#3} {#6} }
361 {
362 \__xunadd_text_combine:cNnNNn
363 { \__xunadd_composite_cs:nnn {#2} {#3} {#6} } #1 {#2} {#4} {#5} {#6}
364 }
365 { #1 {#6} {#2} {#4} {#5} }
366 \__xunadd_end_hook:nn {#2} {#6}
367 }
368 \cs_new_protected:Npn \__xunadd_text_combine:NNnNNn #1#2#3#4#5#6
369 {
370 \token_if_chardef:NTF #1
371 { \__xunadd_glyph_if_exist:nTF {#1} {#1} { #2 {#6} {#3} {#4} {#5} } }
372 {#1}
373 }
374 \cs_generate_variant:Nn \__xunadd_text_combine:NNnNNn { c }
375 \cs_new_protected:Npn \__xunadd_combine_symbol:nnNNn
376 { \__xunadd_text_combine:NnnNNn \__xunadd_add_symbol:nnNN }
377 \cs_new_protected:Npn \__xunadd_add_symbol:nnNN #1#2#3#4
378 {
379 \tl_if_blank:nTF {#1}
380 {
381 \__xunadd_glyph_if_exist:nTF { `#4 }
382 {#4}
383 { \cs_if_exist_use:cTF { ? #2 } { {#1} } {#4} }
384 }
385 {
386 \__xunadd_glyph_if_exist:nTF { `#3 }
387 { #1#3 }
388 { \cs_if_exist_use:cTF { ? #2 } { {#1} } { #1#3 } }
389 }
390 }
391 \cs_new_protected:Npn \__xunadd_combine_accent:nnNNn
392 { \__xunadd_text_combine:NnnNNn \__xunadd_add_accent:nnNN }
393 \cs_new_protected:Npn \__xunadd_add_accent:nnNN #1#2#3#4
394 {
395 \tl_if_blank:nTF {#1}
396 {
397 \__xunadd_glyph_if_exist:nTF { `#4 }
398 {#4}
399 { \cs_if_exist_use:cTF { ? #2 } { {#1} } {#4} }
400 }
401 {
402 \__xunadd_glyph_if_exist:nTF { `#3 }
403 { #1#3 }
404 {
405 \__xunadd_glyph_if_exist:nTF { `#4 }
406 { \add@accent { `#4 } {#1} }
407 { \cs_if_exist_use:cTF { ? #2 } { {#1} } { #1#3 } }
408 }
409 }
410 }
411 \cs_new_protected:Npn \__xunadd_combine_accents:nnNNn
412 { \__xunadd_text_combine:NnnNNn \__xunadd_add_accents:nnNN }
413 \cs_new_protected:Npn \__xunadd_add_accents:nnNN #1#2#3#4
414 {
415 \tl_if_blank:nTF {#1}
416 { \cs_if_exist_use:cTF { ? #2 } { {#1} } {#1} }
417 {
418 \__xunadd_glyph_if_exist:nTF { `#3 }
419 { \__xunadd_glyph_if_exist:nTF { `#4 } }
420 { \use_ii:nn }
421 { #1#3#4 }
422 { \cs_if_exist_use:cTF { ? #2 } { {#1} } { #1#3#4 } }
423 }
424 }
425 \cs_new_protected:Npn \__xunadd_combine_circle:nnNNn
426 { \__xunadd_text_combine:NnnNNn \__xunadd_add_circle:nnNN }
427 \cs_new_protected:Npn \__xunadd_add_circle:nnNN #1#2#3#4
428 {
429 \tl_if_blank:nTF {#1}
430 {
431 \__xunadd_glyph_if_exist:nTF { `#4 }
432 {#4}
433 { \cs_if_exist_use:cTF { ? #2 } { {#1} } {#4} }
434 }
435 {
436 \__xunadd_glyph_if_exist:nTF { `#4 }
437 { \__xunadd_add_circle:nN {#1} #4 }
438 { \cs_if_exist_use:cTF { ? #2 } { {#1} } {#1} }
439 }
440 }
441 \cs_new_protected:Npn \__xunadd_add_circle:nN #1#2
442 {
443 \hcoffin_set:Nn \l__xunadd_tmp_coffin {#1}
444 \hcoffin_set:Nn \l__xunadd_circle_coffin {#2}
445 \fp_set:Nn \l__xunadd_circle_scale_fp
446 {
447 \dim_to_decimal_in_unit:nn
448 {
449 \fp_use:N \l__xunadd_circle_ratio_fp
450 \coffin_wd:N \l__xunadd_circle_coffin
451 }
452 { \coffin_wd:N \l__xunadd_tmp_coffin }
453 }
454 \coffin_scale:Nnn \l__xunadd_tmp_coffin
455 { \l__xunadd_circle_scale_fp } { \l__xunadd_circle_scale_fp }
456 \coffin_attach:NnnNnnnn
457 \l__xunadd_circle_coffin { hc } { vc }
458 \l__xunadd_tmp_coffin { hc } { vc } { \c_zero_dim } { \c_zero_dim }
459 \coffin_typeset:Nnnnn \l__xunadd_circle_coffin
460 { H } { l } { \c_zero_dim } { \c_zero_dim }
461 }
462 \fp_new:N \l__xunadd_circle_scale_fp
463 \coffin_new:N \l__xunadd_tmp_coffin
464 \coffin_new:N \l__xunadd_circle_coffin
465 \NewDocumentCommand \settextcircledratio { m }
466 { \fp_set:Nn \l__xunadd_circle_ratio_fp {#1} }
467 \fp_new:N \l__xunadd_circle_ratio_fp
468 \settextcircledratio { 0.7 }
469 \cs_new_protected:Npn \__xunadd_combine_double_accent:nnNNn
470 { \__xunadd_text_combine:NnnNNn \__xunadd_add_double_accent:nnNN }
471 \cs_new_protected:Npn \__xunadd_add_double_accent:nnNN #1#2#3#4
472 {
473 \tl_if_blank:nTF {#1}
474 {
475 \__xunadd_glyph_if_exist:nTF { `#4 }
476 {#4}
477 { \cs_if_exist_use:cTF { ? #2 } { {#1} } {#4} }
478 }
479 {
480 \__xunadd_glyph_if_exist:nTF { `#3 }
481 { \__xunadd_add_double_symbol:nN {#1} #3 }
482 {
483 \__xunadd_glyph_if_exist:nTF { `#4 }
484 { \add@accent { `#4 } {#1} }
485 { \cs_if_exist_use:cTF { ? #2 } { {#1} } { #1#3 } }
486 }
487 }
488 }
489 \cs_new_protected:Npn \__xunadd_combine_double_symbol:nnNNn
490 { \__xunadd_text_combine:NnnNNn \__xunadd_add_double_symbol:nnNN }
491 \cs_new_protected:Npn \__xunadd_add_double_symbol:nnNN #1#2#3#4
492 {
493 \tl_if_blank:nTF {#1}
494 {
495 \__xunadd_glyph_if_exist:nTF { `#4 }
496 {#4}
497 { \cs_if_exist_use:cTF { ? #2 } { {#1} } {#4} }
498 }
499 {
500 \__xunadd_glyph_if_exist:nTF { `#3 }
501 { \__xunadd_add_double_symbol:nN {#1} #3 }
502 { \cs_if_exist_use:cTF { ? #2 } { {#1} } { #1#3 } }
503 }
504 }
505 \cs_new_protected:Npn \__xunadd_add_double_symbol:nN #1#2
506 {
507 \tl_if_head_is_N_type:nTF {#1}
508 {
509 \exp_after:wN \exp_after:wN \exp_after:wN
510 \__xunadd_add_double_symbol_aux:NnN \exp_after:wN \exp_after:wN
511 \tl_head:w #1 \q_stop \exp_after:wN { \use_none:n #1 } #2
512 }
513 { #1#2 }
514 }
515 \cs_new_protected:Npn \__xunadd_add_double_symbol_aux:NnN #1#2#3
516 {
517 \bool_lazy_any:nTF
518 {
519 { \token_if_letter_p:N #1 }
520 { \token_if_other_p:N #1 }
521 { \token_if_chardef_p:N #1 }
522 }
523 { #1#3#2 }
524 { #1#2#3 }
525 }
526 \NewDocumentCommand \AtBeginUTFCommand { s O { } +m }
527 {
528 \tl_if_blank:nTF {#2}
529 {
530 \IfBooleanTF {#1}
531 { \xunadd_set_begin_hook:n }
532 { \xunadd_append_begin_hook:n }
533 }
534 { \xunadd_set_begin_hook:nn {#2} }
535 {#3}
536 }
537 \NewDocumentCommand \AtEndUTFCommand { s O { } +m }
538 {
539 \tl_if_blank:nTF {#2}
540 {
541 \IfBooleanTF {#1}
542 { \xunadd_set_end_hook:n }
543 { \xunadd_append_end_hook:n }
544 }
545 { \xunadd_set_end_hook:nn {#2} }
546 {#3}
547 }
548 \cs_new_protected:Npn \xunadd_set_begin_hook:n
549 { \tl_set:Nn \l__xunadd_begin_hook_tl }
550 \cs_new_protected:Npn \xunadd_append_begin_hook:n
551 { \tl_put_right:Nn \l__xunadd_begin_hook_tl }
552 \cs_new_protected:Npn \xunadd_set_end_hook:n
553 { \tl_set:Nn \l__xunadd_end_hook_tl }
554 \cs_new_protected:Npn \xunadd_append_end_hook:n
555 { \tl_put_right:Nn \l__xunadd_end_hook_tl }
556 \cs_new_protected:Npn \xunadd_set_begin_hook:nn
557 { \__xunadd_set_cmd_hook:nnn { begin } }
558 \cs_new_protected:Npn \xunadd_set_end_hook:nn
559 { \__xunadd_set_cmd_hook:nnn { end } }
560 \cs_new_protected:Npn \__xunadd_set_cmd_hook:nnn #1#2#3
561 {
562 \cs_set_protected:cpn
563 {
564 \tl_if_single:nTF {#2}
565 { \use:c { __xunadd_#1_csname:n } { \token_to_str:N #2 } }
566 { \__xunadd_set_cmd_hook_aux:Nnwn #2 \q_stop {#1} }
567 } ##1
568 {#3}
569 }
570 \cs_new:Npn \__xunadd_set_cmd_hook_aux:Nnwn #1#2 \q_stop #3
571 { \use:c { __xunadd_#3_csname:n } { \token_to_str:N #1 - \tl_to_str:n {#2} } }
572 \cs_new:Npn \__xunadd_begin_csname:n #1 { __xunadd_begin_#1_hook:n }
573 \cs_new:Npn \__xunadd_end_csname:n #1 { __xunadd_end_#1_hook:n }
574 \tl_new:N \l__xunadd_begin_hook_tl
575 \tl_new:N \l__xunadd_end_hook_tl
576 \cs_new_protected:Npn \__xunadd_begin_hook:nn #1#2
577 {
578 \tl_use:N \l__xunadd_begin_hook_tl
579 \cs_if_exist_use:cF { \__xunadd_begin_csname:n { #1 - \tl_to_str:n {#2} } }
580 { \cs_if_exist_use:cF { \__xunadd_begin_csname:n {#1} } { \use_none:n } }
581 {#2}
582 }
583 \cs_new_protected:Npn \__xunadd_end_hook:nn #1#2
584 {
585 \cs_if_exist_use:cF { \__xunadd_end_csname:n { #1 - \tl_to_str:n {#2} } }
586 { \cs_if_exist_use:cF { \__xunadd_end_csname:n {#1} } { \use_none:n } }
587 {#2}
588 \tl_use:N \l__xunadd_end_hook_tl
589 }
590 \NewDocumentCommand \DeclareUTFTIPACommand { O { \UTFencname } m }
591 { \use:e { \__xunadd_text_tipa_command:Nnn \exp_not:N #2 { \token_to_str:N #2 } {#1} } }
592 \cs_new_protected:Npn \__xunadd_text_tipa_command:Nnn #1#2#3
593 {
594 \cs_set_eq:cc { UTF/#3#2 } { #3#2 }
595 \DeclareTextCommand #1 {#3} { \__xunadd_text_tipa_command:nnn {#3} {#2} }
596 }
597 \cs_new_protected:Npn \__xunadd_text_tipa_command:nnn #1#2#3
598 {
599 \exp_args:Ncc \__xunadd_check_for_tipa:NNn
600 { \use_none:n #2 } { UTF/#1#2 } {#3}
601 }
602 \cs_new_protected:Npn \__xunadd_check_for_tipa:NNn #1#2#3
603 {
604 \tl_if_head_eq_meaning:nNTF {#3} \textipa
605 {
606 \exp_after:wN \tipacatchonechar \exp_after:wN
607 { \exp_after:wN #1 \use_none:n #3 }
608 }
609 { #2 {#3} }
610 }
611 \cs_new_protected:Npn \xunadd_get_slot:nn #1#2
612 { \__xunadd_get_slot:wn #2 \q_nil \q_stop {#1} }
613 \cs_new_protected:Npn \__xunadd_get_slot:wn #1#2#3 \q_stop #4
614 {
615 \int_set:Nn \l_xunadd_slot_int { -1 }
616 \bool_set_false:N \l_xunadd_rest_bool
617 \group_begin: \exp_args:Nccc \group_end:
618 { __xunadd_get_slot:NNnn }
619 { #4 \token_to_str:N #1 }
620 { \__xunadd_composite_cs:Nnn #1 {#4} {#2} }
621 {#2}
622 {#3}
623 }
624 \int_new:N \l_xunadd_slot_int
625 \bool_new:N \l_xunadd_rest_bool
626 \cs_new_protected:Npn \__xunadd_get_slot:NNnn #1#2#3#4
627 {
628 \cs_if_free:NF #1
629 {
630 \cs_if_exist:NTF #2
631 { \__xunadd_get_composite_slot:Nn #2 {#4} }
632 { \__xunadd_get_character_slot:Nn #1 { #3 #4 } }
633 }
634 }
635 \cs_new_protected:Npn \__xunadd_get_composite_slot:Nn #1#2
636 {
637 \token_if_chardef:NT #1
638 {
639 \int_set:Nn \l_xunadd_slot_int {#1}
640 \quark_if_nil:nF {#2}
641 { \bool_set_true:N \l_xunadd_rest_bool }
642 }
643 }
644 \cs_new_protected:Npn \__xunadd_get_character_slot:Nn #1
645 {
646 \exp_after:wN \__xunadd_get_character_slot_aux:wn #1
647 \__xunadd_text_character:nN \q_nil \q_nil \q_stop
648 }
649 \cs_new_protected:Npn \__xunadd_get_character_slot_aux:wn
650 #1 \__xunadd_text_character:nN #2#3#4 \q_stop #5
651 {
652 \quark_if_nil:nF {#2}
653 {
654 \int_set:Nn \l_xunadd_slot_int { `#3 }
655 \quark_if_nil:nF {#5}
656 { \bool_set_true:N \l_xunadd_rest_bool }
657 }
658 }
659 \cs_new_protected_nopar:Npn \xunadd@microtype@is@charx #1 \relax
660 {
661 \use:e
662 { \xunadd_get_slot:nn { \MT@encoding } { \tex_the:D \MT@toks } }
663 \int_compare:nNnTF \l_xunadd_slot_int < \c_zero_int
664 { \xunadd@original@is@charx #1 \relax }
665 {
666 \cs_set_nopar:Npx \MT@char@ { \int_use:N \l_xunadd_slot_int }
667 \bool_if:NT \l_xunadd_rest_bool { \MT@norestfalse }
668 }
669 }
670 \cs_new_protected_nopar:Npn \xunadd@microtype@hook
671 {
672 \cs_if_free:NF \MT@is@charx
673 {
674 \cs_new_eq:NN \xunadd@original@is@charx \MT@is@charx
675 \cs_set_eq:NN \MT@is@charx \xunadd@microtype@is@charx
676 \cs_set_eq:NN \MT@warn@unknown@once \use_none:n
677 }
678 }
679 \@ifpackageloaded { microtype }
680 { \use:n } { \AtBeginDocument }
681 { \xunadd@microtype@hook }
682 %%
683 %% This package consists of the files xeCJK.dtx,
684 %% full-stop.map,
685 %% fullwidth-stop.map,
686 %% han-simp.map,
687 %% han-trad.map,
688 %% and the derived files xeCJK.pdf,
689 %% xeCJK.sty,
690 %% xeCJK.cfg,
691 %% xeCJK.ins,
692 %% xeCJKfntef.sty,
693 %% xeCJK-listings.sty,
694 %% xunicode-addon.sty,
695 %% xunicode-extra.def,
696 %% xeCJK-example-autofake.tex,
697 %% xeCJK-example-fallback.tex,
698 %% xeCJK-example-subCJKblock.tex,
699 %% xeCJK-example-CJKecglue.tex,
700 %% xeCJK-example-checksingle.tex,
701 %% xeCJK-example-CJKfntef.tex,
702 %% xeCJK-example-punctstyle.tex,
703 %% xeCJK-example-verbatim.tex,
704 %% xeCJK-example-CM.tex,
705 %% xeCJK-example-listings.tex,
706 %% xeCJK-example-mathblock.tex,
707 %% xunicode-symbols.tex,
708 %% xunicode-commands.tex,
709 %% xunicode-combine-marks.tex,
710 %% xunicode-symbols.pdf,
711 %% full-stop.tec,
712 %% fullwidth-stop.tec,
713 %% han-simp.tec,
714 %% han-trad.tec, and
715 %% README.md.
716 %%
717 %% End of file `xunicode-addon.sty'.