diff options
author | Karl Berry <karl@freefriends.org> | 2016-02-03 22:59:51 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2016-02-03 22:59:51 +0000 |
commit | 1290d7454b9754f3c7a7e4a229981e18f58ea6f6 (patch) | |
tree | aa01beb72d34acd81690358b54be7493a5244544 /Master/texmf-dist/tex/latex/ctex/engine | |
parent | e5ef88072190f4f0e310c900fd626db1dd7dc096 (diff) |
ctex (3feb16)
git-svn-id: svn://tug.org/texlive/trunk@39559 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/ctex/engine')
3 files changed, 159 insertions, 119 deletions
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 index 902e0e3e832..584a58a0105 100644 --- a/Master/texmf-dist/tex/latex/ctex/engine/ctex-engine-luatex.def +++ b/Master/texmf-dist/tex/latex/ctex/engine/ctex-engine-luatex.def @@ -26,10 +26,10 @@ %% %% ------------------------------------------------------------------------------ %% -\GetIdInfo$Id: ctex.dtx 6255367 2015-07-01 01:15:24 +0800 Qing Lee <sobenlee@gmail.com> $ +\GetIdInfo$Id: ctex.dtx 4e02493 2016-02-02 17:10:17 +0800 Qing Lee <sobenlee@gmail.com> $ {LuaLaTeX adapter (CTEX)} \ProvidesExplFile{ctex-engine-luatex.def} - {\ExplFileDate}{2.2}{\ExplFileDescription} + {\ExplFileDate}{2.3}{\ExplFileDescription} \msg_new:nnn { ctex } { luatexja-loaded } { Package~`luatexja'~can~not~be~loaded~before~`ctex'.\\ @@ -39,7 +39,7 @@ { \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 } { } +\@ifpackagelater { luatexja } { 2015/09/21 } { } { \msg_error:nnn { ctex } { package-too-old } { luatexja } } \RequirePackage { fontspec } \@ifpackagelater { fontspec } { 2014/05/25 } { } @@ -61,7 +61,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}} +\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') @@ -78,36 +78,57 @@ \AtBeginUTFCommand { \group_begin: - \ctex_lua_now_x:n { tex.globaldefs = 0 } + \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 +\cs_new_protected_nopar:Npn \__ctex_ltj_um_define_math_chars: { \group_begin: - \char_set_lccode:nn { \c_zero } {#2} - \tex_lowercase:D + \cs_set_protected:Npn \__um_sym:nnn ##1##2##3 { - \group_end: - \cs_gset_protected_nopar:Npn #1 + \tl_if_in:nnT { - \mode_if_math:TF { ^^@ } - { { - \ctex_lua_now_x:n { tex.globaldefs = 0 } - \ltj@allalchar ^^@ - } } + \mathord \mathalpha \mathbin \mathrel + \mathpunct \mathop \mathfence } + { ##3 } + { \__ctex_ltj_um_char:Nn ##2 { ##1 } } } + \__um_input_math_symbol_table: + \group_end: + } +\cs_new_protected:Npn \__ctex_ltj_um_char:Nn #1#2 + { + \__ctex_ltj_um_char_aux:Nx #1 { \char_generate:nn {#2} { 12 } } \ltjsetmathletter {#2} } -\group_end: +\cs_new_protected:Npn \__ctex_ltj_um_char_aux:Nn #1#2 + { + \cs_gset_protected_nopar:Npn #1 + { + \mode_if_math:TF + {#2} + { + { + \lua_now_x:n { tex.globaldefs = 0 } + \ltj@allalchar #2 + } + } + } + } +\cs_generate_variant:Nn \__ctex_ltj_um_char_aux:Nn { Nx } \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 } + \cs_set_eq:NN \__um_define_math_chars: \__ctex_ltj_um_define_math_chars: + \@ifpackagelater { unicode-math } { 2015/06/28 } + { + \cs_set_eq:NN \use@mathgroup \ctex_ltj_use_math_group:Nn + \cs_set_protected_nopar:Npn \ctex_ltj_math_group_hook: + { \__um_switchto_literal: } + } + { } } \ctex_at_end_package:nn { listings } { @@ -171,7 +192,7 @@ } \exp_after:wN \globaljfont \font@name \external@font \scan_stop: \font@name - \ctex_lua_now_x:n { font.current(tex.getattribute('ltj@curjfnt')) } + \lua_now_x:n { font.current(tex.getattribute('ltj@curjfnt')) } \use:c { \f@encoding + \f@family } \use:c { \curr@fontshape } } @@ -197,21 +218,21 @@ } \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}') } + \lua_now_x:n { luatexja.jfont.does_alt_set ('\lua_escape_x:n {#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 } + { #1 \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 + \lua_now_x:n { luatexja.jfont.output_alt_font_cmd - ('y', '\luatexluaescapestring { \l__ctex_ltj_current_shape_tl }') + ('y', '\lua_escape_x:n { \l__ctex_ltj_current_shape_tl }') } - \ctex_lua_now_x:n { luatexja.jfont.pickup_alt_font_a ('\f@size') } + \lua_now_x:n { luatexja.jfont.pickup_alt_font_a ('\f@size') } } } \tl_new:N \l__ctex_ltj_current_shape_tl @@ -232,46 +253,64 @@ \cs_new_protected_nopar:Npn \ltj@pickup@altfont@copy #1#2 { \ltj@@getjfontnumber #1 - \ctex_lua_now_x:n + \lua_now_x:n { luatexja.jfont.pickup_alt_font_b - ( \the\ltj@tempcntc, '\luatexluaescapestring {#2}' ) + ( \int_use:N \ltj@tempcntc, '\lua_escape_x:n {#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:Npn \ctex_ltj_if_jfont:nTF #1 + { + \lua_now_x:n + { luatexja.jfont.is_kenc( string.match('\lua_escape_x:n {#1}', '[^/]+') ) } + \ifin@ \exp_after:wN \use_i:nn \else: \exp_after:wN \use_ii:nn \fi: + } +\cs_new:Npn \ctex_ltj_if_jfont_math:NTF #1 + { \exp_after:wN \__ctex_ltj_if_jfont_math:w \token_to_str:N #1 \q_stop } +\group_begin: + \char_set_catcode_other:N M + \cs_new:Npn \__ctex_ltj_if_jfont_math:w #1 M #2#3 \q_stop + { \ctex_ltj_if_jfont:nTF {#3} } +\group_end: +\cs_new_protected_nopar:Npn \ctex_ltj_get_and_define_fonts:nN #1#2 + { + \ctex_ltj_if_jfont:nTF { \token_to_str:N #2 } + { \ctex_ltj_get_and_define_fonts_ja:nN } + { \ctex_ltj_get_and_define_fonts_al:nN } + {#1} #2 + } +\cs_new_eq:NN \ctex_ltj_get_and_define_fonts_al:nN \getanddefine@fonts +\cs_set_eq:NN \getanddefine@fonts \ctex_ltj_get_and_define_fonts:nN +\cs_new_protected_nopar:Npn \ctex_ltj_get_and_define_fonts_ja:nN #1#2 + { + \tl_gset:Nx \font@name { \use:c { \token_to_str:N #2 / \tf@size } } + \ctex_ltj_pickup_font: \tl_set_eq:NN \textfont@name \font@name + \tl_gset:Nx \font@name { \use:c { \token_to_str:N #2 / \sf@size } } + \ctex_ltj_pickup_font: \tl_set_eq:NN \scriptfont@name \font@name + \tl_gset:Nx \font@name { \use:c { \token_to_str:N #2 / \ssf@size } } + \ctex_ltj_pickup_font: + \tl_put_right:Nx \math@fonts + { + \ltj@setpar@global + \ltj@@set@stackfont #1 , \textfont@name \c_colon_str { MJT } + \ltj@@set@stackfont #1 , \scriptfont@name \c_colon_str { MJS } + \ltj@@set@stackfont #1 , \font@name \c_colon_str { MJSS } + } + } +\cs_new_protected_nopar:Npn \ctex_ltj_use_math_group:Nn #1#2 + { + \mode_if_math:T + { + \math@bgroup + \cs_if_eq:cNF { M@ \f@encoding } #1 {#1} + \ctex_ltj_math_group_hook: + \ctex_ltj_if_jfont_math:NTF #1 + { \jfam } { \mathgroup } #2 \scan_stop: + \math@egroup + } + } +\cs_new_eq:NN \ctex_ltj_math_group_hook: \prg_do_nothing: +\cs_set_eq:NN \use@mathgroup \ctex_ltj_use_math_group:Nn \cs_new_protected_nopar:Npn \ctex_mono_jfm:n #1 { \str_if_eq:nnTF {#1} { plain } @@ -283,8 +322,12 @@ \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') } +\use:x + { + \exp_not:N \DeclareFontSubstitution + { \CJK@encoding } { song } { \mddefault } { \updefault } + } +\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 } { } @@ -634,30 +677,31 @@ \keys_define:nn { ctex_ltj / fontspec } { AlternateFont .code:n = \ctex_ltj_set_alternate_seq:n {#1} , - AlternateFont .value_required: , + AlternateFont .value_required:n = true , CharRange .clist_set:N = \l__ctex_ltj_char_range_clist , - CharRange .value_required: + CharRange .value_required:n = true } \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 - } - } - } + \char_set_catcode_other:N \| + \cs_set:Npn \__ctex_ltj_tmp:w #1 + { + \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 {#1} { || } + \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 + } + } + } + \char_set_catcode_active:N \| + \__ctex_ltj_tmp:w { || } +\group_end: \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 @@ -767,7 +811,7 @@ \__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 }' } + { '\lua_escape_x:n { \CJK@encoding/#2/#3/#4 }' } } \NewDocumentCommand \ctex_ltj_set_alternate_shape:nnn { m m > { \SplitArgument { \c_one } { -> } } m } @@ -782,13 +826,13 @@ \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 }' + '\lua_escape_x:n { \CJK@encoding/#2 }' , + '\lua_escape_x:n { \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 ) } + \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} @@ -800,8 +844,8 @@ \ctex_ltj_set_alternate_shape:n { ##1 , - '\luatexluaescapestring { \CJK@encoding/#2 }' , - '\luatexluaescapestring { \CJK@encoding/#1 }' + '\lua_escape_x:n { \CJK@encoding/#2 }' , + '\lua_escape_x:n { \CJK@encoding/#1 }' } } } @@ -810,9 +854,9 @@ \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_set_eq:NN \lua_escape_x:n \scan_stop: \cs_gset_protected_nopar:Npx #1 - { \exp_not:o {#1} \exp_not:N \ctex_lua_now_x:n { #2 ( #3 ) } } + { \exp_not:o {#1} \exp_not:N \lua_now_x:n { #2 ( #3 ) } } \group_end: } \cs_generate_variant:Nn \__ctex_ltj_save_alternate_shape:Nnn { c } @@ -857,7 +901,7 @@ \keys_define:nn { ctex } { declarecharrange .code:n = \ctex_ltj_declare_char_range:x {#1} , - declarecharrange .value_required: + declarecharrange .value_required:n = true } \cs_new_protected_nopar:Npn \ctex_ltj_declare_char_range:n #1 { \clist_map_inline:nn {#1} { \__ctex_ltj_declare_char_range:nn ##1 } } @@ -944,6 +988,7 @@ } \cs_new_protected_nopar:Npn \CTEX@verbatim@font@hook { \ltjsetparameter { autospacing = false , autoxspacing = false } } +\cs_set_eq:NN \@@italiccorr \/ \cs_new_protected_nopar:Npn \ctex_update_default_family: { \tl_if_eq:NNT \CJKfamilydefault \l__ctex_family_default_init_tl @@ -977,7 +1022,7 @@ { \tl_gset:Nx \g__ctex_fontset_tl { - \ctex_lua_now_x:n + \lua_now_x:n { if ~ os.name == 'windows' then ~ tex.sprint ( 'windows' ) @@ -1048,6 +1093,7 @@ } , punct .default:n = { quanjiao } , } +\tl_set:Nn \l__ctex_encoding_tl { UTF8 } %% %% %% 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 index 49dc80aca67..f4d9c367d76 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 @@ -26,10 +26,10 @@ %% %% ------------------------------------------------------------------------------ %% -\GetIdInfo$Id: ctex.dtx 6255367 2015-07-01 01:15:24 +0800 Qing Lee <sobenlee@gmail.com> $ +\GetIdInfo$Id: ctex.dtx 4e02493 2016-02-02 17:10:17 +0800 Qing Lee <sobenlee@gmail.com> $ {(pdf)LaTeX adapter (CTEX)} \ProvidesExplFile{ctex-engine-pdftex.def} - {\ExplFileDate}{2.2}{\ExplFileDescription} + {\ExplFileDate}{2.3}{\ExplFileDescription} \seq_new:N \c__ctex_cmap_encoding_seq \seq_set_from_clist:Nn \c__ctex_cmap_encoding_seq { C19 , C10 , C00 , C09 , C40 , C60 } @@ -56,7 +56,7 @@ \cs_generate_variant:Nn \ctex_add_cmap:Nn { c } \cs_new_protected_nopar:Npn \__ctex_save_cmap:Nn #1#2 { - \tex_lowercase:D { \tl_set:Nx \l__ctex_tmp_tl { #2 \CJK@plane } } + \tl_set:Nx \l__ctex_tmp_tl { \str_lower_case:n {#2} \CJK@plane } \tex_immediate:D \pdfobj stream ~ file { \l__ctex_tmp_tl .cmap } \cs_new_protected_nopar:Npx #1 { @@ -66,7 +66,7 @@ } \group_begin: \char_set_catcode_other:N \# -\ctex_if_pdfmode:TF +\sys_if_output_pdf:TF { \group_end: \ctex_appto_cmd:NnnTF \DeclareFontFamily { \ExplSyntaxOff } @@ -269,7 +269,7 @@ { \file_if_exist:nTF { nul: } { - \file_if_exist:nTF { \c__ctex_engine_file_tl } + \file_if_exist:nTF { \c__ctex_upper_case_file_str } { \ctex_if_macosx:TF { mac } { windows } } { \ctex_if_macosx:TF { mac } { fandol } } } @@ -277,23 +277,20 @@ } { \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 } - } +\str_const:Nx \c__ctex_upper_case_file_str + { \exp_args:No \str_upper_case:n { \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 } + \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} } } -\tl_const:Nn \c__ctex_macosx_file_tl { /Library/Fonts/Songti.ttc } +\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 } { \ctex_hypersetup:n { CJKbookmarks = true } - \ctex_if_pdfmode:TF + \sys_if_output_pdf:TF { \ctex_at_end_package:nn { hyperref } { \RequirePackage { xCJK2uni } } } { \ctex_at_end_package:nn { hyperref } 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 index 6a6e2a0cbf4..d45315f24d2 100644 --- a/Master/texmf-dist/tex/latex/ctex/engine/ctex-engine-xetex.def +++ b/Master/texmf-dist/tex/latex/ctex/engine/ctex-engine-xetex.def @@ -26,10 +26,10 @@ %% %% ------------------------------------------------------------------------------ %% -\GetIdInfo$Id: ctex.dtx 6255367 2015-07-01 01:15:24 +0800 Qing Lee <sobenlee@gmail.com> $ +\GetIdInfo$Id: ctex.dtx 4e02493 2016-02-02 17:10:17 +0800 Qing Lee <sobenlee@gmail.com> $ {XeLaTeX adapter (CTEX)} \ProvidesExplFile{ctex-engine-xetex.def} - {\ExplFileDate}{2.2}{\ExplFileDescription} + {\ExplFileDate}{2.3}{\ExplFileDescription} \RequirePackage { xeCJK } \exp_args:Nx \xeCJKsetup { @@ -45,7 +45,7 @@ { \file_if_exist:nTF { nul: } { - \file_if_exist:nTF { \c__ctex_engine_file_tl } + \file_if_exist:nTF { \c__ctex_upper_case_file_str } { \ctex_if_macosx:TF { mac } { windows } } { \ctex_if_macosx:TF { mac } { fandol } } } @@ -53,23 +53,19 @@ } { \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 } - } +\str_const:Nx \c__ctex_upper_case_file_str + { \exp_args:No \str_upper_case:n { \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 } + \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} } } -\tl_const:Nn \c__ctex_macosx_file_tl { /Library/Fonts/Songti.ttc } +\str_const:Nn \c__ctex_macosx_file_str { /Library/Fonts/Songti.ttc } \ctex_hypersetup:n { pdfencoding = unicode } \RequirePackage { xeCJKfntef } \@ifpackagelater { xeCJKfntef } { 2014/11/04 } { - \cs_new_protected_nopar:Npn \__ctex_clear_fntef_color:n #1 { \xeCJKsetup { #1 / format = { } } } } @@ -148,6 +144,7 @@ } , punct .default:n = { quanjiao } , } +\tl_set:Nn \l__ctex_encoding_tl { UTF8 } %% %% %% End of file `ctex-engine-xetex.def'. |