| 1 |
%% |
| 2 |
%% This is file `ctex-engine-pdftex.def', |
| 3 |
%% generated with the docstrip utility. |
| 4 |
%% |
| 5 |
%% The original source files were: |
| 6 |
%% |
| 7 |
%% ctex.dtx (with options: `pdftex') |
| 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 |
{(pdf)LaTeX adapter (CTEX)} |
| 29 |
\ProvidesExplFile{ctex-engine-pdftex.def} |
| 30 |
{\ExplFileDate}{2.5.10}{\ExplFileDescription} |
| 31 |
\cs_new_protected:Npn \ctex_set_zhmap:n |
| 32 |
{ \tl_gput_right:Nx \g__ctex_zhmap_tl } |
| 33 |
\cs_new_protected:Npn \ctex_use_zhmap: |
| 34 |
{ \tl_use:N \g__ctex_zhmap_tl } |
| 35 |
\cs_if_exist:NTF \ctex_gadd_ltxhook:nn |
| 36 |
{ |
| 37 |
\cs_new_protected:Npn \ctex_at_shipout_first:n |
| 38 |
{ \ctex_gadd_ltxhook:nn { shipout/firstpage } } |
| 39 |
\ctex_at_shipout_first:n { \ctex_use_zhmap: } |
| 40 |
} |
| 41 |
{ |
| 42 |
\cs_new_protected:Npn \ctex_add_dvi_zhmap: |
| 43 |
{ \AtBeginDvi { \ctex_use_zhmap: } } |
| 44 |
\ctex_after_end_preamble:n { \ctex_add_dvi_zhmap: } |
| 45 |
\ctex_at_end_package:nn { atbegshi } |
| 46 |
{ |
| 47 |
\cs_new_protected:Npn \ctex_at_shipout_first:n |
| 48 |
{ \AtBeginShipoutFirst } |
| 49 |
\ctex_at_shipout_first:n { \ctex_use_zhmap: } |
| 50 |
\cs_gset_eq:NN \ctex_add_dvi_zhmap: \prg_do_nothing: |
| 51 |
} |
| 52 |
} |
| 53 |
\tl_new:N \g__ctex_zhmap_tl |
| 54 |
\@onlypreamble \ctex_set_zhmap:n |
| 55 |
\seq_const_from_clist:Nn \c__ctex_cmap_encoding_seq |
| 56 |
{ C19 , C10 , C00 , C09 , C40 , C60 } |
| 57 |
\cs_new_protected:Npn \ctex_family_cmap:nn #1#2 |
| 58 |
{ |
| 59 |
\cs_if_free:cF { #1 + #2 } |
| 60 |
{ |
| 61 |
\seq_if_in:NnT \c__ctex_cmap_encoding_seq {#1} |
| 62 |
{ \tl_gput_right:cn { #1 + #2 } { \ctex_add_cmap:n {#1} } } |
| 63 |
} |
| 64 |
} |
| 65 |
\cs_generate_variant:Nn \ctex_family_cmap:nn { ee } |
| 66 |
\cs_new_eq:NN \CTEX@Family@CMap \ctex_family_cmap:ee |
| 67 |
\cs_new_protected:Npn \ctex_add_cmap:n #1 |
| 68 |
{ |
| 69 |
\cs_if_free:NF \CJK@plane |
| 70 |
{ \exp_args:Ne \__ctex_add_cmap_auxi:n { #1 \CJK@plane } } |
| 71 |
} |
| 72 |
\cs_new_protected:Npn \__ctex_add_cmap_auxi:n #1 |
| 73 |
{ \exp_args:Nc \__ctex_add_cmap_auxii:Nn { __ctex_add_cmap_ #1 : } {#1} } |
| 74 |
\cs_new_protected:Npn \__ctex_add_cmap_auxii:Nn #1#2 |
| 75 |
{ |
| 76 |
\cs_if_exist:NF #1 { \__ctex_save_cmap:Nn #1 {#2} } |
| 77 |
#1 |
| 78 |
} |
| 79 |
\cs_new_protected:Npn \__ctex_save_cmap:Nn #1#2 |
| 80 |
{ |
| 81 |
\exp_args:Ne \file_get_full_name:nNTF |
| 82 |
{ \str_lowercase:n {#2} .cmap } \l__ctex_cmap_file_tl |
| 83 |
{ |
| 84 |
\pdf_object_unnamed_write:nx |
| 85 |
{ fstream } |
| 86 |
{ { } { \l__ctex_cmap_file_tl } } |
| 87 |
\cs_new_protected:Npx #1 |
| 88 |
{ |
| 89 |
\pdfnobuiltintounicode \tex_font:D |
| 90 |
\tex_pdffontattr:D \tex_font:D |
| 91 |
{ /ToUnicode ~ \pdf_object_ref_last: } |
| 92 |
} |
| 93 |
} |
| 94 |
{ \cs_new_eq:NN #1 \prg_do_nothing: } |
| 95 |
} |
| 96 |
\tl_new:N \l__ctex_cmap_file_tl |
| 97 |
\sys_if_output_pdf:T |
| 98 |
{ |
| 99 |
\exp_args:Nno \use:n |
| 100 |
{ \cs_gset_protected:Npn \DeclareFontFamily #1#2#3 } |
| 101 |
{ |
| 102 |
\DeclareFontFamily {#1} {#2} {#3} |
| 103 |
\CTEX@Family@CMap {#1} {#2} |
| 104 |
} |
| 105 |
\ctex_at_end_package:nn { cmap } |
| 106 |
{ |
| 107 |
\cs_gset_eq:NN \ctex_add_cmap:n \use_none:n |
| 108 |
\cs_gset_eq:NN \CTEX@Family@CMap \use_none:nn |
| 109 |
} |
| 110 |
} |
| 111 |
\bool_if:NTF \g__ctex_zhmCJK_bool |
| 112 |
{ |
| 113 |
\exp_args:Ne \PassOptionsToPackage |
| 114 |
{ encoding = \g__ctex_encoding_tl } |
| 115 |
{ zhmCJK } |
| 116 |
\RequirePackage { zhmCJK } |
| 117 |
} |
| 118 |
{ |
| 119 |
\str_if_eq:onTF { \g__ctex_encoding_tl } { GBK } |
| 120 |
{ \RequirePackage { CJK } } |
| 121 |
{ \RequirePackage { CJKutf8 } } |
| 122 |
\RequirePackage { CJKpunct , CJKspace } |
| 123 |
\cs_new_protected:Npn \ctex_load_zhmap:nnnn #1#2#3#4 |
| 124 |
{ |
| 125 |
\tl_set:Nn \CJKrmdefault {#1} |
| 126 |
\tl_set:Nn \CJKsfdefault {#2} |
| 127 |
\tl_set:Nn \CJKttdefault {#3} |
| 128 |
\ctex_set_zhmap:n { \ctex_file_input:n { ctex-zhmap- #4 .tex } } |
| 129 |
} |
| 130 |
\@onlypreamble \ctex_load_zhmap:nnnn |
| 131 |
} |
| 132 |
\cs_new_protected:Npn \ctex_undeclare_unicode_character:n #1 |
| 133 |
{ \cs_set_eq:cN { u8 : \ctex_utfviii_char:n {#1} } \tex_undefined:D } |
| 134 |
\cs_new:Npn \ctex_utfviii_char:n #1 |
| 135 |
{ |
| 136 |
\exp_last_unbraced:Ne \__ctex_utfviii_char_aux:nnnn |
| 137 |
{ \char_to_utfviii_bytes:n {#1} } |
| 138 |
} |
| 139 |
\cs_new:Npn \__ctex_utfviii_char_aux:nnnn #1#2#3#4 |
| 140 |
{ |
| 141 |
\char_generate:nn {#1} { 12 } |
| 142 |
\tl_if_empty:nF {#2} { \char_generate:nn {#2} { 12 } } |
| 143 |
\tl_if_empty:nF {#3} { \char_generate:nn {#3} { 12 } } |
| 144 |
\tl_if_empty:nF {#4} { \char_generate:nn {#4} { 12 } } |
| 145 |
} |
| 146 |
\CJKaddEncHook { UTF8 } |
| 147 |
{ |
| 148 |
\ctex_undeclare_unicode_character:n { "3008 } |
| 149 |
\ctex_undeclare_unicode_character:n { "3009 } |
| 150 |
} |
| 151 |
\cs_new_protected:Npn \ctex_CJK_input:n #1 |
| 152 |
{ |
| 153 |
\ctex_push_file: |
| 154 |
\int_set:Nn \tex_endlinechar:D { -1 } |
| 155 |
\file_input:n {#1} |
| 156 |
\ctex_pop_file: |
| 157 |
} |
| 158 |
\cs_set_eq:NN \CJK@input \ctex_CJK_input:n |
| 159 |
\cs_if_free:NF \CJK@surr |
| 160 |
{ |
| 161 |
\cs_new_protected:Npn \ctex_plane_to_utfxvibe:Nn #1#2 |
| 162 |
{ |
| 163 |
\int_set:Nn \l__ctex_tmp_int |
| 164 |
{ \exp_args:Ne \int_from_hex:n {#2} } |
| 165 |
\int_compare:nNnTF \l__ctex_tmp_int < { 256 } |
| 166 |
{ \tl_gset:Nx #1 { \int_to_Hex:n { \l__ctex_tmp_int } } } |
| 167 |
{ |
| 168 |
\int_sub:Nn \l__ctex_tmp_int { 256 } |
| 169 |
\tl_gset:Nx #1 |
| 170 |
{ |
| 171 |
\int_to_Hex:n |
| 172 |
{ \int_div_truncate:nn { \l__ctex_tmp_int } { 4 } + "D800 } |
| 173 |
\int_to_Hex:n |
| 174 |
{ \int_mod:nn { \l__ctex_tmp_int } { 4 } + "DC } |
| 175 |
} |
| 176 |
} |
| 177 |
} |
| 178 |
\cs_set_eq:NN \CJK@surr \ctex_plane_to_utfxvibe:Nn |
| 179 |
} |
| 180 |
\cs_if_free:NF \CJK@addcmap |
| 181 |
{ |
| 182 |
\ctex_patch_cmd:Nnn \CJK@addcmap |
| 183 |
{ \pdffontattr \font@name } |
| 184 |
{ |
| 185 |
\pdfnobuiltintounicode \font@name |
| 186 |
\pdffontattr \font@name |
| 187 |
} |
| 188 |
} |
| 189 |
\AtBeginDocument |
| 190 |
{ |
| 191 |
\use:e |
| 192 |
{ |
| 193 |
\str_if_eq:nnF { \l__ctex_punct_tl } { quanjiao } |
| 194 |
{ \exp_not:N \punctstyle { \l__ctex_punct_tl } } |
| 195 |
} |
| 196 |
} |
| 197 |
\ctex_at_end_preamble:n { \ctex_update_default_family: } |
| 198 |
\bool_if:NF \g__ctex_zhmCJK_bool |
| 199 |
{ |
| 200 |
\str_if_eq:onTF { \g__ctex_encoding_tl } { UTF8 } |
| 201 |
{ \CJK@loadBinding { UTF8 } } |
| 202 |
{ \CJK@loadBinding { standard } } |
| 203 |
\exp_args:Ne \ctex_at_end_preamble:n |
| 204 |
{ |
| 205 |
\exp_not:N \CJK@envStart |
| 206 |
{ } { \g__ctex_encoding_tl } { \exp_not:N \CJKfamilydefault } |
| 207 |
\exp_not:N \CJKtilde |
| 208 |
} |
| 209 |
} |
| 210 |
\cs_new_eq:NN \ctex_auto_ignorespaces: \CJK@@ignorespaces |
| 211 |
\cs_new:Npn \__ctex_char:N #1 |
| 212 |
{ \exp_args:Ne \CTEX@char@n { \int_value:w `#1 } } |
| 213 |
\cs_new:Npn \__ctex_char:NN #1#2 |
| 214 |
{ |
| 215 |
\token_if_eq_meaning:NNTF #2 \protect |
| 216 |
{ \__ctex_char_aux:NN #1 } |
| 217 |
{ \__ctex_char_aux:NN #1#2 } |
| 218 |
} |
| 219 |
\cs_new:Npn \__ctex_char_aux:NN #1#2 |
| 220 |
{ |
| 221 |
\exp_last_unbraced:Ne \CTEX@char@nn |
| 222 |
{ |
| 223 |
{ \int_value:w `#1 } |
| 224 |
{ \int_value:w `#2 } |
| 225 |
} |
| 226 |
} |
| 227 |
\cs_new:Npn \__ctex_char:NNN #1#2#3 |
| 228 |
{ |
| 229 |
\token_if_eq_meaning:NNTF #2 \protect |
| 230 |
{ \__ctex_char_auxi:NNNN #1#3 } |
| 231 |
{ \__ctex_char_auxii:NNN #1#2#3 } |
| 232 |
} |
| 233 |
\cs_new:Npn \__ctex_char_auxi:NNN #1#2#3#4 |
| 234 |
{ \__ctex_char_auxii:NNN #1#2#4 } |
| 235 |
\cs_new:Npn \__ctex_char_auxii:NNN #1#2#3 |
| 236 |
{ |
| 237 |
\exp_last_unbraced:Ne \CTEX@char@nnn |
| 238 |
{ |
| 239 |
{ \int_value:w `#1 } |
| 240 |
{ \int_value:w `#2 } |
| 241 |
{ \int_value:w `#3 } |
| 242 |
} |
| 243 |
} |
| 244 |
\cs_new:Npn \__ctex_char:NNNN #1#2#3#4 |
| 245 |
{ |
| 246 |
\token_if_eq_meaning:NNTF #2 \protect |
| 247 |
{ \__ctex_char_auxi:NNNNN #1#3 } |
| 248 |
{ \__ctex_char_auxii:NNNN #1#2#3#4 } |
| 249 |
} |
| 250 |
\cs_new:Npn \__ctex_char_auxi:NNNNN #1#2#3#4#5 |
| 251 |
{ \__ctex_char_auxii:NNNN #1#2#3#5 } |
| 252 |
\cs_new:Npn \__ctex_char_auxii:NNNN #1#2#3#4 |
| 253 |
{ |
| 254 |
\exp_last_unbraced:Ne \CTEX@char@nnnn |
| 255 |
{ |
| 256 |
{ \int_value:w `#1 } |
| 257 |
{ \int_value:w `#2 } |
| 258 |
{ \int_value:w `#3 } |
| 259 |
{ \int_value:w `#4 } |
| 260 |
} |
| 261 |
} |
| 262 |
\cs_gset_eq:NN \CJK@X \__ctex_char:N |
| 263 |
\cs_gset_eq:NN \CJK@XX \__ctex_char:NN |
| 264 |
\cs_gset_eq:NN \CJK@XXX \__ctex_char:NNN |
| 265 |
\cs_gset_eq:NN \CJK@XXXX \__ctex_char:NNNN |
| 266 |
\str_if_eq:onF { \g__ctex_encoding_tl } { GBK } |
| 267 |
{ |
| 268 |
\exp_args:Nne \use:n |
| 269 |
{ \cs_gset:Npn \__ctex_char_aux:NN #1#2 } |
| 270 |
{ |
| 271 |
\exp_not:N \cs_if_exist_use:cF |
| 272 |
{ u8: \exp_not:N \tl_to_str:n { #1#2 } } |
| 273 |
{ \exp_not:o { \__ctex_char_aux:NN {#1} {#2} } } |
| 274 |
} |
| 275 |
\exp_args:Nne \use:n |
| 276 |
{ \cs_gset:Npn \__ctex_char_auxii:NNN #1#2#3 } |
| 277 |
{ |
| 278 |
\exp_not:N \cs_if_exist_use:cF |
| 279 |
{ u8: \exp_not:N \tl_to_str:n { #1#2#3 } } |
| 280 |
{ \exp_not:o { \__ctex_char_auxii:NNN {#1} {#2} {#3} } } |
| 281 |
} |
| 282 |
} |
| 283 |
\group_begin: |
| 284 |
\char_set_catcode_active:n { "7F } |
| 285 |
\cs_new:Npn \__ctex_char_preproc:w #1 ^^7f #2 ^^7f |
| 286 |
{ \exp_args:No \CTEX@char@nn { \int_value:w `#1 } {#2} } |
| 287 |
\cs_gset_eq:NN \mule@arg \__ctex_char_preproc:w |
| 288 |
\group_end: |
| 289 |
\exp_args:Ne \ctex_at_end:n |
| 290 |
{ |
| 291 |
\char_set_catcode:nn |
| 292 |
{ \int_value:w "7F } |
| 293 |
{ \char_value_catcode:n { "7F } } |
| 294 |
} |
| 295 |
\cs_new_protected:Npn \CTEX@char@n #1 |
| 296 |
{ |
| 297 |
\mode_leave_vertical: |
| 298 |
\use:c { CJK@ #1 } |
| 299 |
\CJK@ignorespaces |
| 300 |
} |
| 301 |
\cs_new_protected:Npn \CTEX@char@nn #1#2 |
| 302 |
{ |
| 303 |
\mode_leave_vertical: |
| 304 |
\use:c { CJK@ #1 } {#2} |
| 305 |
\CJK@ignorespaces |
| 306 |
} |
| 307 |
\cs_new_protected:Npn \CTEX@char@nnn #1#2#3 |
| 308 |
{ |
| 309 |
\mode_leave_vertical: |
| 310 |
\use:c { CJK@ #1 } {#2} {#3} |
| 311 |
\CJK@ignorespaces |
| 312 |
} |
| 313 |
\cs_new_protected:Npn \CTEX@char@nnnn #1#2#3#4 |
| 314 |
{ |
| 315 |
\mode_leave_vertical: |
| 316 |
\use:c { CJK@ #1 } {#2} {#3} {#4} |
| 317 |
\CJK@ignorespaces |
| 318 |
} |
| 319 |
\cs_new_protected:Npn \CTEX@char@nn@n #1 { \CTEX@char@nn #1 } |
| 320 |
\cs_new_protected:Npn \CTEX@char@nnn@n #1 { \CTEX@char@nnn #1 } |
| 321 |
\cs_new_protected:Npn \CTEX@char@nnnn@n #1 { \CTEX@char@nnnn #1 } |
| 322 |
\cs_new:Npn \__ctex_char_wrap:nn #1#2 |
| 323 |
{ \CTEX@char@nn@n { {#1} {#2} } } |
| 324 |
\cs_new:Npn \__ctex_char_wrap:nnn #1#2#3 |
| 325 |
{ \CTEX@char@nnn@n { {#1} {#2} {#3} } } |
| 326 |
\cs_new:Npn \__ctex_char_wrap:nnnn #1#2#3#4 |
| 327 |
{ \CTEX@char@nnnn@n { {#1} {#2} {#3} {#4} } } |
| 328 |
\tl_put_right:Nn \l_text_case_exclude_arg_tl |
| 329 |
{ |
| 330 |
\CTEX@char@n |
| 331 |
\CTEX@char@nn@n |
| 332 |
\CTEX@char@nnn@n |
| 333 |
\CTEX@char@nnnn@n |
| 334 |
} |
| 335 |
\text_declare_expand_equivalent:Nn \CTEX@char@nn { \__ctex_char_wrap:nn } |
| 336 |
\text_declare_expand_equivalent:Nn \CTEX@char@nnn { \__ctex_char_wrap:nnn } |
| 337 |
\text_declare_expand_equivalent:Nn \CTEX@char@nnnn { \__ctex_char_wrap:nnnn } |
| 338 |
\cs_new:Npn \__ctex_char_raw:n #1 |
| 339 |
{ \char_generate:nn {#1} { 12 } } |
| 340 |
\cs_new:Npn \__ctex_char_raw:nn #1#2 |
| 341 |
{ |
| 342 |
\char_generate:nn {#1} { 12 } |
| 343 |
\char_generate:nn {#2} { 12 } |
| 344 |
} |
| 345 |
\cs_new:Npn \__ctex_char_raw:nnn #1#2#3 |
| 346 |
{ |
| 347 |
\char_generate:nn {#1} { 12 } |
| 348 |
\char_generate:nn {#2} { 12 } |
| 349 |
\char_generate:nn {#3} { 12 } |
| 350 |
} |
| 351 |
\cs_new:Npn \__ctex_char_raw:nnnn #1#2#3#4 |
| 352 |
{ |
| 353 |
\char_generate:nn {#1} { 12 } |
| 354 |
\char_generate:nn {#2} { 12 } |
| 355 |
\char_generate:nn {#3} { 12 } |
| 356 |
\char_generate:nn {#4} { 12 } |
| 357 |
} |
| 358 |
\cs_new:Npn \__ctex_char_raw_nn:n #1 { \use:e { \__ctex_char_raw:nn #1 } } |
| 359 |
\cs_new:Npn \__ctex_char_raw_nnn:n #1 { \use:e { \__ctex_char_raw:nnn #1 } } |
| 360 |
\cs_new:Npn \__ctex_char_raw_nnnn:n #1 { \use:e { \__ctex_char_raw:nnnn #1 } } |
| 361 |
\text_declare_purify_equivalent:Nn \CTEX@char@n { \__ctex_char_raw:n } |
| 362 |
\text_declare_purify_equivalent:Nn \CTEX@char@nn@n { \__ctex_char_raw_nn:n } |
| 363 |
\text_declare_purify_equivalent:Nn \CTEX@char@nnn@n { \__ctex_char_raw_nnn:n } |
| 364 |
\text_declare_purify_equivalent:Nn \CTEX@char@nnnn@n { \__ctex_char_raw_nnnn:n } |
| 365 |
\cs_new_protected:Npn \ctex_ignorespaces_case:N #1 |
| 366 |
{ |
| 367 |
\cs_set_protected:Npn \ctex_set_ignorespaces: |
| 368 |
{ \cs_set_eq:NN \CJK@ignorespaces #1 } |
| 369 |
\ctex_set_ignorespaces: |
| 370 |
} |
| 371 |
\cs_new_protected:Npn \ctex_set_ignorespaces: |
| 372 |
{ \cs_set_eq:NN \CJK@ignorespaces \ctex_auto_ignorespaces: } |
| 373 |
\tl_if_exist:NF \CJKhook { \tl_new:N \CJKhook } |
| 374 |
\tl_gput_right:Nn \CJKhook { \ctex_set_ignorespaces: } |
| 375 |
\cs_new_protected:Npn \ctex_punct_set:n #1 |
| 376 |
{ |
| 377 |
\clist_map_inline:Nn \c__ctex_punct_family_clist |
| 378 |
{ |
| 379 |
\cs_if_free:cF { c__ctex_ #1 ##1 _punct_spaces_tl } |
| 380 |
{ |
| 381 |
\cs_set_eq:cc |
| 382 |
{ CJKpunct@ ##1 @spaces } |
| 383 |
{ c__ctex_ #1 ##1 _punct_spaces_tl } |
| 384 |
} |
| 385 |
} |
| 386 |
} |
| 387 |
\clist_const:Nn \c__ctex_punct_family_clist |
| 388 |
{ |
| 389 |
zhsong , zhhei , zhfs , zhkai , zhli , zhyou , |
| 390 |
zhsongb , zhheil , zhheib , zhyoub , |
| 391 |
zhyahei , zhyaheib , zhpf , zhpfb |
| 392 |
} |
| 393 |
\cs_new_protected:Npn \ctex_punct_map_family:nn #1#2 |
| 394 |
{ |
| 395 |
\cs_if_free:cF { CJKpunct@ #2 @spaces } |
| 396 |
{ \cs_set_eq:cc { CJKpunct@ #1 @spaces } { CJKpunct@ #2 @spaces } } |
| 397 |
} |
| 398 |
\cs_new_protected:Npn \ctex_punct_map_bfseries:nn #1#2 |
| 399 |
{ |
| 400 |
\clist_map_inline:nn {#1} |
| 401 |
{ |
| 402 |
\ctex_punct_map_series:nnn { ##1 } { b } {#2} |
| 403 |
\ctex_punct_map_series:nnn { ##1 } { bx } {#2} |
| 404 |
} |
| 405 |
} |
| 406 |
\cs_new_protected:Npn \ctex_punct_map_series:nnn #1#2#3 |
| 407 |
{ |
| 408 |
\CJKpunctmapfamily { C19 } {#1} {#2} { m } {#3} |
| 409 |
\CJKpunctmapfamily { C19 } {#1} {#2} { it } {#3} |
| 410 |
\CJKpunctmapfamily { C19 } {#1} {#2} { sl } {#3} |
| 411 |
\CJKpunctmapfamily { C70 } {#1} {#2} { m } {#3} |
| 412 |
\CJKpunctmapfamily { C70 } {#1} {#2} { it } {#3} |
| 413 |
\CJKpunctmapfamily { C70 } {#1} {#2} { sl } {#3} |
| 414 |
} |
| 415 |
\cs_new_protected:Npn \ctex_punct_map_itshape:nn #1#2 |
| 416 |
{ |
| 417 |
\CJKpunctmapfamily { C19 } {#1} { m } { it } {#2} |
| 418 |
\CJKpunctmapfamily { C19 } {#1} { b } { it } {#2} |
| 419 |
\CJKpunctmapfamily { C19 } {#1} { bx } { it } {#2} |
| 420 |
\CJKpunctmapfamily { C70 } {#1} { m } { it } {#2} |
| 421 |
\CJKpunctmapfamily { C70 } {#1} { b } { it } {#2} |
| 422 |
\CJKpunctmapfamily { C70 } {#1} { bx } { it } {#2} |
| 423 |
} |
| 424 |
\cs_new_protected:Npn \ctex_punct_space:nn #1#2 |
| 425 |
{ \tl_const:cn { c__ctex_ #1 _punct_spaces_tl } {#2} } |
| 426 |
\cs_new_eq:NN \ctexspadef \ctex_punct_space:nn |
| 427 |
\ctex_file_input:n { ctexspa.def } |
| 428 |
\reverse_if:N \if_bool:N \g__ctex_zhmCJK_bool |
| 429 |
\cs_new_protected:Npn \ctex_provide_font_hook:NNN #1#2 |
| 430 |
{ |
| 431 |
\exp_args:Nc \__ctex_provide_font_hook_aux:NNNN |
| 432 |
{ CTEX \cs_to_str:N #2 } #1#2 |
| 433 |
} |
| 434 |
\cs_if_exist:NTF \ctex_gadd_ltxhook:nn |
| 435 |
{ |
| 436 |
\cs_new_protected:Npn \__ctex_provide_font_hook_aux:NNNN #1#2#3#4 |
| 437 |
{ |
| 438 |
\tl_new:N #1 |
| 439 |
\exp_args:Nx \ctex_gadd_ltxhook:nn { \cs_to_str:N #2 } {#1} |
| 440 |
} |
| 441 |
} |
| 442 |
{ |
| 443 |
\cs_new_protected:Npn \__ctex_provide_font_hook_aux:NNNN #1#2#3#4 |
| 444 |
{ |
| 445 |
\tl_new:N #1 |
| 446 |
\cs_if_exist:NTF #3 |
| 447 |
{ \tl_gput_right:Nn #3 {#1} } |
| 448 |
{ \ctex_parse_name:NN \tl_replace_once:Nnn #2 {#4} { #1#4 } } |
| 449 |
} |
| 450 |
} |
| 451 |
\ctex_provide_font_hook:NNN \rmfamily \@rmfamilyhook \selectfont |
| 452 |
\ctex_provide_font_hook:NNN \sffamily \@sffamilyhook \selectfont |
| 453 |
\ctex_provide_font_hook:NNN \ttfamily \@ttfamilyhook \selectfont |
| 454 |
\ctex_provide_font_hook:NNN \normalfont \@defaultfamilyhook \usefont |
| 455 |
\tl_if_exist:NF \CJKfamilydefault |
| 456 |
{ \tl_const:Nn \CJKfamilydefault { \CJKrmdefault } } |
| 457 |
\tl_if_exist:NF \CJKrmdefault { \tl_const:Nn \CJKrmdefault { rm } } |
| 458 |
\tl_if_exist:NF \CJKsfdefault { \tl_const:Nn \CJKsfdefault { sf } } |
| 459 |
\tl_if_exist:NF \CJKttdefault { \tl_const:Nn \CJKttdefault { tt } } |
| 460 |
\tl_gput_right:Nn \CTEX@rmfamilyhook { \CJKfamily { \CJKrmdefault } } |
| 461 |
\tl_gput_right:Nn \CTEX@sffamilyhook { \CJKfamily { \CJKsfdefault } } |
| 462 |
\tl_gput_right:Nn \CTEX@ttfamilyhook { \CJKfamily { \CJKttdefault } } |
| 463 |
\tl_gput_right:Nn \CTEX@defaultfamilyhook { \CJKfamily { \CJKfamilydefault } } |
| 464 |
\fi: |
| 465 |
\normalfont |
| 466 |
\cs_new_protected:Npn \ctex_update_default_family: |
| 467 |
{ |
| 468 |
\tl_if_eq:NNT \CJKfamilydefault \l__ctex_family_default_init_tl |
| 469 |
{ |
| 470 |
\group_begin: |
| 471 |
\cs_set_eq:NN \__ctex_family_default_wrap:n \exp_not:n |
| 472 |
\tl_gset:Nx \CJKfamilydefault |
| 473 |
{ |
| 474 |
\str_case:onF { \familydefault } |
| 475 |
{ |
| 476 |
{ \rmdefault } { \exp_not:N \CJKrmdefault } |
| 477 |
{ \sfdefault } { \exp_not:N \CJKsfdefault } |
| 478 |
{ \ttdefault } { \exp_not:N \CJKttdefault } |
| 479 |
} |
| 480 |
{ \CJKfamilydefault } |
| 481 |
} |
| 482 |
\group_end: |
| 483 |
} |
| 484 |
} |
| 485 |
\tl_new:N \l__ctex_family_default_init_tl |
| 486 |
\cs_new_eq:NN \__ctex_family_default_wrap:n \use:n |
| 487 |
\tl_set:Nx \l__ctex_family_default_init_tl |
| 488 |
{ |
| 489 |
\exp_not:N \__ctex_family_default_wrap:n |
| 490 |
{ \exp_not:o { \CJKfamilydefault } } |
| 491 |
} |
| 492 |
\tl_gset_eq:NN \CJKfamilydefault \l__ctex_family_default_init_tl |
| 493 |
\ctex_hypersetup:n { driverfallback = dvipdfmx } |
| 494 |
\str_if_eq:onTF { \g__ctex_encoding_tl } { GBK } |
| 495 |
{ |
| 496 |
\ctex_hypersetup:n { CJKbookmarks = true } |
| 497 |
\sys_if_output_pdf:TF |
| 498 |
{ \ctex_at_end_package:nn { hyperref } { \RequirePackage { xCJK2uni } } } |
| 499 |
{ |
| 500 |
\ctex_hypersetup:n { pdfencoding = pdfdoc } |
| 501 |
\ctex_at_end_package:nn { hyperref } |
| 502 |
{ |
| 503 |
\str_if_eq:onTF { \Hy@driver } { hdvipdfm } |
| 504 |
{ |
| 505 |
\ctex_at_shipout_first:n |
| 506 |
{ \special { pdf:tounicode~GBK-EUC-UCS2 } } |
| 507 |
} |
| 508 |
{ \RequirePackage { xCJK2uni } } |
| 509 |
} |
| 510 |
} |
| 511 |
} |
| 512 |
{ \ctex_hypersetup:n { pdfencoding = unicode } } |
| 513 |
\ctex_at_end_package:nn { CJKfntef } |
| 514 |
{ |
| 515 |
\normalem |
| 516 |
\cs_new_protected:Npn \__ctex_clear_fntef_color:n #1 |
| 517 |
{ \tl_clear:c { CJK#1color } } |
| 518 |
\clist_map_inline:nn |
| 519 |
{ underdot , underline , underdblline , underwave , sout , xout } |
| 520 |
{ \__ctex_clear_fntef_color:n {#1} } |
| 521 |
} |
| 522 |
\cs_new_protected:Npn \ctex_update_ccwd: |
| 523 |
{ |
| 524 |
\hbox_set:Nn \l__ctex_tmp_box { \CJKglue } |
| 525 |
\dim_set:Nn \ccwd { \box_wd:N \l__ctex_tmp_box + \f@size \p@ } |
| 526 |
} |
| 527 |
\dim_new:N \ccwd |
| 528 |
\cs_new_protected:Npn \ctex_update_ccglue: |
| 529 |
{ |
| 530 |
\cs_set_protected:Npn \CJKglue |
| 531 |
{ \skip_horizontal:N \l__ctex_ccglue_skip } |
| 532 |
} |
| 533 |
\skip_new:N \l__ctex_ccglue_skip |
| 534 |
\prg_new_conditional:Npnn \ctex_if_ccglue_touched: { TF } |
| 535 |
{ |
| 536 |
\if_meaning:w \CJKglue \__ctex_ccglue: |
| 537 |
\prg_return_false: \else: \prg_return_true: \fi: |
| 538 |
} |
| 539 |
\ctex_at_end:n { \cs_new_eq:NN \__ctex_ccglue: \CJKglue } |
| 540 |
\cs_new_protected:Npn \ctex_update_em_unit: |
| 541 |
{ \dim_set:Nn \ccwd { \f@size \p@ } } |
| 542 |
\cs_new_protected:Npn \ctex_add_to_selectfont:n #1 |
| 543 |
{ |
| 544 |
\cs_set_protected:Npx \CTEX@selectfont@hook |
| 545 |
{ \exp_not:o { \CTEX@selectfont@hook #1 } } |
| 546 |
} |
| 547 |
\cs_new_eq:NN \CTEX@selectfont@hook \prg_do_nothing: |
| 548 |
\bool_if:NTF \c__ctex_everysel_loaded_bool |
| 549 |
{ |
| 550 |
\cs_if_free:NF \@EverySelectfont@Init |
| 551 |
{ |
| 552 |
\group_begin: |
| 553 |
\cs_set:Npn \__ctex_tmp:N #1 |
| 554 |
{ |
| 555 |
\tl_set:Nn \l__ctex_tmp_tl {#1} |
| 556 |
\cs_new_eq:NN \CTEX@selectfont@save #1 |
| 557 |
\cs_new_protected:Npn \__ctex_restore_selectfont: |
| 558 |
{ |
| 559 |
\cs_if_free:NF \scr@new@selectfont |
| 560 |
{ |
| 561 |
\cs_if_free:NF \par@update |
| 562 |
{ \tl_put_right:Nn #1 { \par@update } } |
| 563 |
\cs_set_eq:NN \scr@selectfont \CTEX@selectfont@save |
| 564 |
\cs_set_eq:NN \scr@new@selectfont #1 |
| 565 |
} |
| 566 |
\tl_put_left:Nn \@EverySelectfont@Init |
| 567 |
{ \cs_set_eq:NN #1 \CTEX@selectfont@save } |
| 568 |
\cs_undefine:N \__ctex_restore_selectfont: |
| 569 |
} |
| 570 |
} |
| 571 |
\ctex_parse_name:NN \__ctex_tmp:N \selectfont |
| 572 |
\exp_last_unbraced:NNo \group_end: |
| 573 |
\ctex_patch_cmd_once:NnnnTF { \l__ctex_tmp_tl } |
| 574 |
{ \ExplSyntaxOff } |
| 575 |
{ \size@update } |
| 576 |
{ \CTEX@selectfont@hook \size@update } |
| 577 |
{ \__ctex_restore_selectfont: } |
| 578 |
{ \ctex_patch_failure:N \selectfont } |
| 579 |
} |
| 580 |
\cs_new_protected:Npn \ctex_gadd_selectfont_hook:n |
| 581 |
{ \EverySelectfont } |
| 582 |
} |
| 583 |
{ |
| 584 |
\cs_new_protected:Npn \ctex_gadd_selectfont_hook:n |
| 585 |
{ \ctex_gadd_ltxhook:nn { selectfont } } |
| 586 |
} |
| 587 |
\ctex_gadd_selectfont_hook:n |
| 588 |
{ \cs_if_exist:NF \CJK@plane { \CTEX@selectfont@hook } } |
| 589 |
\ctex_define:n |
| 590 |
{ |
| 591 |
space .choice: , |
| 592 |
space / true .code:n = |
| 593 |
{ \ctex_ignorespaces_case:N \prg_do_nothing: } , |
| 594 |
space / auto .code:n = |
| 595 |
{ \ctex_ignorespaces_case:N \ctex_auto_ignorespaces: } , |
| 596 |
space / false .code:n = |
| 597 |
{ \ctex_ignorespaces_case:N \tex_ignorespaces:D } , |
| 598 |
space .default:n = { true } , |
| 599 |
space .initial:n = { auto } |
| 600 |
} |
| 601 |
\ctex_define:n |
| 602 |
{ |
| 603 |
punct .code:n = |
| 604 |
{ |
| 605 |
\tl_set:Nx \l__ctex_punct_tl {#1} |
| 606 |
\punctstyle { \l__ctex_punct_tl } |
| 607 |
} , |
| 608 |
punct .default:n = { quanjiao } , |
| 609 |
} |
| 610 |
%% |
| 611 |
%% |
| 612 |
%% End of file `ctex-engine-pdftex.def'. |