diff options
author | Karl Berry <karl@freefriends.org> | 2020-05-02 22:24:14 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2020-05-02 22:24:14 +0000 |
commit | 15f0c94913f0d5cb24dd909c5358b3a997994dd7 (patch) | |
tree | 9043df32cd0199835f5b3f9804ad132907857139 /Master/texmf-dist/tex/latex/ctex/engine/ctex-engine-pdftex.def | |
parent | 151fbc4b66cb3705f6ce20368a2c6f7c06b8d57d (diff) |
ctex (2may20)
git-svn-id: svn://tug.org/texlive/trunk@54976 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/ctex/engine/ctex-engine-pdftex.def')
-rw-r--r-- | Master/texmf-dist/tex/latex/ctex/engine/ctex-engine-pdftex.def | 188 |
1 files changed, 70 insertions, 118 deletions
diff --git a/Master/texmf-dist/tex/latex/ctex/engine/ctex-engine-pdftex.def b/Master/texmf-dist/tex/latex/ctex/engine/ctex-engine-pdftex.def index 04b47108953..e447c91fff9 100644 --- a/Master/texmf-dist/tex/latex/ctex/engine/ctex-engine-pdftex.def +++ b/Master/texmf-dist/tex/latex/ctex/engine/ctex-engine-pdftex.def @@ -6,9 +6,9 @@ %% %% ctex.dtx (with options: `pdftex') %% -%% Copyright (C) 2003--2019 +%% Copyright (C) 2003--2020 %% CTEX.ORG and any individual authors listed in the documentation. -%% ------------------------------------------------------------------------------ +%% --------------------------------------------------------------------- %% %% This work may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either @@ -20,26 +20,31 @@ %% and version 1.3 or later is part of all distributions of %% LaTeX version 2005/12/01 or later. %% -%% This work has the LPPL maintenance status `maintained'. +%% This work has the LPPL maintenance status "maintained". %% -%% The Current Maintainers of this work are Leo Liu, Qing Lee and Liam Huang. +%% --------------------------------------------------------------------- %% -%% ------------------------------------------------------------------------------ -%% -\GetIdInfo$Id: ctex.dtx 735dfe2 2019-05-29 21:42:29 +0800 Qing Lee <sobenlee@gmail.com> $ +\GetIdInfo$Id: ctex.dtx 320df30 2020-05-02 06:45:05 +0800 Qing Lee <sobenlee@gmail.com> $ {(pdf)LaTeX adapter (CTEX)} \ProvidesExplFile{ctex-engine-pdftex.def} - {\ExplFileDate}{2.4.16}{\ExplFileDescription} -\cs_new_protected_nopar:Npn \ctex_set_zhmap:n #1 + {\ExplFileDate}{2.5.1}{\ExplFileDescription} +\cs_new_protected:Npn \ctex_set_zhmap:n + { \tl_gput_right:Nx \g__ctex_zhmap_tl } +\cs_new_protected:Npn \ctex_use_zhmap: + { \tl_use:N \g__ctex_zhmap_tl } +\cs_new_protected:Npn \ctex_add_dvi_zhmap: + { \AtBeginDvi { \ctex_use_zhmap: } } +\ctex_after_end_preamble:n { \ctex_add_dvi_zhmap: } +\ctex_at_end_package:nn { atbegshi } { - \AtBeginDvi {#1} - \ctex_at_end_package:nn { atbegshi } - { \AtBeginShipoutFirst {#1} } + \AtBeginShipoutFirst { \ctex_use_zhmap: } + \cs_gset_eq:NN \ctex_add_dvi_zhmap: \prg_do_nothing: } +\tl_new:N \g__ctex_zhmap_tl \@onlypreamble \ctex_set_zhmap:n \seq_const_from_clist:Nn \c__ctex_cmap_encoding_seq { C19 , C10 , C00 , C09 , C40 , C60 } -\cs_new_protected_nopar:Npn \ctex_family_cmap:nn #1#2 +\cs_new_protected:Npn \ctex_family_cmap:nn #1#2 { \cs_if_free:cF { #1 + #2 } { @@ -49,22 +54,22 @@ } \cs_generate_variant:Nn \ctex_family_cmap:nn { x } \cs_new_eq:NN \CTEX@Family@CMap \ctex_family_cmap:xn -\cs_new_protected_nopar:Npn \ctex_add_cmap:n #1 +\cs_new_protected:Npn \ctex_add_cmap:n #1 { \cs_if_free:NF \CJK@plane { \ctex_add_cmap:cn { __ctex_add_cmap_ #1 \CJK@plane : } {#1} } } -\cs_new_protected_nopar:Npn \ctex_add_cmap:Nn #1#2 +\cs_new_protected:Npn \ctex_add_cmap:Nn #1#2 { \cs_if_exist:NF #1 { \__ctex_save_cmap:Nn #1 {#2} } #1 } \cs_generate_variant:Nn \ctex_add_cmap:Nn { c } -\cs_new_protected_nopar:Npn \__ctex_save_cmap:Nn #1#2 +\cs_new_protected:Npn \__ctex_save_cmap:Nn #1#2 { - \tl_set:Nx \l__ctex_tmp_tl { \str_lower_case:n {#2} \CJK@plane } + \tl_set:Nx \l__ctex_tmp_tl { \str_lowercase:n {#2} \CJK@plane } \tex_immediate:D \tex_pdfobj:D stream ~ file { \l__ctex_tmp_tl .cmap } - \cs_new_protected_nopar:Npx #1 + \cs_new_protected:Npx #1 { \exp_not:N \tex_pdffontattr:D \exp_not:N \tex_font:D { /ToUnicode ~ \int_use:N \tex_pdflastobj:D \c_space_tl 0 ~ R } @@ -85,14 +90,14 @@ } { \group_end: } \if_bool:N \g__ctex_zhmCJK_bool - \PassOptionsToPackage { encoding = \l__ctex_encoding_tl } { zhmCJK } + \PassOptionsToPackage { encoding = \g__ctex_encoding_tl } { zhmCJK } \RequirePackage { zhmCJK } \else: - \str_if_eq:onTF { \l__ctex_encoding_tl } { GBK } + \str_if_eq:onTF { \g__ctex_encoding_tl } { GBK } { \RequirePackage { CJK } } { \RequirePackage { CJKutf8 } } \RequirePackage { CJKpunct , CJKspace } - \cs_new_protected_nopar:Npn \ctex_load_zhmap:nnnn #1#2#3#4 + \cs_new_protected:Npn \ctex_load_zhmap:nnnn #1#2#3#4 { \tl_set:Nn \CJKrmdefault {#1} \tl_set:Nn \CJKsfdefault {#2} @@ -100,7 +105,7 @@ \ctex_set_zhmap:n { \ctex_zhmap_input:n {#4} } } \@onlypreamble \ctex_load_zhmap:nnnn - \cs_new_protected_nopar:Npn \ctex_zhmap_input:n #1 + \cs_new_protected:Npn \ctex_zhmap_input:n #1 { \ctex_file_wrapper:nnn { @@ -118,24 +123,12 @@ \tl_if_exist:NF \CJKrmdefault { \tl_new:N \CJKrmdefault } \tl_if_exist:NF \CJKsfdefault { \tl_new:N \CJKsfdefault } \tl_if_exist:NF \CJKttdefault { \tl_new:N \CJKttdefault } - \ctex_preto_cmd:NnnTF \rmfamily { \ExplSyntaxOff } - { \CJKfamily { \CJKrmdefault } } - { } - { \ctex_patch_failure:N \rmfamily } - \ctex_preto_cmd:NnnTF \sffamily { \ExplSyntaxOff } - { \CJKfamily { \CJKsfdefault } } - { } - { \ctex_patch_failure:N \sffamily } - \ctex_preto_cmd:NnnTF \ttfamily { \ExplSyntaxOff } - { \CJKfamily { \CJKttdefault } } - { } - { \ctex_patch_failure:N \ttfamily } - \ctex_preto_cmd:NnnTF \normalfont { \ExplSyntaxOff } - { \CJKfamily { \CJKfamilydefault } } - { \cs_set_eq:NN \reset@font \normalfont } - { \ctex_patch_failure:N \normalfont } + \g@addto@macro \@rmfamilyhook { \CJKfamily { \CJKrmdefault } } + \g@addto@macro \@sffamilyhook { \CJKfamily { \CJKsfdefault } } + \g@addto@macro \@ttfamilyhook { \CJKfamily { \CJKttdefault } } + \g@addto@macro \@defaultfamilyhook { \CJKfamily { \CJKfamilydefault } } \fi: -\cs_new_protected_nopar:Npn \ctex_CJK_input:n #1 +\cs_new_protected:Npn \ctex_CJK_input:n #1 { \ctex_file_wrapper:nnn { @@ -152,7 +145,7 @@ } \cs_set_eq:NN \CJK@input \ctex_CJK_input:n \if_cs_exist:N \CJK@surr - \cs_new_protected_nopar:Npn \ctex_plane_to_utfxvibe:Nn #1#2 + \cs_new_protected:Npn \ctex_plane_to_utfxvibe:Nn #1#2 { \tl_set:Nx \l__ctex_tmp_tl {#2} \int_set:Nn \l__ctex_tmp_int @@ -179,7 +172,7 @@ } \ctex_at_end_preamble:n { \ctex_update_default_family: } \reverse_if:N \if_bool:N \g__ctex_zhmCJK_bool - \str_if_eq:onF { \l__ctex_encoding_tl } { UTF8 } + \str_if_eq:onF { \g__ctex_encoding_tl } { UTF8 } { \CJK@makeActive \CJK@loadBinding { standard } @@ -187,21 +180,21 @@ \exp_args:Nx \ctex_at_end_preamble:n { \exp_not:N \CJK@envStart - { } { \l__ctex_encoding_tl } { \exp_not:N \CJKfamilydefault } + { } { \g__ctex_encoding_tl } { \exp_not:N \CJKfamilydefault } \exp_not:N \CJKtilde } \fi: \cs_new_eq:NN \ctex_auto_ignorespaces: \CJK@@ignorespaces -\cs_new_protected_nopar:Npn \ctex_ignorespaces_case:N #1 +\cs_new_protected:Npn \ctex_ignorespaces_case:N #1 { - \cs_set_protected_nopar:Npn \ctex_set_ignorespaces: + \cs_set_protected:Npn \ctex_set_ignorespaces: { \cs_set_eq:NN \CJK@ignorespaces #1 } \ctex_set_ignorespaces: } -\cs_new_protected_nopar:Npn \ctex_set_ignorespaces: +\cs_new_protected:Npn \ctex_set_ignorespaces: { \cs_set_eq:NN \CJK@ignorespaces \ctex_auto_ignorespaces: } \ctex_gadd_hook:Nn \CJKhook { \ctex_set_ignorespaces: } -\cs_new_protected_nopar:Npn \ctex_punct_set:n #1 +\cs_new_protected:Npn \ctex_punct_set:n #1 { \clist_map_inline:Nn \c__ctex_punct_family_clist { @@ -218,12 +211,12 @@ zhsong , zhhei , zhfs , zhkai , zhli , zhyou , zhsongb , zhheil , zhheib , zhyoub , zhyahei , zhyaheib } -\cs_new_protected_nopar:Npn \ctex_punct_map_family:nn #1#2 +\cs_new_protected:Npn \ctex_punct_map_family:nn #1#2 { \cs_if_free:cF { CJKpunct@ #2 @spaces } { \cs_set_eq:cc { CJKpunct@ #1 @spaces } { CJKpunct@ #2 @spaces } } } -\cs_new_protected_nopar:Npn \ctex_punct_map_bfseries:nn #1#2 +\cs_new_protected:Npn \ctex_punct_map_bfseries:nn #1#2 { \clist_map_inline:nn {#1} { @@ -231,7 +224,7 @@ \ctex_punct_map_series:nnn { ##1 } { bx } {#2} } } -\cs_new_protected_nopar:Npn \ctex_punct_map_series:nnn #1#2#3 +\cs_new_protected:Npn \ctex_punct_map_series:nnn #1#2#3 { \CJKpunctmapfamily { C19 } {#1} {#2} { m } {#3} \CJKpunctmapfamily { C19 } {#1} {#2} { it } {#3} @@ -240,7 +233,7 @@ \CJKpunctmapfamily { C70 } {#1} {#2} { it } {#3} \CJKpunctmapfamily { C70 } {#1} {#2} { sl } {#3} } -\cs_new_protected_nopar:Npn \ctex_punct_map_itshape:nn #1#2 +\cs_new_protected:Npn \ctex_punct_map_itshape:nn #1#2 { \CJKpunctmapfamily { C19 } {#1} { m } { it } {#2} \CJKpunctmapfamily { C19 } {#1} { b } { it } {#2} @@ -249,11 +242,11 @@ \CJKpunctmapfamily { C70 } {#1} { b } { it } {#2} \CJKpunctmapfamily { C70 } {#1} { bx } { it } {#2} } -\cs_new_protected_nopar:Npn \ctex_punct_space:nn #1#2 +\cs_new_protected:Npn \ctex_punct_space:nn #1#2 { \tl_const:cn { c__ctex_ #1 _punct_spaces_tl } {#2} } \cs_new_eq:NN \ctexspadef \ctex_punct_space:nn \ctex_file_input:n { ctexspa.def } -\cs_new_protected_nopar:Npn \ctex_update_default_family: +\cs_new_protected:Npn \ctex_update_default_family: { \tl_if_eq:NNT \CJKfamilydefault \l__ctex_family_default_init_tl { @@ -280,31 +273,8 @@ { \exp_not:o { \CJKfamilydefault } } } \tl_gset_eq:NN \CJKfamilydefault \l__ctex_family_default_init_tl -\cs_new_protected_nopar:Npn \ctex_detected_platform: - { - \file_if_exist:nTF { /dev/null } - { - \file_if_exist:nTF { nul: } - { - \file_if_exist:nTF { \c__ctex_upper_case_file_str } - { \ctex_if_macosx:TF { mac } { windows } } - { \ctex_if_macosx:TF { mac } { fandol } } - } - { \ctex_if_macosx:TF { mac } { fandol } } - } - { \tl_gset:Nn \g__ctex_fontset_tl { windows } } - } -\str_const:Nx \c__ctex_upper_case_file_str - { \exp_args:No \str_upper_case:n { \g_file_curr_name_str } } -\cs_new_protected_nopar:Npn \ctex_if_macosx:TF #1#2 - { - \file_if_exist:nTF { \c__ctex_macosx_file_str } - { \tl_gset:Nn \g__ctex_fontset_tl {#1} } - { \tl_gset:Nn \g__ctex_fontset_tl {#2} } - } -\str_const:Nn \c__ctex_macosx_file_str { /Library/Fonts/Songti.ttc } \ctex_hypersetup:n { driverfallback = dvipdfmx } -\str_if_eq:onTF { \l__ctex_encoding_tl } { GBK } +\str_if_eq:onTF { \g__ctex_encoding_tl } { GBK } { \ctex_hypersetup:n { CJKbookmarks = true } \sys_if_output_pdf:TF @@ -322,49 +292,24 @@ } } { \ctex_hypersetup:n { pdfencoding = unicode } } -\RequirePackage { CJKfntef } -\normalem -\cs_new_protected_nopar:Npn \__ctex_clear_fntef_color:n #1 - { \tl_clear:c { CJK#1color } } -\clist_map_inline:nn - { underdot , underline , underdblline , underwave , sout , xout } +\ctex_at_end_package:nn { CJKfntef } { - \__ctex_clear_fntef_color:n {#1} - \cs_new_protected_nopar:cpx { CTEX#1 } - { - \msg_warning:nnnn { ctex } { deprecated-command } { \exp_not:c { CTEX#1 } } - { You~ can~ use~ the~ command~ with~ prefix~ \exp_not:N \CJK~ instead. } - \exp_not:c { CJK#1 } - } - } -\cs_new_protected_nopar:Npn { \CTEXfilltwosides } - { - \msg_warning:nnnn { ctex } { deprecated-environment } { CTEXfilltwosides } - { You~ can~ use~ `CJKfilltwosides'~ environment~ instead. } - \CJKfilltwosides - } -\cs_new_protected_nopar:Npn { \endCTEXfilltwosides } { \endCJKfilltwosides } -\clist_map_inline:nn - { - underdotbasesep , underdotsep , underlinebasesep , - underlinesep , underdbllinesep , underdbllinebasesep , - underwavebasesep , underwavesep , southeight , - underdotcolor , underwavecolor , underlinecolor , - underdbllinecolor , soutcolor , xoutcolor + \normalem + \cs_new_protected:Npn \__ctex_clear_fntef_color:n #1 + { \tl_clear:c { CJK#1color } } + \clist_map_inline:nn + { underdot , underline , underdblline , underwave , sout , xout } + { \__ctex_clear_fntef_color:n {#1} } } - { - \cs_new_eq:cc { CTEX#1 } { CJK#1 } - \cs_set_nopar:cpx { CJK#1 } { \exp_not:c { CTEX#1 } } - } -\cs_new_protected_nopar:Npn \ctex_update_ccwd: +\cs_new_protected:Npn \ctex_update_ccwd: { \hbox_set:Nn \l__ctex_tmp_box { \CJKglue } \dim_set:Nn \ccwd { \box_wd:N \l__ctex_tmp_box + \f@size \p@ } } \dim_new:N \ccwd -\cs_new_protected_nopar:Npn \ctex_update_ccglue: +\cs_new_protected:Npn \ctex_update_ccglue: { - \cs_set_protected_nopar:Npn \CJKglue + \cs_set_protected:Npn \CJKglue { \skip_horizontal:N \l__ctex_ccglue_skip } } \skip_new:N \l__ctex_ccglue_skip @@ -374,11 +319,11 @@ \prg_return_false: \else: \prg_return_true: \fi: } \ctex_at_end:n { \cs_new_eq:NN \__ctex_ccglue: \CJKglue } -\cs_new_protected_nopar:Npn \ctex_update_em_unit: +\cs_new_protected:Npn \ctex_update_em_unit: { \dim_set:Nn \ccwd { \f@size \p@ } } \cs_new_protected:Npn \ctex_add_to_selectfont:n #1 { - \cs_set_protected_nopar:Npx \CTEX@selectfont@hook + \cs_set_protected:Npx \CTEX@selectfont@hook { \exp_not:o { \CTEX@selectfont@hook #1 } } } \cs_new_eq:NN \CTEX@selectfont@hook \prg_do_nothing: @@ -388,10 +333,17 @@ { \tl_set:Nn \l__ctex_tmp_tl {#1} \cs_new_eq:NN \CTEX@selectfont@save #1 - \cs_new_protected_nopar:Npn \__ctex_restore_selectfont: + \cs_new_protected:Npn \__ctex_restore_selectfont: { + \cs_if_free:NF \scr@new@selectfont + { + \cs_if_free:NF \par@update + { \tl_put_right:Nn #1 { \par@update } } + \cs_set_eq:NN \scr@selectfont \CTEX@selectfont@save + \cs_set_eq:NN \scr@new@selectfont #1 + } \tl_put_left:Nn \@EverySelectfont@Init - { \let #1 \CTEX@selectfont@save } + { \cs_set_eq:NN #1 \CTEX@selectfont@save } \cs_undefine:N \__ctex_restore_selectfont: } } @@ -405,7 +357,7 @@ { \ctex_patch_failure:N \selectfont } \fi: \EverySelectfont { \cs_if_exist:NF \CJK@plane { \CTEX@selectfont@hook } } -\keys_define:nn { ctex } +\ctex_define:n { space .choice: , space / true .code:n = @@ -417,11 +369,11 @@ space .default:n = { true } , space .initial:n = { auto } } -\keys_define:nn { ctex } +\ctex_define:n { punct .code:n = { - \tl_set:Nx \l__ctex_punct_tl { #1 } + \tl_set:Nx \l__ctex_punct_tl {#1} \punctstyle { \l__ctex_punct_tl } } , punct .default:n = { quanjiao } , |