diff options
author | Karl Berry <karl@freefriends.org> | 2015-05-14 21:23:11 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2015-05-14 21:23:11 +0000 |
commit | 9591c0c57b007ba49f15f0970009bc27efa23db4 (patch) | |
tree | 4ef2076432f70e69f1d944b127898e217b269ae6 /Master/texmf-dist/tex/latex/ctex/engine | |
parent | 99d7ad5df8ac48132b622ee369d7493853592a61 (diff) |
ctex (14may15)
git-svn-id: svn://tug.org/texlive/trunk@37393 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/ctex/engine')
7 files changed, 1543 insertions, 242 deletions
diff --git a/Master/texmf-dist/tex/latex/ctex/engine/ctex-cct-engine.def b/Master/texmf-dist/tex/latex/ctex/engine/ctex-cct-engine.def deleted file mode 100644 index cd54033ed97..00000000000 --- a/Master/texmf-dist/tex/latex/ctex/engine/ctex-cct-engine.def +++ /dev/null @@ -1,82 +0,0 @@ -% ctex-cct-engine.def: for LaTeX engine with CCT -% vim:ft=tex - -\ifCTEX@cctfont - \RequirePackage{cctbase}[2003/04/05] -\else - \RequirePackage[CJK]{cctbase}[2003/04/05] -\fi -\ifCTEX@punct - \CCTpuncttrue -\else - \CCTpunctfalse -\fi -\ifCTEX@fntef - \RequirePackage{CCTfntef} - \normalem -\fi -\ifCTEX@space - \AtBeginDocument{\CCTspace} -\else - \AtBeginDocument{\CCTnospace} -\fi -\def\CTEXspace{\CCTspace} -\def\CTEXnospace{\CCTnospace} -\ifCTEX@cctfont\else - \CCTdefziti A song song % 宋体 - \CCTdefziti B hei song % 黑体 - \CCTdefziti C kai song % 楷体 - \CCTdefziti D fs song % 仿宋 - \CCTdefziti E bs hei % 标宋 - \CCTdefziti F li hei % 隶书 - \CCTdefziti G you kai % 幼圆 - \DeclareRobustCommand*{\songti}{\ziti{A}\relax} % 宋体 - \DeclareRobustCommand*{\heiti}{\ziti{B}\relax} % 黑体 - \DeclareRobustCommand*{\kaishu}{\ziti{C}\relax} % 楷书 - \DeclareRobustCommand*{\fangsong}{\ziti{D}\relax} % 仿宋 - \DeclareRobustCommand*{\biaosong}{\ziti{E}\relax} % 标宋 - \DeclareRobustCommand*{\lishu}{\ziti{F}\relax} % 隶书 - \DeclareRobustCommand*{\youyuan}{\ziti{G}\relax} % 幼圆 -\fi -\ifx\CCT@set@fontsize\undefined - \let\CCT@set@fontsize\oset@fontsize -\fi -\let\CTEX@save@set@fontsize\set@fontsize -\def\set@fontsize#1#2#3{% - \CCT@set@fontsize{#1}{#2}{#3}% - \zihaoAny{#2}% - \CTEXsetfont} -\let\CTEX@save@ziju\ziju -\renewcommand*\ziju[1]{% 字距 - \CTEX@save@ziju{#1}% - \CTEXsetfont} -\newcommand*\CTEXsetfont{% - \ifdim\parindent=0pt\else\parindent2\ccwd\fi} -\ifCTEX@fntef - \def\CTEXunderdot{\CCTunderdot} - \def\CTEXunderline{\CCTunderline} - \def\CTEXunderdblline{\CCTunderdblline} - \def\CTEXunderwave{\CCTunderwave} - \def\CTEXsout{\CCTsout} - \def\CTEXxout{\CCTxout} - \def\CTEXfilltwosides{\CCTfilltwosides} - \def\endCTEXfilltwosides{\endCCTfilltwosides} - \CTEX@replacecommand{CTEX}{CCT}{underdotbasesep} - \CTEX@replacecommand{CTEX}{CCT}{underdotsep} - \CTEX@replacecommand{CTEX}{CCT}{underlinebasesep} - \CTEX@replacecommand{CTEX}{CCT}{underlinesep} - \CTEX@replacecommand{CTEX}{CCT}{underdbllinebasesep} - \CTEX@replacecommand{CTEX}{CCT}{underdbllinesep} - \CTEX@replacecommand{CTEX}{CCT}{underwavebasesep} - \CTEX@replacecommand{CTEX}{CCT}{underwavesepa} - \CTEX@replacecommand{CTEX}{CCT}{underwavesep} - \CTEX@replacecommand{CTEX}{CCT}{southeight} - \CTEX@replacecommand{CTEX}{CCT}{xoutheight} - \CTEX@replacecommand{CTEX}{CCT}{underdotcolor} - \CTEX@replacecommand{CTEX}{CCT}{underwavecolor} - \CTEX@replacecommand{CTEX}{CCT}{underlinecolor} - \CTEX@replacecommand{CTEX}{CCT}{underdbllinecolor} - \CTEX@replacecommand{CTEX}{CCT}{soutcolor} - \CTEX@replacecommand{CTEX}{CCT}{xoutcolor} -\fi -\endinput diff --git a/Master/texmf-dist/tex/latex/ctex/engine/ctex-cjk-common.def b/Master/texmf-dist/tex/latex/ctex/engine/ctex-cjk-common.def deleted file mode 100644 index ad641c45ecf..00000000000 --- a/Master/texmf-dist/tex/latex/ctex/engine/ctex-cjk-common.def +++ /dev/null @@ -1,57 +0,0 @@ -% ctex-cjk-common.def: common definitions shared by cjk-engine and xecjk-engine -% vim:ft=tex - -\ifCTEX@fntef - \RequirePackage{CJKfntef} - \normalem -\fi - -\def\CTEXspace{\CJKspace} -\def\CTEXnospace{\CJKnospace} - -\let\CTEX@save@set@fontsize\set@fontsize -\def\set@fontsize#1#2#3{% - \CTEX@save@set@fontsize{#1}{#2}{#3}% - \CTEXsetfont} -\newcommand*\ziju[1]{% 字距 - \begingroup - \settowidth\@tempdima{\CTEX@spaceChar}% - \expandafter\endgroup% - \expandafter\renewcommand% - \expandafter\CJKglue% - \expandafter{\expandafter\hskip\the\dimexpr#1\@tempdima\relax\@plus.08\baselineskip\relax}% - \CTEXsetfont} % is it a good definition? -\newdimen\ccwd % 字宽 -\newcommand*\CTEXsetfont{% - \begingroup - \settowidth\ccwd{\CTEX@spaceChar\CJKglue}% - \expandafter\endgroup\expandafter\ccwd\the\ccwd\relax - \unless\ifdim\parindent=\z@\parindent2\ccwd\fi} -\def\CTEX@spaceChar{\hskip \f@size \p@\relax} -\ifCTEX@fntef - \def\CTEXunderdot{\CJKunderdot} - \def\CTEXunderline{\CJKunderline} - \def\CTEXunderdblline{\CJKunderdblline} - \def\CTEXunderwave{\CJKunderwave} - \def\CTEXsout{\CJKsout} - \def\CTEXxout{\CJKxout} - \def\CTEXfilltwosides{\CJKfilltwosides} - \def\endCTEXfilltwosides{\endCJKfilltwosides} - \CTEX@replacecommand{CTEX}{CJK}{underdotbasesep} - \CTEX@replacecommand{CTEX}{CJK}{underdotsep} - \CTEX@replacecommand{CTEX}{CJK}{underlinebasesep} - \CTEX@replacecommand{CTEX}{CJK}{underlinesep} - \CTEX@replacecommand{CTEX}{CJK}{underdbllinebasesep} - \CTEX@replacecommand{CTEX}{CJK}{underdbllinesep} - \CTEX@replacecommand{CTEX}{CJK}{underwavebasesep} - \CTEX@replacecommand{CTEX}{CJK}{underwavesep} - \CTEX@replacecommand{CTEX}{CJK}{southeight} - \CTEX@replacecommand{CTEX}{CJK}{underdotcolor} - \CTEX@replacecommand{CTEX}{CJK}{underwavecolor} - \CTEX@replacecommand{CTEX}{CJK}{underlinecolor} - \CTEX@replacecommand{CTEX}{CJK}{underdbllinecolor} - \CTEX@replacecommand{CTEX}{CJK}{soutcolor} - \CTEX@replacecommand{CTEX}{CJK}{xoutcolor} -\fi - -\endinput diff --git a/Master/texmf-dist/tex/latex/ctex/engine/ctex-cjk-engine.def b/Master/texmf-dist/tex/latex/ctex/engine/ctex-cjk-engine.def deleted file mode 100644 index 05634b7663b..00000000000 --- a/Master/texmf-dist/tex/latex/ctex/engine/ctex-cjk-engine.def +++ /dev/null @@ -1,66 +0,0 @@ -% ctex-cjk-engine.def: for LaTeX engine with CJK -% vim:ft=tex - -\ifCTEX@GBK - \RequirePackage{CJK}[2003/03/28] -\else - \RequirePackage{CJKutf8}[2003/03/28] -\fi - -\ifCTEX@punct - \RequirePackage{CJKpunct}[2009/05/06] -\fi - -\AtEndOfPackage{\CJK@makeActive} - -\ifCTEX@space - \ifCTEX@GBK - \def\CTEX@beginCJK{\begin{CJK}{GBK}{rm}} - \else - \def\CTEX@beginCJK{\begin{CJK}{UTF8}{rm}} - \fi - \def\CTEX@endCJK{\clearpage\end{CJK}} -\else - \ifCTEX@GBK - \def\CTEX@beginCJK{\begin{CJK*}{GBK}{rm}\CJKtilde} - \else - \def\CTEX@beginCJK{\begin{CJK*}{UTF8}{rm}\CJKtilde} - \fi - \def\CTEX@endCJK{\clearpage\end{CJK*}} -\fi - -\let\CTEX@begindocumenthook\@begindocumenthook -\let\CTEX@enddocumenthook\@enddocumenthook -\def\AtBeginDocument{\g@addto@macro\CTEX@begindocumenthook} -\def\AtEndDocument{\g@addto@macro\CTEX@enddocumenthook} -\def\@begindocumenthook{\CTEX@begindocumenthook\CTEX@beginCJK} -\def\@enddocumenthook{\CTEX@endCJK\CTEX@enddocumenthook} - -\input{ctex-cjk-common.def} - -\providecommand*\CTEX@rm@family{} -\providecommand*\CTEX@sf@family{} -\providecommand*\CTEX@tt@family{} - -\ifCTEX@nofonts - \renewcommand*\CTEX@rm@family{gbsn} - \renewcommand*\CTEX@sf@family{gbsn} - \renewcommand*\CTEX@tt@family{gbsn} -\else - \ifCTEX@winfonts - \input{ctex-cjk-winfonts.def} - \else\ifCTEX@adobefonts - \input{ctex-cjk-adobefonts.def} - \fi\fi -\fi - -\let\CTEX@save@rmfamily\rmfamily -\renewcommand*\rmfamily{\CTEX@save@rmfamily\CJKfamily{\CTEX@rm@family}} -\let\CTEX@save@sffamily\sffamily -\renewcommand*\sffamily{\CTEX@save@sffamily\CJKfamily{\CTEX@sf@family}} -\let\CTEX@save@ttfamily\ttfamily -\renewcommand*\ttfamily{\CTEX@save@ttfamily\CJKfamily{\CTEX@tt@family}} -\let\CTEX@save@normalfont\normalfont -\renewcommand*\normalfont{\CTEX@save@normalfont\CJKfamily{\CTEX@rm@family}} - -\endinput diff --git a/Master/texmf-dist/tex/latex/ctex/engine/ctex-engine-luatex.def b/Master/texmf-dist/tex/latex/ctex/engine/ctex-engine-luatex.def new file mode 100644 index 00000000000..c4756ab29fc --- /dev/null +++ b/Master/texmf-dist/tex/latex/ctex/engine/ctex-engine-luatex.def @@ -0,0 +1,1047 @@ +%% +%% This is file `ctex-engine-luatex.def', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% ctex.dtx (with options: `luatex') +%% +%% Copyright (C) 2003--2015 +%% 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 +%% version 1.3c of this license or (at your option) any later +%% version. This version of this license is in +%% http://www.latex-project.org/lppl/lppl-1-3c.txt +%% and the latest version of this license is in +%% http://www.latex-project.org/lppl.txt +%% 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'. +%% +%% The Current Maintainers of this work are Leo Liu, Qing Lee and Liam Huang. +%% +%% ------------------------------------------------------------------------------ +%% +\GetIdInfo$Id: ctex.dtx 3d246c0 2015-05-11 23:20:45 +0800 Qing Lee <sobenlee@gmail.com> $ + {LuaLaTeX adapter (CTEX)} +\ProvidesExplFile{ctex-engine-luatex.def} + {\ExplFileDate}{2.0}{\ExplFileDescription} +\msg_new:nnn { ctex } { luatexja-loaded } + { + Package~`luatexja'~can~not~be~loaded~before~`ctex'.\\ + Loading~file~`#1'~will~abort! + } +\@ifpackageloaded { luatexja } + { \msg_critical:nnx { ctex } { luatexja-loaded } { \g_file_current_name_tl } } + { \tl_const:cn { ver@ltj-latex.\@pkgextension } { 9999/99/99 } } +\RequirePackage { luatexja } +\@ifpackagelater { luatexja-core } { 2015/02/22 } { } + { \msg_error:nnn { ctex } { package-too-old } { luatexja } } +\RequirePackage { fontspec } +\@ifpackagelater { fontspec } { 2014/05/25 } { } + { \msg_error:nnn { ctex } { package-too-old } { fontspec } } +\ExplSyntaxOff +\ltjdefcharrange{1}{"80-"36F, "1E00-"1EFF} +\ltjdefcharrange{2}{"370-"4FF, "1F00-"1FFF} +\ltjdefcharrange{3}{% + "2000-"243F, "2500-"27BF, "2900-"29FF, "2B00-"2BFF} +\ltjdefcharrange{4}{% + "500-"10FF, "1200-"1DFF, "2440-"245F, "27C0-"28FF, "2A00-"2AFF, + "2C00-"2E7F, "4DC0-"4DFF, "A4D0-"A82F, "A840-"ABFF, "FB00-"FE0F, + "FE20-"FE2F, "FE70-"FEFF, "10000-"1FFFF, "E000-"F8FF} % non-Japanese +\ltjdefcharrange{5}{"D800-"DFFF, "E0000-"E00FF, "E01F0-"10FFFF} +\ltjdefcharrange{6}{% + "2460-"24FF, "2E80-"2EFF, "3000-"30FF, "3190-"319F, "31F0-"4DBF, + "4E00-"9FFF, "F900-"FAFF, "FE10-"FE6F, "20000-"2FFFF, "E0100-"E01EF} +\ltjdefcharrange{7}{ + "1100-"11FF, "2F00-"2FFF, "3100-"31EF, "A000-"A4CF, "A830-"A83F, + "AC00-"D7FF} +\ltjdefcharrange{8}{"A7, "A8, "B0, "B1, "B4, "B6, "D7, "F7} +\ltjsetparameter{jacharrange={-1, +2, +3, -4, -5, +6, +7, +8}} +\directlua{for x=128,255 do luatexja.math.is_math_letters[x] = true end} +\directlua{ + local s = kpse.find_file('ltj-kinsoku.lua', 'tex') + luatexja.stack.charprop_stack_table[0] = s and dofile(s) or {} +} +\ltjsetparameter{kanjiskip=\z@ plus .4pt minus .4pt, + xkanjiskip=.25\zw plus 1pt minus 1pt, + autospacing, autoxspacing, jacharrange={-1}, + yalbaselineshift=\z@, yjabaselineshift=\z@, + jcharwidowpenalty=500, differentjfm=paverage +} +\ExplSyntaxOn +\RequirePackage { xunicode-addon } +\AtBeginUTFCommand + { + \group_begin: + \ctex_lua_now_x:n { tex.globaldefs = 0 } + \ltj@allalchar + } +\AtEndUTFCommand { \group_end: } +\RequirePackage { lltjp-fontspec } +\group_begin: +\char_set_catcode_other:n { \c_zero } +\cs_new_protected:Npn \__ctex_ltj_um_char:Nw #1 = #2 \q_nil + { + \group_begin: + \char_set_lccode:nn { \c_zero } {#2} + \tex_lowercase:D + { + \group_end: + \cs_gset_protected_nopar:Npn #1 + { + \mode_if_math:TF { ^^@ } + { { + \ctex_lua_now_x:n { tex.globaldefs = 0 } + \ltj@allalchar ^^@ + } } + } + } + \ltjsetmathletter {#2} + } +\group_end: +\ctex_at_end_package:nn { unicode-math } + { + \cs_if_free:NF \um_cs_set_eq_active_char:Nw + { \cs_set_eq:NN \um_cs_set_eq_active_char:Nw \__ctex_ltj_um_char:Nw } + } +\ctex_at_end_package:nn { listings } + { + \use:x + { + \exp_not:N \RequirePackage { lltjp-listings } + \tl_set:Nn \exp_not:N \lstlistingname + { \exp_not:o { \lstlistingname } } + \tl_set:Nn \exp_not:N \lstlistlistingname + { \exp_not:o { \lstlistlistingname } } + } + } +\cs_new_protected_nopar:Npn \ctex_ltj_select_font: + { + \cs_if_exist_use:cF { \l__ctex_ltj_current_font_tl } + { \tl_if_empty:NF \CJK@family { \__ctex_ltj_select_font_aux: } } + } +\tl_new:N \CJK@family +\tl_new:N \l__ctex_ltj_current_font_tl +\tl_set:Nn \l__ctex_ltj_current_font_tl + { \CJK@encoding / \CJK@family / \f@series / \f@shape / \f@size } +\cs_new_protected_nopar:Npn \__ctex_ltj_select_font_aux: + { + \group_begin: + \tl_set_eq:NN \f@encoding \CJK@encoding + \tl_set_eq:NN \f@family \CJK@family + \__ctex_ltj_push_fontname:n { \use:c { \curr@fontshape / \f@size } } + \ctex_ltj_pickup_font: + \group_end: + \font@name + \__ctex_ltj_pop_fontname: + \cs_if_exist:cF { \l__ctex_ltj_current_font_tl } + { \__ctex_ltj_select_font_aux: } + } +\cs_new_protected_nopar:Npn \__ctex_ltj_push_fontname:n #1 + { + \cs_gset_eq:NN \__ctex_ltj_save_fontname:w \font@name + \cs_gset_nopar:Npx \font@name {#1} + } +\cs_new_protected_nopar:Npn \__ctex_ltj_pop_fontname: + { \cs_gset_eq:NN \font@name \__ctex_ltj_save_fontname:w } +\cs_new_protected_nopar:Npn \ctex_ltj_pickup_font: + { + \exp_after:wN \cs_if_exist:NF \font@name + { + \group_begin: + \cs_set_eq:NN \extract@font \ctex_ltj_extract_font: + \cs_set_eq:NN \do@subst@correction \ctex_ltj_subst_font: + \define@newfont + \group_end: + } + } +\cs_new_eq:NN \pickup@jfont \ctex_ltj_pickup_font: +\cs_new_protected_nopar:Npn \ctex_ltj_extract_font: + { + \get@external@font + \ctex_ltj_if_alternate_shape_exist:nT { \curr@fontshape } + { + \tl_set:Nx \external@font + { \exp_after:wN \__ctex_ltj_patch_external_font:w \external@font } + } + \exp_after:wN \globaljfont \font@name \external@font \scan_stop: + \font@name + \ctex_lua_now_x:n { font.current(tex.attribute['ltj@curjfnt']) } + \use:c { \f@encoding + \f@family } + \use:c { \curr@fontshape } + } +\cs_new_protected_nopar:Npn \ctex_ltj_subst_font: + { + \ctex_ltj_if_alternate_shape_exist:nF { \curr@fontshape } + { + \group_begin: + \tl_set_eq:NN \CJK@family \f@family + \cs_if_exist:cF { \l__ctex_ltj_current_font_tl } + { + \cs_gset_protected_nopar:Npx \subst@correction + { + \cs_new_eq:NN + \exp_not:c { \l__ctex_ltj_current_font_tl } + \font@name + } + \group_insert_after:N \group_insert_after:N + \group_insert_after:N \subst@correction + } + \group_end: + } + } +\prg_new_conditional:Npnn \ctex_ltj_if_alternate_shape_exist:n #1 { T , F , TF } + { + \ctex_lua_now_x:n { luatexja.jfont.does_alt_set ('\luatexluaescapestring {#1}') } + \prg_return_true: \else: \prg_return_false: \fi: + } +\cs_new_nopar:Npn \__ctex_ltj_patch_external_font:w #1 ~ at + { #1 \ctex_lua_now_x:n { luatexja.jfont.print_aftl_address() } ~ at } +\cs_new_protected_nopar:Npn \ctex_ltj_select_alternate_font: + { + \ctex_ltj_if_alternate_shape_exist:nT { \l__ctex_ltj_current_shape_tl } + { + \ctex_lua_now_x:n + { + luatexja.jfont.output_alt_font_cmd + ('y', '\luatexluaescapestring { \l__ctex_ltj_current_shape_tl }') + } + \ctex_lua_now_x:n { luatexja.jfont.pickup_alt_font_a ('\f@size') } + } + } +\tl_new:N \l__ctex_ltj_current_shape_tl +\tl_set:Nn \l__ctex_ltj_current_shape_tl + { \CJK@encoding / \CJK@family / \f@series / \f@shape } +\cs_new_protected_nopar:Npn \ltj@pickup@altfont@auxy #1 + { + \cs_if_exist:cF { #1/\f@size } + { + \group_begin: + \use:x { \exp_not:N \split@name #1 / \f@size } \@nil + \__ctex_ltj_push_fontname:n { \use:c { \curr@fontshape / \f@size } } + \ctex_ltj_pickup_font: + \group_end: + \__ctex_ltj_pop_fontname: + } + } +\cs_new_protected_nopar:Npn \ltj@pickup@altfont@copy #1#2 + { + \ltj@@getjfontnumber #1 + \ctex_lua_now_x:n + { + luatexja.jfont.pickup_alt_font_b + ( \the\ltj@tempcntc, '\luatexluaescapestring {#2}' ) + } + } +\ExplSyntaxOff +\def\ltj@@IsFontJapanese#1{% + \directlua{luatexja.jfont.is_kenc(string.match( + '\luatexluaescapestring{#1}', '[^/]+'))}} +{\catcode`M=12% +\gdef\ltj@@mathJapaneseFonts#1M#2#3\relax{\ltj@@IsFontJapanese{#3}}} +\let\ltj@@al@getanddefine@fonts=\getanddefine@fonts +\def\ltj@@ja@getanddefine@fonts#1#2{% + \xdef\font@name{\csname \string#2/\tf@size\endcsname}% + \pickup@jfont\let\textfont@name\font@name + \xdef\font@name{\csname \string#2/\sf@size\endcsname}% + \pickup@jfont\let\scriptfont@name\font@name + \xdef\font@name{\csname \string#2/\ssf@size\endcsname}% + \pickup@jfont + \edef\math@fonts{\math@fonts\ltj@setpar@global% + \ltj@@set@stackfont#1,\textfont@name:{MJT}% + \ltj@@set@stackfont#1,\scriptfont@name:{MJS}% + \ltj@@set@stackfont#1,\font@name:{MJSS}% + }% +} +\def\getanddefine@fonts#1#2{% + \ltj@tempcnta=#1\ltj@@IsFontJapanese{\string#2}% + \ifin@\let\ltj@temp=\ltj@@ja@getanddefine@fonts% + \else \let\ltj@temp=\ltj@@al@getanddefine@fonts\fi + \ltj@temp{#1}{#2}% +} +\def\use@mathgroup#1#2{\relax\ifmmode + \math@bgroup + \expandafter\ifx\csname M@\f@encoding\endcsname#1\else + #1\fi\ltj@tempcnta=#2 \expandafter\ltj@@mathJapaneseFonts\string#1\relax% + \ifin@\jfam#2\relax\else\mathgroup#2\relax\fi + \expandafter\math@egroup\fi}% +\let\@@italiccorr=\/ +\ExplSyntaxOn +\cs_new_protected_nopar:Npn \ctex_mono_jfm:n #1 + { + \str_if_eq:nnTF {#1} { plain } + { \tl_set:Nn \l__ctex_ltj_jfm_tl { mono } } + { \tl_set:Nn \l__ctex_ltj_jfm_tl {#1} } + } +\tl_new:N \l__ctex_ltj_jfm_tl +\cs_generate_variant:Nn \ctex_mono_jfm:n { o } +\ctex_mono_jfm:o { \l__ctex_punct_tl } +\tl_const:Nn \CJK@encoding { LTJY3 } +\DeclareFontEncoding { \CJK@encoding } { } { } +\DeclareFontSubstitution { LTJY3 } { song } { \mddefault } { \updefault } +\ctex_lua_now_x:n { luatexja.jfont.add_kyenc_list('\CJK@encoding') } +\cs_new_protected_nopar:Npn \__ctex_ltj_change_encoding: + { \tl_set_eq:NN \g_fontspec_encoding_tl \CJK@encoding } +\DeclareFontFamily { \CJK@encoding } { song } { } +\DeclareFontShape { \CJK@encoding } { song } { \mddefault } { \updefault } + { <-> psft:SimSun:cid=Adobe-GB1-5;jfm=\l__ctex_ltj_jfm_tl } { } +\DeclareFontShape { \CJK@encoding } { song } { \bfdefault } { \updefault } + { <-> psft:SimHei:cid=Adobe-GB1-5;jfm=\l__ctex_ltj_jfm_tl } { } +\tl_const:Nn \c__ctex_ltj_math_tl { CJKmath } +\DeclareSymbolFont { \c__ctex_ltj_math_tl } + { \CJK@encoding } { song } { \mddefault } { \updefault } +\SetSymbolFont { \c__ctex_ltj_math_tl } { bold } + { \CJK@encoding } { song } { \bfdefault } { \updefault } +\int_const:Nn \c__ctex_ltj_math_fam_int { \use:c { sym \c__ctex_ltj_math_tl } } +\jfam \c__ctex_ltj_math_fam_int +\newfontfeature { CID } { cid = #1 } +\newfontfeature { JFM } { jfm = #1 } +\newfontfeature { JFM-var } { jfmvar = #1 } +\keys_define:nn { fontspec-preparse-external } + { + NoEmbed .code:n = + { \cs_set_eq:NN \__fontspec_namewrap:n \__ctex_ltj_noembed_wrap:n } + } +\cs_new:Npn \__ctex_ltj_noembed_wrap:n #1 { psft: #1 } +\cs_new_protected:Npn \ctex_ltj_set_family:nnn #1#2#3 + { + \group_begin: + \clist_clear:N \l__ctex_ltj_char_range_clist + \seq_clear:N \l__ctex_ltj_alternate_seq + \tl_set:Nn \l__ctex_ltj_base_CJKfamily_tl {#1} + \keys_set_known:nnN { ctex_ltj / fontspec } {#2} \l__ctex_ltj_tmp_tl + \clist_set:No \l__ctex_ltj_font_options_clist { \l__ctex_ltj_tmp_tl } + \ctex_ltj_set_alternate_family:nnF {#1} {#3} + { + \prop_gput:Nnn \g__ctex_ltj_family_font_name_prop {#1} {#3} + \prop_gput:Nno \g__ctex_ltj_family_font_options_prop + {#1} { \l__ctex_ltj_font_options_clist } + \__ctex_ltj_update_family_uid:N \l__ctex_ltj_font_options_clist + \__ctex_ltj_use_global_options:N \l__ctex_ltj_font_options_clist + \__ctex_ltj_gset_family_cs:nn {#1} {#3} + } + \group_end: + } +\cs_new_protected:Npn \ctex_ltj_set_family:xxx #1#2#3 + { \use:x { \ctex_ltj_set_family:nnn {#1} {#2} {#3} } } +\tl_new:N \l__ctex_ltj_base_CJKfamily_tl +\clist_new:N \l__ctex_ltj_font_options_clist +\cs_new_protected_nopar:Npn \__ctex_ltj_use_global_options:N #1 + { + \clist_concat:NNN #1 \g__ctex_ltj_default_features_clist #1 + \clist_put_left:Nx #1 { JFM = \l__ctex_ltj_jfm_tl } + } +\prop_new:N \g__ctex_ltj_family_name_prop +\prop_new:N \g__ctex_ltj_family_font_name_prop +\prop_new:N \g__ctex_ltj_family_font_options_prop +\cs_new_protected_nopar:Npn \__ctex_ltj_check_family:n #1 + { + \prop_gpop:NnNT \g__ctex_ltj_family_font_name_prop {#1} \l__ctex_ltj_tmp_tl + { + \cs_undefine:c { \__ctex_ltj_family_csname:n {#1} } + \cs_undefine:c { \__ctex_ltj_alternate_cs:n {#1} } + \prop_gpop:NnNT \g__ctex_ltj_family_name_prop {#1} \l__ctex_ltj_base_family_tl + { + \use:c { \__ctex_ltj_alternate_cs:n { clear / #1 } } + \cs_undefine:c { \__ctex_ltj_alternate_cs:n { clear / #1 } } + \cs_undefine:c { \__ctex_ltj_alternate_cs:n { reset / #1 } } + \prop_gremove:Nn \g__ctex_ltj_reset_alternate_prop {#1} + } + \msg_warning:nnxx { ctex } { redefine-family } {#1} { \l__ctex_ltj_tmp_tl } + } + } +\tl_new:N \l__ctex_ltj_tmp_tl +\msg_new:nnn { ctex } { redefine-family } + { Redefining~CJKfamily~`\__ctex_ltj_msg_family_map:n {#1}'~(#2). } +\cs_new_protected_nopar:Npn \__ctex_ltj_gset_family_cs:nn #1#2 + { + \cs_gset_protected_nopar:cpx { \__ctex_ltj_family_csname:n {#1} } + { + \group_begin: + \__ctex_ltj_change_encoding: + \exp_not:n { \cs_set_eq:NN \CJKfamily \use_none:n } + \exp_not:n { \fontspec_set_family:Nnn \g__ctex_ltj_fontspec_family_tl } + { \exp_not:o { \l__ctex_ltj_font_options_clist } } {#2} + \prop_gput:Nno \exp_not:N \g__ctex_ltj_family_name_prop {#1} + { \exp_not:N \g__ctex_ltj_fontspec_family_tl } + \tl_gset_eq:NN \exp_not:N \g__ctex_ltj_fontspec_family_tl + \exp_not:N \g__ctex_ltj_fontspec_family_tl + \__ctex_ltj_set_alternate_family:n {#1} + \group_end: + } + } +\tl_new:N \l__ctex_ltj_base_family_tl +\tl_new:N \g__ctex_ltj_fontspec_family_tl +\cs_new_nopar:Npn \__ctex_ltj_family_csname:n #1 { ctex_ltj/family/#1 } +\cs_new_protected_nopar:Npn \__ctex_ltj_set_alternate_family:n #1 + { + \tl_set:Nn \l__ctex_ltj_base_CJKfamily_tl {#1} + \tl_set_eq:NN \l__ctex_ltj_base_family_tl \g__ctex_ltj_fontspec_family_tl + \cs_if_exist_use:c { \__ctex_ltj_alternate_cs:n { reset / #1 } } + \cs_if_exist_use:c { \__ctex_ltj_alternate_cs:n {#1} } + } +\cs_new:Npn \__ctex_ltj_alternate_cs:n #1 { ctex_ltj/alternate_family/#1 } +\NewDocumentCommand \CJKfamily { m } + { \ctex_ltj_switch_family:x {#1} \tex_ignorespaces:D } +\cs_new_protected_nopar:Npn \ctex_ltj_switch_family:n #1 + { + \ctex_ltj_family_if_exist:xNTF {#1} \CJK@family + { + \tl_set:Nn \l_ctex_ltj_family_tl {#1} + \selectfont + } + { \__ctex_ltj_family_unknown_warning:n {#1} } + } +\tl_new:N \l_ctex_ltj_family_tl +\cs_generate_variant:Nn \ctex_ltj_switch_family:n { x } +\prg_new_protected_conditional:Npnn \ctex_ltj_family_if_exist:xN #1#2 { T , F , TF } + { + \prop_get:NxNTF \g__ctex_ltj_family_name_prop {#1} #2 + { \prg_return_true: } + { + \cs_if_exist_use:cTF { \__ctex_ltj_family_csname:n {#1} } + { + \tl_set_eq:NN #2 \g__ctex_ltj_fontspec_family_tl + \prg_return_true: + } + { \prg_return_false: } + } + } +\cs_generate_variant:Nn \prop_get:NnNTF { Nx } +\cs_new_protected_nopar:Npn \__ctex_ltj_family_unknown_warning:n #1 + { + \prop_if_empty:NF \g__ctex_ltj_family_font_name_prop + { + \seq_if_in:NnF \g__ctex_ltj_unknown_family_seq {#1} + { + \seq_gput_right:Nn \g__ctex_ltj_unknown_family_seq {#1} + \msg_warning:nnn { ctex } { family-unknown } {#1} + } + } + } +\seq_new:N \g__ctex_ltj_unknown_family_seq +\msg_new:nnn { ctex } { family-unknown } + { + Unknown~CJK~family~`\__ctex_ltj_msg_family_map:n {#1}'~is~being~ignored.\\ + Try~to~use~`\__ctex_ltj_msg_def_family_map:n {#1}'~to~define~it. + } +\cs_new_nopar:Npn \__ctex_ltj_msg_def_family_map:n #1 + { + \str_case_x:nnF {#1} + { + \CJKrmdefault { \token_to_str:N \setCJKmainfont } + \CJKsfdefault { \token_to_str:N \setCJKsansfont } + \CJKttdefault { \token_to_str:N \setCJKmonofont } + } + { \token_to_str:N \setCJKfamilyfont \{ #1 \} } + [...]\{...\} + } +\cs_new_nopar:Npn \__ctex_ltj_msg_family_map:n #1 + { + \str_case_x:nnF {#1} + { + \CJKrmdefault { \token_to_str:N \CJKrmdefault } + \CJKsfdefault { \token_to_str:N \CJKsfdefault } + \CJKttdefault { \token_to_str:N \CJKttdefault } + } + {#1} + } +\cs_new_protected_nopar:Npn \ctex_ltj_fontspec:nn #1#2 + { + \prop_get:NnNTF \g__ctex_ltj_fontspec_prop + { CJKfontspec/#1/#2/id } \l_ctex_ltj_family_tl + { \ctex_ltj_switch_family:x { \l_ctex_ltj_family_tl } } + { + \int_gincr:N \g__ctex_ltj_family_int + \__ctex_ltj_fontspec:xnn + { CJKfontspec ( \int_use:N \g__ctex_ltj_family_int ) } + {#1} {#2} + } + } +\cs_new_protected_nopar:Npn \ctex_ltj_fontspec:xx #1#2 + { \use:x { \ctex_ltj_fontspec:nn {#1} {#2} } } +\cs_new_protected_nopar:Npn \__ctex_ltj_fontspec:nnn #1#2#3 + { + \bool_if:NT \l__ctex_ltj_add_alternate_bool + { + \cs_if_free:cF + { \__ctex_ltj_alternate_cs:n { reset / \l_ctex_ltj_family_tl } } + { + \cs_gset_eq:cc + { \__ctex_ltj_alternate_cs:n { reset / #1 } } + { \__ctex_ltj_alternate_cs:n { reset / \l_ctex_ltj_family_tl } } + \cs_gset_eq:cc + { \__ctex_ltj_alternate_cs:n { clear / #1 } } + { \__ctex_ltj_alternate_cs:n { clear / \l_ctex_ltj_family_tl } } + } + \bool_set_false:N \l__ctex_ltj_add_alternate_bool + } + \prop_gput:Nnn \g__ctex_ltj_fontspec_prop { CJKfontspec/#2/#3/id } {#1} + \ctex_ltj_set_family:nnn {#1} {#2} {#3} + \ctex_ltj_switch_family:n {#1} + } +\cs_generate_variant:Nn \__ctex_ltj_fontspec:nnn { x } +\prop_new:N \g__ctex_ltj_fontspec_prop +\cs_new_protected_nopar:Npn \ctex_ltj_add_font_features:n #1 + { \ctex_ltj_add_font_features:xn { \l_ctex_ltj_family_tl } {#1} } +\cs_new_protected_nopar:Npn \ctex_ltj_add_font_features:nn #1#2 + { + \prop_get:NnNTF \g__ctex_ltj_family_font_name_prop + {#1} \l__ctex_ltj_tmp_tl + { + \prop_get:NnN \g__ctex_ltj_family_font_options_prop + {#1} \l__ctex_ltj_font_options_clist + \clist_put_right:Nn \l__ctex_ltj_font_options_clist {#2} + \bool_set_true:N \l__ctex_ltj_add_alternate_bool + \ctex_ltj_fontspec:xx + { \exp_not:o { \l__ctex_ltj_font_options_clist } } + { \exp_not:o { \l__ctex_ltj_tmp_tl } } + } + { \msg_warning:nn { ctex } { addCJKfontfeature-ignored } } + } +\bool_new:N \l__ctex_ltj_add_alternate_bool +\cs_generate_variant:Nn \ctex_ltj_add_font_features:n { x } +\cs_generate_variant:Nn \ctex_ltj_add_font_features:nn { x } +\msg_new:nnn { ctex } { addCJKfontfeature-ignored } + { + \token_to_str:N \addCJKfontfeature (s)~ignored.\\ + It~cannot~be~used~with~a~font~that~wasn't~selected~by~ctex. + } +\NewDocumentCommand \setCJKfamilyfont { m O { } m } + { \ctex_ltj_set_family:xxx {#1} {#2} {#3} } +\NewDocumentCommand \newCJKfontfamily { o m O { } m } + { + \tl_set:Nx \l__ctex_ltj_tmp_tl + { \IfNoValueTF {#1} { \cs_to_str:N #2 } {#1} } + \cs_new_protected_nopar:Npx #2 + { \ctex_ltj_switch_family:n { \l__ctex_ltj_tmp_tl } } + \ctex_ltj_set_family:xxx { \l__ctex_ltj_tmp_tl } {#3} {#4} + } +\NewDocumentCommand \CJKfontspec { O { } m } + { + \ctex_ltj_fontspec:xx {#1} {#2} + \tex_ignorespaces:D + } +\NewDocumentCommand \addCJKfontfeatures { m } + { + \ctex_ltj_add_font_features:x {#1} + \tex_ignorespaces:D + } +\cs_new_eq:NN \addCJKfontfeature \addCJKfontfeatures +\NewDocumentCommand \setCJKmainfont { O { } m } + { + \ctex_ltj_set_family:xxx { \CJKrmdefault } {#1} {#2} + \normalfont + } +\cs_new_eq:NN \setCJKromanfont \setCJKmainfont +\NewDocumentCommand \setCJKsansfont { O { } m } + { + \ctex_ltj_set_family:xxx { \CJKsfdefault } {#1} {#2} + \normalfont + } +\NewDocumentCommand \setCJKmonofont { O { } m } + { + \ctex_ltj_set_family:xxx { \CJKttdefault } {#1} {#2} + \normalfont + } +\NewDocumentCommand \setCJKmathfont { O { } m } + { \ctex_ltj_set_family:xxx { \c__ctex_ltj_math_tl } {#1} {#2} } +\NewDocumentCommand \defaultCJKfontfeatures { m } + { \clist_gset:Nn \g__ctex_ltj_default_features_clist {#1} } +\clist_new:N \g__ctex_ltj_default_features_clist +\@onlypreamble \setCJKmainfont +\@onlypreamble \setCJKsansfont +\@onlypreamble \setCJKmonofont +\@onlypreamble \setCJKmathfont +\@onlypreamble \setCJKromanfont +\@onlypreamble \defaultCJKfontfeatures +\tl_if_exist:NF \CJKfamilydefault + { \tl_const:Nn \CJKfamilydefault { \CJKrmdefault } } +\tl_if_exist:NF \CJKrmdefault { \tl_const:Nn \CJKrmdefault { rm } } +\tl_if_exist:NF \CJKsfdefault { \tl_const:Nn \CJKsfdefault { sf } } +\tl_if_exist:NF \CJKttdefault { \tl_const:Nn \CJKttdefault { tt } } +\ctex_preto_cmd:NnTF \rmfamily { \CJKfamily { \CJKrmdefault } } { } + { \ctex_patch_failure:N \rmfamily } +\ctex_preto_cmd:NnTF \sffamily { \CJKfamily { \CJKsfdefault } } { } + { \ctex_patch_failure:N \sffamily } +\ctex_preto_cmd:NnTF \ttfamily { \CJKfamily { \CJKttdefault } } { } + { \ctex_patch_failure:N \ttfamily } +\ctex_preto_cmd:NnTF \normalfont { \CJKfamily { \CJKfamilydefault } } + { \cs_set_eq:NN \reset@font \normalfont } + { \ctex_patch_failure:N \normalfont } +\cs_new_protected_nopar:Npn \ctex_ltj_ensure_default_family: + { + \prop_if_empty:NF \g__ctex_ltj_family_font_name_prop + { + \ctex_ltj_family_if_exist:xNF { \CJKfamilydefault } \l__ctex_ltj_tmpa_tl + { + \str_if_eq_x:nnTF { \CJKfamilydefault } { \CJKrmdefault } + { \use:n } + { + \ctex_ltj_family_if_exist:xNTF { \CJKrmdefault } \l__ctex_ltj_tmpa_tl + { \tl_gset:Nn \CJKfamilydefault { \CJKrmdefault } \use_none:n } + { \use:n } + } + { + \prop_map_inline:Nn \g__ctex_ltj_family_font_name_prop + { + \prop_map_break:n + { \tl_gset_rescan:Nnn \CJKfamilydefault { } { ##1 } } + } + } + } + \normalfont + \ctex_ltj_update_mathfont: + } + } +\cs_new_protected_nopar:Npn \ctex_ltj_update_mathfont: + { + \ctex_ltj_family_if_exist:xNTF { \c__ctex_ltj_math_tl } \l__ctex_ltj_tmp_tl + { \ctex_ltj_update_mathfont:n { \l__ctex_ltj_tmp_tl } } + { + \ctex_ltj_family_if_exist:xNT { \CJKfamilydefault } \l__ctex_ltj_tmp_tl + { \ctex_ltj_update_mathfont:n { \l__ctex_ltj_tmp_tl } } + } + } +\cs_new_protected_nopar:Npn \ctex_ltj_update_mathfont:n #1 + { + \tl_const:Nx \c__ctex_ltj_math_family_tl {#1} + \DeclareSymbolFont { \c__ctex_ltj_math_tl } { \CJK@encoding } + { \c__ctex_ltj_math_family_tl } { \mddefault } { \updefault } + \cs_if_free:cTF + { \CJK@encoding/\c__ctex_ltj_math_family_tl/\bfdefault/\updefault } + { + \SetSymbolFont { \c__ctex_ltj_math_tl } { bold } { \CJK@encoding } + { \c__ctex_ltj_math_family_tl } { \mddefault } { \updefault } + } + { + \SetSymbolFont { \c__ctex_ltj_math_tl } { bold } { \CJK@encoding } + { \c__ctex_ltj_math_family_tl } { \bfdefault } { \updefault } + } + } +\keys_define:nn { ctex_ltj / fontspec } + { + AlternateFont .code:n = \ctex_ltj_set_alternate_seq:n {#1} , + AlternateFont .value_required: , + CharRange .clist_set:N = \l__ctex_ltj_char_range_clist , + CharRange .value_required: + } +\group_begin: +\char_set_catcode_active:N \/ +\char_set_lccode:nn { `\/ } { `\| } +\tex_lowercase:D + { + \group_end: + \cs_new_protected:Npn \ctex_ltj_set_alternate_seq:n #1 + { + \clist_if_empty:NT \l__ctex_ltj_char_range_clist + { + \tl_set:Nn \l__ctex_ltj_tmp_tl {#1} + \tl_replace_all:Nnn \l__ctex_ltj_tmp_tl { // } { || } + \seq_set_split:NnV \l__ctex_ltj_tmp_seq { || } \l__ctex_ltj_tmp_tl + \seq_set_filter:NNn \l__ctex_ltj_tmp_seq \l__ctex_ltj_tmp_seq + { ! \tl_if_blank_p:n { ##1 } } + \seq_concat:NNN \l__ctex_ltj_alternate_seq + \l__ctex_ltj_alternate_seq \l__ctex_ltj_tmp_seq + } + } + } +\seq_new:N \l__ctex_ltj_tmp_seq +\seq_new:N \l__ctex_ltj_alternate_seq +\cs_new_protected_nopar:Npn \ctex_ltj_set_alternate_family:nnF #1#2#3 + { + \clist_if_empty:NTF \l__ctex_ltj_char_range_clist + { + \__ctex_ltj_check_family:n {#1} + \seq_if_empty:NF \l__ctex_ltj_alternate_seq + { \ctex_ltj_save_alternate_seq:cn { \__ctex_ltj_alternate_cs:n {#1} } {#2} } + #3 + } + { \ctex_ltj_set_alternate_family:nn {#1} {#2} } + } +\cs_new_protected_nopar:Npn \ctex_ltj_save_alternate_seq:Nn #1#2 + { + \seq_map_inline:Nn \l__ctex_ltj_alternate_seq + { \ctex_ltj_save_alternate_seq:Nnnwnw #1 {#2} ##1 { } \q_stop } + } +\cs_generate_variant:Nn \ctex_ltj_save_alternate_seq:Nn { c } +\NewDocumentCommand \ctex_ltj_save_alternate_seq:Nnnwnw + { m m m +O{ } m u{ \q_stop } } + { + \clist_set:Nn \l__ctex_ltj_char_range_clist {#3} + \clist_set:Nn \l__ctex_ltj_alternate_options_clist {#4} + \__ctex_ltj_use_global_options:N \l__ctex_ltj_alternate_options_clist + \tl_if_blank:nTF {#5} + { \tl_set:Nn \l__ctex_ltj_tmp_tl {#2} } + { + \tl_set:Nn \l__ctex_ltj_tmp_tl {#5} + \tl_replace_all:Nnn \l__ctex_ltj_tmp_tl { * } {#2} + } + \use:x + { + \ctex_ltj_save_alternate_family:Nnnn \exp_not:N #1 + { \exp_not:o { \l__ctex_ltj_char_range_clist } } + { \exp_not:o { \l__ctex_ltj_alternate_options_clist } } + { \exp_not:o { \l__ctex_ltj_tmp_tl } } + } + } +\clist_new:N \l__ctex_ltj_alternate_options_clist +\cs_new_protected_nopar:Npn \ctex_ltj_set_alternate_family:nn #1#2 + { + \__ctex_ltj_update_family_uid:N \l__ctex_ltj_font_options_clist + \__ctex_ltj_use_global_options:N \l__ctex_ltj_font_options_clist + \ctex_ltj_set_alternate_family:coonn + { \__ctex_ltj_alternate_cs:n {#1} } + { \l__ctex_ltj_char_range_clist } + { \l__ctex_ltj_font_options_clist } {#2} {#1} + } +\cs_new_protected_nopar:Npn \ctex_ltj_set_alternate_family:Nnnnn #1#2#3#4#5 + { + \prop_get:NnNT \g__ctex_ltj_family_name_prop {#5} \l__ctex_ltj_base_family_tl + { \ctex_ltj_set_alternate_family:nnn {#2} {#3} {#4} } + \ctex_ltj_save_alternate_family:Nnnn #1 {#2} {#3} {#4} + } +\cs_generate_variant:Nn \ctex_ltj_set_alternate_family:Nnnnn { coo } +\cs_new_protected_nopar:Npn \ctex_ltj_save_alternate_family:Nnnn #1#2#3#4 + { + \cs_if_exist:NF #1 { \cs_set_eq:NN #1 \prg_do_nothing: } + \cs_gset_protected_nopar:Npx #1 + { \exp_not:o { #1 \ctex_ltj_set_alternate_family:nnn {#2} {#3} {#4} } } + } +\cs_new_protected_nopar:Npn \ctex_ltj_set_alternate_family:nnn #1#2#3 + { + \group_begin: + \__ctex_ltj_change_encoding: + \cs_set_eq:NN \CJKfamily \use_none:n + \ctex_ltj_swap_cs:NN + \DeclareFontShape@ \ctex_ltj_declare_alternate_shape:nnnnnn + \tl_set:Nn \l__ctex_ltj_char_range_clist {#1} + \fontspec_set_family:Nnn \l__ctex_ltj_alternate_family_tl {#2} {#3} + \group_end: + } +\tl_new:N \l__ctex_ltj_alternate_family_tl +\cs_new_protected:Npn \ctex_ltj_swap_cs:NN #1#2 + { + \cs_set_eq:NN \__ctex_ltj_tmp:w #1 + \cs_set_eq:NN #1 #2 + \cs_set_eq:NN #2 \__ctex_ltj_tmp:w + \cs_undefine:N \__ctex_ltj_tmp:w + } +\keys_define:nn { fontspec } { LTJFONTUID .code:n = } +\cs_new_protected_nopar:Npn \__ctex_ltj_update_family_uid:N #1 + { + \int_gincr:N \g__ctex_ltj_family_int + \clist_put_right:Nx #1 { LTJFONTUID = \int_use:N \g__ctex_ltj_family_int } + } +\int_new:N \g__ctex_ltj_family_int +\cs_new_protected:Npn \ctex_ltj_declare_alternate_shape:nnnnnn #1#2#3#4#5#6 + { + \ctex_ltj_declare_alternate_shape:nnnnnn {#1} {#2} {#3} {#4} {#5} {#6} + \ctex_ltj_set_alternate_shape:Nnnnnnn \l__ctex_ltj_char_range_clist + { \l__ctex_ltj_base_family_tl } {#3} {#4} + { \l_fontspec_family_tl } {#3} {#4} + } +\cs_new_protected_nopar:Npn \ctex_ltj_set_alternate_shape:Nnnnnnn #1#2#3#4#5#6#7 + { + \clist_map_inline:Nn #1 + { + \prop_get:NnNTF \g__ctex_ltj_char_range_prop { ##1 } \l__ctex_ltj_char_range_tl + { + \ctex_ltj_set_alternate_shape:nnN { #2/#3/#4 } { #5/#6/#7 } + \l__ctex_ltj_char_range_tl + } + { \ctex_ltj_set_alternate_shape:nnn { #2/#3/#4 } { #5/#6/#7 } { ##1 } } + } + \__ctex_ltj_save_alternate_shape:cnn + { \__ctex_ltj_alternate_cs:n { clear / \l__ctex_ltj_base_CJKfamily_tl } } + { luatexja.jfont.clear_alt_font_latex } + { '\luatexluaescapestring { \CJK@encoding/#2/#3/#4 }' } + } +\NewDocumentCommand \ctex_ltj_set_alternate_shape:nnn + { m m > { \SplitArgument { \c_one } { -> } } m } + { \ctex_ltj_set_alternate_shape:nnnn {#1} {#2} #3 } +\cs_new_protected_nopar:Npn \ctex_ltj_set_alternate_shape:nnnn #1#2#3#4 + { + \ctex_ltj_set_alternate_shape:n + { + \IfNoValueTF {#4} + { \int_eval:n {#3} , \int_eval:n {#3} , } + { + \int_eval:n { \tl_if_blank:nTF {#3} { "80 } {#3} } , + \int_eval:n { \tl_if_blank:nTF {#4} { "10FFFF } {#4} } , + } + '\luatexluaescapestring { \CJK@encoding/#2 }' , + '\luatexluaescapestring { \CJK@encoding/#1 }' + } + } +\cs_new_protected_nopar:Npn \ctex_ltj_set_alternate_shape:n #1 + { + \ctex_lua_now_x:n { luatexja.jfont.set_alt_font_latex ( #1 ) } + \__ctex_ltj_save_alternate_shape:cnn + { \__ctex_ltj_alternate_cs:n { reset / \l__ctex_ltj_base_CJKfamily_tl } } + { luatexja.jfont.set_alt_font_latex } {#1} + } +\cs_new_protected_nopar:Npn \ctex_ltj_set_alternate_shape:nnN #1#2#3 + { + \tl_map_inline:Nn #3 + { + \ctex_ltj_set_alternate_shape:n + { + ##1 , + '\luatexluaescapestring { \CJK@encoding/#2 }' , + '\luatexluaescapestring { \CJK@encoding/#1 }' + } + } + } +\cs_new_protected_nopar:Npn \__ctex_ltj_save_alternate_shape:Nnn #1#2#3 + { + \group_begin: + \cs_if_exist:NF #1 { \cs_set_eq:NN #1 \prg_do_nothing: } + \cs_set_eq:NN \l__ctex_ltj_base_family_tl \scan_stop: + \cs_set_eq:NN \luatexluaescapestring \scan_stop: + \cs_gset_protected_nopar:Npx #1 + { \exp_not:o {#1} \exp_not:N \ctex_lua_now_x:n { #2 ( #3 ) } } + \group_end: + } +\cs_generate_variant:Nn \__ctex_ltj_save_alternate_shape:Nnn { c } +\keys_define:nn { ctex } + { + clearalternatefont .code:n = + { \clist_map_function:xN {#1} \ctex_ltj_clear_alternate_font:n } , + resetalternatefont .code:n = + { \clist_map_function:xN {#1} \ctex_ltj_reset_alternate_font:n } , + clearalternatefont .default:n = \l_ctex_ltj_family_tl , + resetalternatefont .default:n = \l_ctex_ltj_family_tl + } +\cs_new_protected_nopar:Npn \ctex_ltj_clear_alternate_font:n #1 + { + \group_begin: + \ctex_ltj_family_if_exist:xNTF {#1} \l__ctex_ltj_base_family_tl + { + \cs_if_exist_use:cT { \__ctex_ltj_alternate_cs:n { clear / #1 } } + { + \prop_gput:Nno \g__ctex_ltj_reset_alternate_prop + {#1} { \l__ctex_ltj_base_family_tl } + \tl_set_eq:NN \CJK@family \l__ctex_ltj_base_family_tl + \selectfont + } + } + { \__ctex_ltj_family_unknown_warning:n {#1} } + \group_end: + } +\cs_new_protected_nopar:Npn \ctex_ltj_reset_alternate_font:n #1 + { + \group_begin: + \prop_gpop:NnNT \g__ctex_ltj_reset_alternate_prop {#1} \CJK@family + { + \tl_set_eq:NN \l__ctex_ltj_base_family_tl \CJK@family + \use:c { \__ctex_ltj_alternate_cs:n { reset / #1 } } + \selectfont + } + \group_end: + } +\prop_new:N \g__ctex_ltj_reset_alternate_prop +\cs_generate_variant:Nn \clist_map_function:nN { x } +\keys_define:nn { ctex } + { + declarecharrange .code:n = \ctex_ltj_declare_char_range:x {#1} , + declarecharrange .value_required: + } +\cs_new_protected_nopar:Npn \ctex_ltj_declare_char_range:n #1 + { \clist_map_inline:nn {#1} { \__ctex_ltj_declare_char_range:nn ##1 } } +\cs_generate_variant:Nn \ctex_ltj_declare_char_range:n { x } +\cs_new_protected_nopar:Npn \__ctex_ltj_declare_char_range:nn #1#2 + { \use:x { \ctex_ltj_declare_char_range:nn { \tl_trim_spaces:n {#1} } } {#2} } +\cs_new_protected_nopar:Npn \ctex_ltj_declare_char_range:nn #1#2 + { + \tl_clear:N \l__ctex_ltj_char_range_tl + \clist_map_function:nN {#2} \ctex_ltj_save_char_range:n + \prop_gput:Nno \g__ctex_ltj_char_range_prop {#1} { \l__ctex_ltj_char_range_tl } + \ctex_ltj_def_char_range_key:n {#1} + \tl_clear:N \l__ctex_ltj_char_range_tl + } +\tl_new:N \l__ctex_ltj_char_range_tl +\prop_new:N \g__ctex_ltj_char_range_prop +\NewDocumentCommand \ctex_ltj_save_char_range:n + { > { \SplitArgument { \c_one } { -> } } m } + { \ctex_ltj_save_char_range:nn #1 } +\cs_new_protected_nopar:Npn \ctex_ltj_save_char_range:nn #1#2 + { + \tl_put_right:Nx \l__ctex_ltj_char_range_tl + { { + \IfNoValueTF {#2} + { \int_eval:n {#1} , \int_eval:n {#1} } + { + \int_eval:n { \tl_if_blank:nTF {#1} { "80 } {#1} } , + \int_eval:n { \tl_if_blank:nTF {#2} { "10FFFF } {#2} } + } + } } + } +\cs_new_protected_nopar:Npn \ctex_ltj_def_char_range_key:n #1 + { + \keys_if_exist:nnF { ctex_ltj / fontspec } {#1} + { + \keys_define:nn { ctex_ltj / fontspec } + { #1 .code:n = \ctex_ltj_char_range_key:nn {#1} { ##1 } } + } + } +\cs_new_protected:Npn \ctex_ltj_char_range_key:nn #1#2 + { + \tl_if_blank:nTF {#2} + { \tl_set:Nn \l__ctex_ltj_char_range_clist {#1} } + { + \clist_if_empty:NT \l__ctex_ltj_char_range_clist + { + \tl_set:Nn \l__ctex_ltj_tmp_tl { {#1} } + \__ctex_ltj_char_range_parse_feature:w #2 \q_stop + } + } + } +\NewDocumentCommand \__ctex_ltj_char_range_parse_feature:w + { +o o u { \q_stop } } + { + \exp_args:NNf \tl_put_right:Nn \l__ctex_ltj_tmp_tl + { + \IfNoValueTF {#1} { {#3} } + { + \IfNoValueTF {#2} + { \tl_if_blank:nTF {#3} { { [#1] } } { [ {#1} ] {#3} } } + { [ {#1} ] { [#2] } } + } + } + \seq_put_right:No \l__ctex_ltj_alternate_seq { \l__ctex_ltj_tmp_tl } + } +\cs_new_protected_nopar:Npn \ctex_ltj_update_xkanjiskip: + { + \skip_if_eq:nnT + { \ltjgetparameter { xkanjiskip } } { \l__ctex_ltj_xkanjiskip_skip } + { + \skip_set:Nn \l__ctex_ltj_xkanjiskip_skip { .25 \zw plus 1pt minus 1pt } + \ltjsetxkanjiskip \l__ctex_ltj_xkanjiskip_skip + } + } +\skip_new:N \l__ctex_ltj_xkanjiskip_skip +\skip_set:Nn \l__ctex_ltj_xkanjiskip_skip { .25 \zw plus 1pt minus 1pt } +\AtBeginDocument + { + \ctex_appto_cmd:NnTF \verbatim@font { \CTEX@verbatim@font@hook } + { } { \ctex_patch_failure:N \verbatim@font } + } +\cs_new_protected_nopar:Npn \CTEX@verbatim@font@hook + { \ltjsetparameter { autospacing = false , autoxspacing = false } } +\cs_new_protected_nopar:Npn \ctex_update_default_family: + { + \tl_if_eq:NNT \CJKfamilydefault \l__ctex_family_default_init_tl + { + \group_begin: + \cs_set_eq:NN \__ctex_family_default_wrap:n \exp_not:n + \tl_gset:Nx \CJKfamilydefault + { + \str_case:onF { \familydefault } + { + { \rmdefault } { \exp_not:N \CJKrmdefault } + { \sfdefault } { \exp_not:N \CJKsfdefault } + { \ttdefault } { \exp_not:N \CJKttdefault } + } + { \CJKfamilydefault } + } + \group_end: + } + \ctex_ltj_ensure_default_family: + } +\AtEndPreamble { \ctex_update_default_family: } +\tl_new:N \l__ctex_family_default_init_tl +\cs_new_eq:NN \__ctex_family_default_wrap:n \use:n +\tl_set:Nx \l__ctex_family_default_init_tl + { + \exp_not:N \__ctex_family_default_wrap:n + { \exp_not:o { \CJKfamilydefault } } + } +\tl_gset_eq:NN \CJKfamilydefault \l__ctex_family_default_init_tl +\cs_new_protected_nopar:Npn \ctex_detected_platform: + { + \tl_gset:Nx \g__ctex_fontset_tl + { + \ctex_lua_now_x:n + { + if ~ os.name == 'windows' then ~ + tex.sprint ( 'windows' ) + elseif ~ os.name == 'macosx' then ~ + tex.sprint ( 'mac' ) + else ~ + tex.sprint ( 'fandol' ) + end + } + } + } +\ctex_hypersetup:n { pdfencoding = unicode } +\msg_new:nnn { ctex } { fntef-not-available } + { Functions~ of~ `CJKfntef'~ is~ not~ available~ in~ LuaLaTeX. } +\msg_warning:nn { ctex } { fntef-not-available } +\clist_map_inline:nn + { underdot , underline , underdblline , underwave , sout , xout } + { \cs_new_eq:cN { CTEX#1 } \use:n } +\cs_new_eq:NN \CTEXfilltwosides \use_none:n +\cs_new_eq:NN \endCTEXfilltwosides \prg_do_nothing: +\cs_new_protected_nopar:Npn \ctex_update_ccwd: + { \skip_set:Nn \ccwd { \ltjgetparameter { kanjiskip } + \zw } } +\dim_new:N \ccwd +\cs_new_protected_nopar:Npn \ctex_update_ccglue: + { \ltjsetkanjiskip \l__ctex_ccglue_skip } +\skip_new:N \l__ctex_ccglue_skip +\prg_new_conditional:Npnn \ctex_if_ccglue_touched: { TF } + { + \skip_if_eq:nnTF { \l__ctex_ccglue_skip } { \ltjgetparameter { kanjiskip } } + { \prg_return_false: } { \prg_return_true: } + } +\cs_new_protected_nopar:Npn \ctex_update_em_unit: + { \dim_set:Nn \ccwd { \zw } } +\cs_new_protected:Npn \ctex_add_to_selectfont:n #1 + { + \cs_set_protected_nopar:Npx \CTEX@selectfont@hook + { \exp_not:o { \CTEX@selectfont@hook #1 } } + } +\cs_new_eq:NN \CTEX@selectfont@hook \prg_do_nothing: +\cs_new_eq:Nc \__ctex_save_selectfont: { selectfont ~ } +\use:n + { + \ExplSyntaxOff + \ctex_preto_cmd:NnTF \selectfont { \CTEX@selectfont@hook } + { + \tl_put_left:Nn \@EverySelectfont@Init + { \cs_set_eq:cN { selectfont ~ } \__ctex_save_selectfont: } + } + { \ctex_patch_failure:N \selectfont } + } +\ExplSyntaxOn +\EverySelectfont { \CTEX@selectfont@hook } +\ctex_add_to_selectfont:n + { + \ctex_ltj_select_font: + \ctex_ltj_select_alternate_font: + \ctex_ltj_update_xkanjiskip: + } +\tl_set:Nn \CJK@family { song } \selectfont +\tl_clear:N \CJK@family +\keys_define:nn { ctex } + { + space .code:n = + { \msg_warning:nn { ctex } { invalid-option } } + } +\keys_define:nn { ctex } + { + punct .code:n = + { + \tl_set:Nx \l__ctex_punct_tl { #1 } + \ctex_mono_jfm:o { \l__ctex_punct_tl } + } , + punct .default:n = { quanjiao } , + } +%% +%% +%% End of file `ctex-engine-luatex.def'. 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 new file mode 100644 index 00000000000..6371b8a0049 --- /dev/null +++ b/Master/texmf-dist/tex/latex/ctex/engine/ctex-engine-pdftex.def @@ -0,0 +1,349 @@ +%% +%% This is file `ctex-engine-pdftex.def', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% ctex.dtx (with options: `pdftex') +%% +%% Copyright (C) 2003--2015 +%% 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 +%% version 1.3c of this license or (at your option) any later +%% version. This version of this license is in +%% http://www.latex-project.org/lppl/lppl-1-3c.txt +%% and the latest version of this license is in +%% http://www.latex-project.org/lppl.txt +%% 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'. +%% +%% The Current Maintainers of this work are Leo Liu, Qing Lee and Liam Huang. +%% +%% ------------------------------------------------------------------------------ +%% +\GetIdInfo$Id: ctex.dtx 3d246c0 2015-05-11 23:20:45 +0800 Qing Lee <sobenlee@gmail.com> $ + {(pdf)LaTeX adapter (CTEX)} +\ProvidesExplFile{ctex-engine-pdftex.def} + {\ExplFileDate}{2.0}{\ExplFileDescription} +\if_bool:N \g__ctex_zhmCJK_bool + \PassOptionsToPackage { encoding = \l__ctex_encoding_tl } { zhmCJK } + \RequirePackage { zhmCJK } +\else: + \str_if_eq:onTF { \l__ctex_encoding_tl } { GBK } + { \RequirePackage { CJK } } + { \RequirePackage { CJKutf8 } } + \RequirePackage { CJKpunct , CJKspace } + \cs_new_protected_nopar:Npn \ctex_load_zhmap:nnnn #1#2#3#4 + { + \tl_set:Nn \CJKrmdefault {#1} + \tl_set:Nn \CJKsfdefault {#2} + \tl_set:Nn \CJKttdefault {#3} + \AtBeginDvi { \file_input:n {#4} } + \ctex_at_end_package:nn { atbegshi } + { \AtBeginShipoutFirst { \file_input:n {#4} } } + } + \@onlypreamble \ctex_load_zhmap:n + \tl_if_exist:NF \CJKfamilydefault + { \tl_const:Nn \CJKfamilydefault { \CJKrmdefault } } + \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:NnTF \rmfamily { \CJKfamily { \CJKrmdefault } } { } + { \ctex_patch_failure:N \rmfamily } + \ctex_preto_cmd:NnTF \sffamily { \CJKfamily { \CJKsfdefault } } { } + { \ctex_patch_failure:N \sffamily } + \ctex_preto_cmd:NnTF \ttfamily { \CJKfamily { \CJKttdefault } } { } + { \ctex_patch_failure:N \ttfamily } + \ctex_preto_cmd:NnTF \normalfont { \CJKfamily { \CJKfamilydefault } } + { \cs_set_eq:NN \reset@font \normalfont } + { \ctex_patch_failure:N \normalfont } +\fi: +\cs_new_protected_nopar:Npn \ctex_CJK_input:n #1 + { + \ctex_file_wrapper:nnn + { + \char_set_catcode_other:n { 60 } % < + \char_set_catcode_math_superscript:n { 94 } % ^ + \int_set_eq:NN \tex_endlinechar:D \c_minus_one + } + { \file_input:n {#1} } + { + \char_set_catcode:nn { 60 } { \char_value_catcode:n { 60 } } + \char_set_catcode:nn { 94 } { \char_value_catcode:n { 94 } } + \int_set:Nn \tex_endlinechar:D { \int_use:N \tex_endlinechar:D } + } + } +\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 + { + \tl_set:Nx \l__ctex_tmp_tl {#2} + \int_set:Nn \l__ctex_tmp_int + { \exp_args:No \int_from_hex:n { \l__ctex_tmp_tl } } + \int_compare:nNnTF \l__ctex_tmp_int < \c_two_hundred_fifty_six + { \tl_gset:Nx #1 { \int_to_Hex:n { \l__ctex_tmp_int } } } + { + \int_sub:Nn \l__ctex_tmp_int { \c_two_hundred_fifty_six } + \tl_gset:Nx #1 + { + \int_to_Hex:n + { \int_div_truncate:nn { \l__ctex_tmp_int } { \c_four } + "D800 } + \int_to_Hex:n + { \int_mod:nn { \l__ctex_tmp_int } { \c_four } + "DC } + } + } + } + \cs_set_eq:NN \CJK@surr \ctex_plane_to_utfxvibe:Nn +\fi: +\AtBeginDocument + { + \str_if_eq_x:nnF { \l__ctex_punct_tl } { quanjiao } + { \punctstyle { \l__ctex_punct_tl } } + } +\reverse_if:N \if_bool:N \g__ctex_zhmCJK_bool + \str_if_eq:onF { \l__ctex_encoding_tl } { UTF8 } + { + \CJK@makeActive + \CJK@loadBinding { standard } + } + \exp_args:Nx \AtEndPreamble + { + \exp_not:N \CJK@envStart + { } { \l__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_set_protected_nopar:Npn \ctex_set_ignorespaces: + { \cs_set_eq:NN \CJK@ignorespaces #1 } + \ctex_set_ignorespaces: + } +\cs_new_protected_nopar:Npn \ctex_set_ignorespaces: + { \cs_set_eq:NN \CJK@ignorespaces \ctex_auto_ignorespaces: } +\ctex_add_hook:Nn \CJKhook { \ctex_set_ignorespaces: } +\cs_new_protected_nopar:Npn \ctex_punct_set:n #1 + { + \clist_map_inline:Nn \c__ctex_punct_family_clist + { + \cs_if_free:cF { c__ctex_ #1 ##1 _punct_spaces_tl } + { + \cs_set_eq:cc + { CJKpunct@ ##1 @spaces } + { c__ctex_ #1 ##1 _punct_spaces_tl } + } + } + } +\clist_const:Nn \c__ctex_punct_family_clist + { + 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_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 + { + \clist_map_inline:nn {#1} + { + \ctex_punct_map_series:nnn { ##1 } { b } {#2} + \ctex_punct_map_series:nnn { ##1 } { bx } {#2} + } + } +\cs_new_protected_nopar:Npn \ctex_punct_map_series:nnn #1#2#3 + { + \CJKpunctmapfamily { C19 } {#1} {#2} { m } {#3} + \CJKpunctmapfamily { C19 } {#1} {#2} { it } {#3} + \CJKpunctmapfamily { C19 } {#1} {#2} { sl } {#3} + \CJKpunctmapfamily { C70 } {#1} {#2} { m } {#3} + \CJKpunctmapfamily { C70 } {#1} {#2} { it } {#3} + \CJKpunctmapfamily { C70 } {#1} {#2} { sl } {#3} + } +\cs_new_protected_nopar:Npn \ctex_punct_map_itshape:nn #1#2 + { + \CJKpunctmapfamily { C19 } {#1} { m } { it } {#2} + \CJKpunctmapfamily { C19 } {#1} { b } { it } {#2} + \CJKpunctmapfamily { C19 } {#1} { bx } { it } {#2} + \CJKpunctmapfamily { C70 } {#1} { m } { it } {#2} + \CJKpunctmapfamily { C70 } {#1} { b } { it } {#2} + \CJKpunctmapfamily { C70 } {#1} { bx } { it } {#2} + } +\cs_new_protected_nopar: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: + { + \tl_if_eq:NNT \CJKfamilydefault \l__ctex_family_default_init_tl + { + \group_begin: + \cs_set_eq:NN \__ctex_family_default_wrap:n \exp_not:n + \tl_gset:Nx \CJKfamilydefault + { + \str_case:onF { \familydefault } + { + { \rmdefault } { \exp_not:N \CJKrmdefault } + { \sfdefault } { \exp_not:N \CJKsfdefault } + { \ttdefault } { \exp_not:N \CJKttdefault } + } + { \CJKfamilydefault } + } + \group_end: + } + } +\AtEndPreamble { \ctex_update_default_family: } +\tl_new:N \l__ctex_family_default_init_tl +\cs_new_eq:NN \__ctex_family_default_wrap:n \use:n +\tl_set:Nx \l__ctex_family_default_init_tl + { + \exp_not:N \__ctex_family_default_wrap:n + { \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_engine_file_tl } + { \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 } } + } +\tex_uppercase:D \exp_after:wN + { + \exp_after:wN \tl_const:Nn \exp_after:wN \c__ctex_engine_file_tl + \exp_after:wN { \g_file_current_name_tl } + } +\cs_new_protected_nopar:Npn \ctex_if_macosx:TF #1#2 + { + \file_if_exist:nTF { \c__ctex_macosx_file_tl } + { \tl_gset:Nn \g__ctex_fontset_tl {#1} } + { \tl_gset:Nn \g__ctex_fontset_tl {#2} } + } +\tl_const:Nn \c__ctex_macosx_file_tl { /mach_kernel } +\ctex_hypersetup:n { driverfallback = dvipdfmx } +\str_if_eq:onTF { \l__ctex_encoding_tl } { GBK } + { + \ctex_hypersetup:n { CJKbookmarks = true } + \ctex_if_pdfmode:TF + { \ctex_at_end_package:nn { hyperref } { \RequirePackage { xCJK2uni } } } + { + \ctex_at_end_package:nn { hyperref } + { + \str_if_eq:onTF { \Hy@driver } { hdvipdfm } + { + \AtBeginShipoutFirst + { \special { pdf:tounicode~GBK-EUC-UCS2 } } + } + { \RequirePackage { xCJK2uni } } + } + } + } + { \ctex_hypersetup:n { pdfencoding = unicode } } +\RequirePackage { CJKfntef } \normalem +\clist_map_inline:nn + { underdot , underline , underdblline , underwave , sout , xout } + { + \tl_clear:c { CJK#1color } + \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 + } + { + \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: + { + \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_set_protected_nopar:Npn \CJKglue + { \skip_horizontal:N \l__ctex_ccglue_skip } + } +\skip_new:N \l__ctex_ccglue_skip +\prg_new_conditional:Npnn \ctex_if_ccglue_touched: { TF } + { + \if_meaning:w \CJKglue \__ctex_ccglue: + \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: + { \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 + { \exp_not:o { \CTEX@selectfont@hook #1 } } + } +\cs_new_eq:NN \CTEX@selectfont@hook \prg_do_nothing: +\cs_new_eq:Nc \__ctex_save_selectfont: { selectfont ~ } +\use:n + { + \ExplSyntaxOff + \ctex_preto_cmd:NnTF \selectfont { \CTEX@selectfont@hook } + { + \tl_put_left:Nn \@EverySelectfont@Init + { \cs_set_eq:cN { selectfont ~ } \__ctex_save_selectfont: } + } + { \ctex_patch_failure:N \selectfont } + } +\ExplSyntaxOn +\EverySelectfont { \cs_if_exist:NF \CJK@plane { \CTEX@selectfont@hook } } +\keys_define:nn { ctex } + { + space .choice: , + space / true .code:n = + { \ctex_ignorespaces_case:N \prg_do_nothing: } , + space / auto .code:n = + { \ctex_ignorespaces_case:N \ctex_auto_ignorespaces: } , + space / false .code:n = + { \ctex_ignorespaces_case:N \tex_ignorespaces:D } , + space .default:n = { true } , + space .initial:n = { auto } + } +\keys_define:nn { ctex } + { + punct .code:n = + { + \tl_set:Nx \l__ctex_punct_tl { #1 } + \punctstyle { \l__ctex_punct_tl } + } , + punct .default:n = { quanjiao } , + } +%% +%% +%% End of file `ctex-engine-pdftex.def'. diff --git a/Master/texmf-dist/tex/latex/ctex/engine/ctex-engine-xetex.def b/Master/texmf-dist/tex/latex/ctex/engine/ctex-engine-xetex.def new file mode 100644 index 00000000000..412c0a4c7b7 --- /dev/null +++ b/Master/texmf-dist/tex/latex/ctex/engine/ctex-engine-xetex.def @@ -0,0 +1,147 @@ +%% +%% This is file `ctex-engine-xetex.def', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% ctex.dtx (with options: `xetex') +%% +%% Copyright (C) 2003--2015 +%% 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 +%% version 1.3c of this license or (at your option) any later +%% version. This version of this license is in +%% http://www.latex-project.org/lppl/lppl-1-3c.txt +%% and the latest version of this license is in +%% http://www.latex-project.org/lppl.txt +%% 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'. +%% +%% The Current Maintainers of this work are Leo Liu, Qing Lee and Liam Huang. +%% +%% ------------------------------------------------------------------------------ +%% +\GetIdInfo$Id: ctex.dtx 3d246c0 2015-05-11 23:20:45 +0800 Qing Lee <sobenlee@gmail.com> $ + {XeLaTeX adapter (CTEX)} +\ProvidesExplFile{ctex-engine-xetex.def} + {\ExplFileDate}{2.0}{\ExplFileDescription} +\RequirePackage { xeCJK } +\exp_args:Nx \xeCJKsetup + { + LoadFandol = false , + AutoFakeBold = true , + PunctStyle = \l__ctex_punct_tl + } +\@ifpackagelater { fontspec } { 2014/05/25 } { } + { \msg_error:nnn { ctex } { package-too-old } { fontspec } } +\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_engine_file_tl } + { \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 } } + } +\tex_uppercase:D \exp_after:wN + { + \exp_after:wN \tl_const:Nn \exp_after:wN \c__ctex_engine_file_tl + \exp_after:wN { \g_file_current_name_tl } + } +\cs_new_protected_nopar:Npn \ctex_if_macosx:TF #1#2 + { + \file_if_exist:nTF { \c__ctex_macosx_file_tl } + { \tl_gset:Nn \g__ctex_fontset_tl {#1} } + { \tl_gset:Nn \g__ctex_fontset_tl {#2} } + } +\tl_const:Nn \c__ctex_macosx_file_tl { /mach_kernel } +\ctex_hypersetup:n { pdfencoding = unicode } +\RequirePackage { xeCJKfntef } +\clist_map_inline:nn + { underdot , underline , underdblline , underwave , sout , xout } + { + \keys_set:nn { xeCJK / options } { #1 / format = { } } + \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 } +\cs_new_protected_nopar: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: + { \xeCJKsetup { CJKglue = { \skip_horizontal:N \l__ctex_ccglue_skip } } } +\skip_new:N \l__ctex_ccglue_skip +\prg_new_conditional:Npnn \ctex_if_ccglue_touched: { TF } + { + \if_meaning:w \CJKglue \__ctex_ccglue: + \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: + { \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 + { \exp_not:o { \CTEX@selectfont@hook #1 } } + } +\cs_new_eq:NN \CTEX@selectfont@hook \prg_do_nothing: +\cs_new_eq:Nc \__ctex_save_selectfont: { selectfont ~ } +\use:n + { + \ExplSyntaxOff + \ctex_preto_cmd:NnTF \selectfont { \CTEX@selectfont@hook } + { + \tl_put_left:Nn \@EverySelectfont@Init + { \cs_set_eq:cN { selectfont ~ } \__ctex_save_selectfont: } + } + { \ctex_patch_failure:N \selectfont } + } +\ExplSyntaxOn +\EverySelectfont { \CTEX@selectfont@hook } +\keys_define:nn { ctex } + { + space .choice: , + space / true .code:n = + { \xeCJKsetup { CJKspace = true } } , + space / auto .code:n = + { \xeCJKsetup { CJKspace = false } } , + space / false .code:n = + { \xeCJKsetup { CJKspace = false } } , + space .default:n = { true } , + space .initial:n = { auto } + } +\keys_define:nn { ctex } + { + punct .code:n = + { + \tl_set:Nx \l__ctex_punct_tl { #1 } + \xeCJKsetup { PunctStyle = \l__ctex_punct_tl } + } , + punct .default:n = { quanjiao } , + } +%% +%% +%% End of file `ctex-engine-xetex.def'. diff --git a/Master/texmf-dist/tex/latex/ctex/engine/ctex-xecjk-engine.def b/Master/texmf-dist/tex/latex/ctex/engine/ctex-xecjk-engine.def deleted file mode 100644 index ebc344e95a7..00000000000 --- a/Master/texmf-dist/tex/latex/ctex/engine/ctex-xecjk-engine.def +++ /dev/null @@ -1,37 +0,0 @@ -% ctex-xecjk-engine.def: for XeTeX engine with xeCJK -% vim:ft=tex - -% compatibility with amssymb.sty etc and xunicode.sty v0.95+ -\RequirePackage{savesym} -\def\CTEX@save@symlist{hbar,Finv,aleph,beth,gimel,daleth,Game} - -\@for \reversed@a:=\CTEX@save@symlist \do{% - \savesymbol{\reversed@a}} - -\RequirePackage[BoldFont,normalindentfirst]{xeCJK} -\defaultfontfeatures{Ligatures=TeX} - -\@for \reversed@a:=\CTEX@save@symlist \do{% - \restoresymbol{UTF}{\reversed@a}% - \expandafter\ifx \csname\reversed@a\endcsname \relax - \expandafter\let \csname\reversed@a\endcsname \CTEX@undefined - \fi} -\let\CTEX@save@symlist\CTEX@undefined - -\ifCTEX@punct - \punctstyle{quanjiao} -\else - \punctstyle{plain} -\fi - -\input{ctex-cjk-common.def} - -\ifCTEX@nofonts\else - \ifCTEX@winfonts - \input{ctex-xecjk-winfonts.def} - \else\ifCTEX@adobefonts - \input{ctex-xecjk-adobefonts.def} - \fi\fi -\fi - -\endinput |