Debian Codegraph @

texmf-dist/tex/generic/ctex/ctex-spa-macro.tex

raw
1 %%
2 %% This is file `ctex-spa-macro.tex',
3 %% generated with the docstrip utility.
4 %%
5 %% The original source files were:
6 %%
7 %% ctex.dtx (with options: `spa,macro')
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 \input expl3-generic %
28 \ExplSyntaxOn
29 \sys_if_engine_xetex:F
30 {
31 \msg_new:nnn { ctex } { xetex }
32 { XeTeX~is~required~to~compile~this~document! }
33 \msg_fatal:nn { ctex } { xetex }
34 }
35 \seq_const_from_clist:Nn \c__ctex_punct_seq
36 {
37 "2018 , "201C , "300C , "300E , "3014 , "FF08 , "FF3B , "FF5B ,
38 "3008 , "300A , "3016 , "3010 ,
39 "2014 , "2026 , "3001 , "3002 , "FF0C , "FF0E , "FF1A , "FF1B ,
40 "FF01 , "FF1F , "FF05 , "3015 , "FF09 , "FF3D , "FF5D , "3009 ,
41 "300B , "3017 , "3011 , "2019 , "201D , "300D , "300F
42 }
43 \cs_new_protected:Npn \ctex_make_spa:nn #1#2
44 {
45 \iow_open:Nn \g__ctex_spa_iow {#1}
46 \clist_map_inline:nn {#2}
47 { \__ctex_write_family:nn ##1 }
48 \iow_close:N \g__ctex_spa_iow
49 }
50 \iow_new:N \g__ctex_spa_iow
51 \cs_new_eq:NN \MAKESPA \ctex_make_spa:nn
52 \cs_new_protected:Npn \__ctex_write_family:nn #1#2
53 {
54 \group_begin:
55 \tex_font:D \l__ctex_punct_font = "#2" ~ at ~ 100 pt \scan_stop:
56 \l__ctex_punct_font
57 \clist_clear:N \l__ctex_punct_bounds_clist
58 \seq_map_inline:Nn \c__ctex_punct_seq
59 { \exp_args:No \__ctex_save_bounds:n { \int_use:N \tex_XeTeXcharglyph:D ##1 } }
60 \iow_now:Nx \g__ctex_spa_iow
61 {
62 \token_to_str:N \ctexspadef {#1}
63 { \l__ctex_punct_bounds_clist , , , }
64 }
65 \group_end:
66 }
67 \cs_new_protected:Npn \__ctex_save_bounds:n #1
68 {
69 \clist_put_right:Nx \l__ctex_punct_bounds_clist
70 {
71 \__ctex_calc_bounds:nn { 1 } {#1} ,
72 \__ctex_calc_bounds:nn { 3 } {#1}
73 }
74 }
75 \clist_new:N \l__ctex_punct_bounds_clist
76 \cs_new:Npn \__ctex_calc_bounds:nn #1#2
77 {
78 \fp_eval:n
79 {
80 round
81 (
82 \dim_to_decimal_in_unit:nn
83 { 100 \tex_XeTeXglyphbounds:D #1 ~ #2 }
84 { 1 em }
85 )
86 }
87 }
88 \ExplSyntaxOff
89 %%
90 %%
91 %% End of file `ctex-spa-macro.tex'.