summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/xelatex/xecjk/xeCJK.sty
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/xelatex/xecjk/xeCJK.sty')
-rw-r--r--Master/texmf-dist/tex/xelatex/xecjk/xeCJK.sty361
1 files changed, 216 insertions, 145 deletions
diff --git a/Master/texmf-dist/tex/xelatex/xecjk/xeCJK.sty b/Master/texmf-dist/tex/xelatex/xecjk/xeCJK.sty
index 69bea63c023..39ddda3be71 100644
--- a/Master/texmf-dist/tex/xelatex/xecjk/xeCJK.sty
+++ b/Master/texmf-dist/tex/xelatex/xecjk/xeCJK.sty
@@ -29,10 +29,10 @@
%%
\NeedsTeXFormat{LaTeX2e}
\RequirePackage{expl3}
-\GetIdInfo$Id: xeCJK.dtx 25e85c2 2018-02-27 02:44:39 +0800 Qing Lee <sobenlee@gmail.com> $
+\GetIdInfo$Id: xeCJK.dtx 2041e49 2018-04-07 17:31:56 +0800 Qing Lee <sobenlee@gmail.com> $
{Typesetting CJK scripts with XeLaTeX}
\ProvidesExplPackage{\ExplFileName}
- {\ExplFileDate}{3.6.1}{\ExplFileDescription}
+ {\ExplFileDate}{3.7.0}{\ExplFileDescription}
\msg_new:nnn { xeCJK } { Require-XeTeX }
{
The~xeCJK~package~requires~XeTeX~to~function.\\\\
@@ -383,6 +383,8 @@
\xeCJK_token_value_class:N #2 \exp_stop_f:
\prg_return_true: \else: \prg_return_false: \fi:
}
+\cs_new_protected_nopar:Npn \xeCJK_make_boundary:
+ { \bool_if:NT \l__xeCJK_CJK_group_bool { \scan_stop: } }
\keys_define:nn { xeCJK / options }
{
xeCJKactive .choice: ,
@@ -1317,7 +1319,7 @@
\cs_new_protected_nopar:Npn \__xeCJK_punct_bound_kern_aux:NNN #1#2
{
\str_if_eq:nnTF {#1} {#2}
- { \__xeCJK_punct_bound_kern:N }
+ { \__xeCJK_nobreak_hskip:N }
{
\__xeCJK_punct_if_long:NTF #1
{ \skip_horizontal:N }
@@ -2436,59 +2438,96 @@
\tl_if_exist:cF { \__xeCJK_punct_csname:n { dim/glue/#1/#2 } }
{ \__xeCJK_get_punct_bounds_aux:NN #1 #2 }
}
-\cs_new_protected_nopar:Npn \__xeCJK_get_punct_bounds_aux:NN #1#2
+\cs_new_protected_nopar:Npn \__xeCJK_get_punct_bounds_aux:NN
{
\tl_if_eq:NNTF \l_xeCJK_punct_style_tl \c__xeCJK_punct_style_plain_tl
- {
- \__xeCJK_save_punct_dim:nNNn { rule } #1 #2 { \c_zero_dim }
- \__xeCJK_save_punct_dim:nNNn { glue } #1 #2 { \c_zero_dim }
- \__xeCJK_save_punct_dim:nNNn { offset } #1 #2 { \c_zero_dim }
- \__xeCJK_save_punct_dim:nNNn { bound } \c__xeCJK_left_tl {#2} { \c_zero_dim }
- \__xeCJK_save_punct_dim:nNNn { bound } \c__xeCJK_right_tl {#2} { \c_zero_dim }
- \__xeCJK_save_punct_skip:nNNn { glue } #1 #2 { \c_zero_skip }
- }
- {
- { \xeCJK_select_punct_font: \xeCJK_calc_punct_dimen:N #2 }
- \dim_set:Nn \l__xeCJK_bound_dim
- { \__xeCJK_use_punct_dim:nNN { bound } #1 #2 }
- \dim_set:Nn \l__xeCJK_reverse_bound_dim
- {
- \tl_if_eq:NNTF #1 \c__xeCJK_left_tl
- { \__xeCJK_use_punct_dim:nNN { bound } \c__xeCJK_right_tl }
- { \__xeCJK_use_punct_dim:nNN { bound } \c__xeCJK_left_tl }
- #2
- }
- \UseInstance { xeCJK / punctuation } { \l_xeCJK_punct_style_tl }
- \xeCJK_punct_margin_process:NN #1 #2
- \xeCJK_punct_offset_process:NN #1 #2
- }
+ { \__xeCJK_save_punct_margin_plain:NN }
+ { \__xeCJK_save_punct_margin:NN }
}
\cs_new_protected_nopar:Npn \xeCJK_get_punct_bounds:No
{ \exp_last_unbraced:NNo \xeCJK_get_punct_bounds:NN }
+\cs_new_protected_nopar:Npn \__xeCJK_save_punct_margin_plain:NN #1#2
+ {
+ \__xeCJK_save_punct_dim:nNNn { rule } #1 #2 { \c_zero_dim }
+ \__xeCJK_save_punct_dim:nNNn { glue } #1 #2 { \c_zero_dim }
+ \__xeCJK_save_punct_dim:nNNn { offset } #1 #2 { \c_zero_dim }
+ \__xeCJK_save_punct_dim:nNNn { bound } \c__xeCJK_left_tl {#2} { \c_zero_dim }
+ \__xeCJK_save_punct_dim:nNNn { bound } \c__xeCJK_right_tl {#2} { \c_zero_dim }
+ \__xeCJK_save_punct_skip:nNNn { glue } #1 #2 { \c_zero_skip }
+ }
+\cs_new_protected_nopar:Npn \__xeCJK_save_punct_margin:NN #1#2
+ {
+ \group_begin:
+ \xeCJK_select_punct_font:
+ \xeCJK_calc_punct_dimen:N #2
+ \group_end:
+ \dim_set:Nn \l__xeCJK_bound_dim
+ { \__xeCJK_use_punct_dim:nNN { bound } #1 #2 }
+ \dim_set:Nn \l__xeCJK_reverse_bound_dim
+ {
+ \tl_if_eq:NNTF #1 \c__xeCJK_left_tl
+ { \__xeCJK_use_punct_dim:nNN { bound } \c__xeCJK_right_tl }
+ { \__xeCJK_use_punct_dim:nNN { bound } \c__xeCJK_left_tl }
+ #2
+ }
+ \UseInstance { xeCJK / punctuation } { \l_xeCJK_punct_style_tl }
+ \xeCJK_punct_margin_process:NN #1 #2
+ \xeCJK_punct_offset_process:NN #1 #2
+ \__xeCJK_punct_if_long:NT #2
+ { \__xeCJK_long_punct_kerning:N #2 }
+ }
\dim_new:N \l__xeCJK_bound_dim
\dim_new:N \l__xeCJK_reverse_bound_dim
+\cs_new_protected_nopar:Npn \__xeCJK_long_punct_kerning:N #1
+ {
+ \dim_set:Nn \l__xeCJK_tmp_dim
+ {
+ \dim_max:nn
+ { \l__xeCJK_bound_dim + \l__xeCJK_reverse_bound_dim }
+ { \c_zero_dim }
+ }
+ \__xeCJK_save_punct_dim:nNNn { bound_width } #1 #1 { \l__xeCJK_tmp_dim }
+ \dim_set:Nn \l__xeCJK_tmp_dim
+ {
+ \str_case:nnTF {#1}
+ { { ^^^^2025 } { } { ^^^^2026 } { } }
+ { \c_zero_dim }
+ { -\l__xeCJK_tmp_dim }
+ }
+ \__xeCJK_save_punct_dim:nNNn { kern } #1 #1 { \l__xeCJK_tmp_dim }
+ \__xeCJK_save_punct_skip:nNNn { kern } #1 #1 { \l__xeCJK_tmp_dim }
+ \dim_add:Nn \l__xeCJK_tmp_dim
+ { \dim_max:nn { \l__xeCJK_bound_dim } { \c_zero_dim } }
+ \__xeCJK_save_punct_dim:nNNn { bound_kern } #1 #1 { \l__xeCJK_tmp_dim }
+ \__xeCJK_save_punct_skip:nNNn { bound_kern } #1 #1 { \l__xeCJK_tmp_dim }
+ }
\cs_new_protected_nopar:Npn \xeCJK_get_punct_kerning:NN #1#2
{
\tl_if_exist:cF { \__xeCJK_punct_csname:n { dim/kern/#1/#2 } }
{
\tl_if_eq:NNTF \l_xeCJK_punct_style_tl \c__xeCJK_punct_style_plain_tl
- {
- \__xeCJK_save_punct_dim:nNNn { kern } #1 #2 { \c_zero_dim }
- \__xeCJK_save_punct_dim:nNNn { break_kern } #1 #2 { \c_zero_dim }
- \__xeCJK_save_punct_dim:nNNn { bound_kern } #1 #2 { \c_zero_dim }
- \__xeCJK_save_punct_dim:nNNn { bound_width } #1 #2 { \c_zero_dim }
- \__xeCJK_save_punct_skip:nNNn { kern } #1 #2 { \c_zero_skip }
- \__xeCJK_save_punct_skip:nNNn { break_kern } #1 #2 { \c_zero_skip }
- \__xeCJK_save_punct_skip:nNNn { bound_kern } #1 #2 { \c_zero_skip }
- }
- {
- \UseInstance { xeCJK / punctuation } { \l_xeCJK_punct_style_tl }
- \xeCJK_punct_kerning_process:NN #1 #2
- }
+ { \__xeCJK_save_punct_kerning_plain:NN }
+ { \__xeCJK_save_punct_kerning:NN }
+ #1 #2
}
}
\cs_new_protected_nopar:Npn \xeCJK_get_punct_kerning:oN
{ \exp_after:wN \xeCJK_get_punct_kerning:NN }
+\cs_new_protected_nopar:Npn \__xeCJK_save_punct_kerning_plain:NN #1#2
+ {
+ \__xeCJK_save_punct_dim:nNNn { kern } #1 #2 { \c_zero_dim }
+ \__xeCJK_save_punct_dim:nNNn { break_kern } #1 #2 { \c_zero_dim }
+ \__xeCJK_save_punct_dim:nNNn { bound_kern } #1 #2 { \c_zero_dim }
+ \__xeCJK_save_punct_dim:nNNn { bound_width } #1 #2 { \c_zero_dim }
+ \__xeCJK_save_punct_skip:nNNn { kern } #1 #2 { \c_zero_skip }
+ \__xeCJK_save_punct_skip:nNNn { break_kern } #1 #2 { \c_zero_skip }
+ \__xeCJK_save_punct_skip:nNNn { bound_kern } #1 #2 { \c_zero_skip }
+ }
+\cs_new_protected_nopar:Npn \__xeCJK_save_punct_kerning:NN
+ {
+ \UseInstance { xeCJK / punctuation } { \l_xeCJK_punct_style_tl }
+ \xeCJK_punct_kerning_process:NN
+ }
\cs_new_protected_nopar:Npn \xeCJK_punct_margin_process:NN #1#2
{
\dim_set:Nn \l__xeCJK_tmp_dim
@@ -2858,26 +2897,13 @@
{ \xeCJK_glyph_bounds:NN \c_one #1 }
\__xeCJK_save_punct_dim:nNNn { bound } \c__xeCJK_right_tl #1
{ \xeCJK_glyph_bounds:NN \c_three #1 }
- \dim_set:Nn \l__xeCJK_tmp_dim
- {
- ( \__xeCJK_use_punct_dim:nNN { bound } \c__xeCJK_left_tl #1 ) +
- ( \__xeCJK_use_punct_dim:nNN { bound } \c__xeCJK_right_tl #1 )
- }
\__xeCJK_save_punct_dim:nNn { width } #1
{ \etex_fontcharwd:D \tex_font:D `#1 }
\__xeCJK_save_punct_dim:nNn { dimen } #1
- { \__xeCJK_use_punct_dim:nN { width } #1 - \l__xeCJK_tmp_dim }
- \__xeCJK_punct_if_long:NT #1
{
- \dim_set:Nn \l__xeCJK_tmp_dim
- {
- \str_case:nnTF {#1}
- { { ^^^^2025 } { } { ^^^^2026 } { } }
- { \c_zero_dim }
- { \dim_min:nn { - \l__xeCJK_tmp_dim } { \c_zero_dim } }
- }
- \__xeCJK_save_punct_dim:nNNn { kern } #1 #1 { \l__xeCJK_tmp_dim }
- \__xeCJK_save_punct_skip:nNNn { kern } #1 #1 { \l__xeCJK_tmp_dim }
+ ( \__xeCJK_use_punct_dim:nN { width } #1 ) -
+ ( \__xeCJK_use_punct_dim:nNN { bound } \c__xeCJK_left_tl #1 ) -
+ ( \__xeCJK_use_punct_dim:nNN { bound } \c__xeCJK_right_tl #1 )
}
}
\cs_new_nopar:Npn \xeCJK_glyph_bounds:NN #1#2
@@ -4219,7 +4245,7 @@
\prop_new:N \g__xeCJK_scale_family_prop
\cs_new_protected_nopar:Npn \xeCJK_visible_space:
{
- \bool_if:NT \l__xeCJK_CJK_group_bool { \scan_stop: }
+ \xeCJK_make_boundary:
\xeCJK_glyph_if_exist:NTF { ^^^^2423 }
{ ^^^^2423 }
{
@@ -4362,7 +4388,6 @@
\xeCJKsetwidth { ^^^^2013 } { 0.5 em }
\ProcessKeysOptions { xeCJK / options }
\RequirePackage { fontspec } [ 2012/05/01 ]
-\RequirePackage { xunicode-addon }
\tl_const:Nx \c__xeCJK_encoding_tl { \g_fontspec_encoding_tl }
\keys_define:nn { xeCJK / options }
{
@@ -4562,9 +4587,6 @@
\__xeCJK_math_robust:N \endmath
}
\__xeCJK_math_robust:N \ensuremath
-\UndeclareTextCommand \nobreakspace { \UTFencname }
-\RenewDocumentCommand \nobreakspace { } { \leavevmode \nobreak \ }
-\AtBeginUTFCommand { \bool_if:NT \l__xeCJK_CJK_group_bool { \scan_stop: } }
\__xeCJK_msg_new:nn { conflict-package }
{
The~`#1'~package~is~too~old. \\
@@ -4708,80 +4730,148 @@
}
}
}
-\cs_new_eq:NN \__xeCJK_group_begin: \group_begin:
-\cs_new_eq:NN \__xeCJK_group_end: \group_end:
-\tl_map_inline:nn
+\cs_new_protected_nopar:Npn \__xeCJK_inactive_group_begin:
+ { \group_begin: \makexeCJKinactive }
+\cs_new_eq:NN \__xeCJK_inactive_group_end: \group_end:
+\prop_const_from_keyval:Nn \c__xeCJK_ambigious_char_prop
{
- \textellipsis \textendash \textemdash \textperiodcentered
- \textcentereddot \textquoteleft \textquoteright \textquotedblleft
- \textquotedblright \textcdot \textgrq \textgrqq
+ "00B7 = \textperiodcentered \textcentereddot \textcdot ,
+ "2013 = \textendash ,
+ "2014 = \textemdash ,
+ "2018 = \textquoteleft \textgrq ,
+ "2019 = \textquoteright ,
+ "201C = \textquotedblleft \textgrqq ,
+ "201D = \textquotedblright ,
+ "2025 = \texthdotfor ,
+ "2026 = \textellipsis ,
+ "2027 = \texthyphenationpoint ,
+ "2E3A = \texttwoemdash
}
+\__xeCJK_at_end_preamble:n { \__xeCJK_patch_text_command: }
+\cs_new_protected_nopar:Npn \__xeCJK_patch_text_command:
{
- \AtBeginUTFCommand [#1] { \__xeCJK_group_begin: \makexeCJKinactive }
- \AtEndUTFCommand [#1] { \__xeCJK_group_end: }
+ \xeCJK_if_package_loaded:nTF { xunicode }
+ { \__xeCJK_patch_xunicode_ambigious_char: }
+ {
+ \exp_args:Nx \__xeCJK_patch_tuenc_ambigious_char:n
+ { \UnicodeEncodingName }
+ \__xeCJK_patch_tuenc_accent:
+ \__xeCJK_patch_tuenc_composite:
+ }
}
-\__xeCJK_after_end_preamble:n { \l__xeCJK_patch_Bxii_tl }
-\tl_new:N \l__xeCJK_patch_Bxii_tl
-\cs_new_protected_nopar:Npn \__xeCJK_patch_Bxii:nN #1#2
+\cs_new_protected_nopar:Npn \__xeCJK_patch_xunicode_ambigious_char:
{
- \tl_put_right:Nx \l__xeCJK_patch_Bxii_tl
- { \__xeCJK_patch_Bxii:n { #1 \token_to_str:N #2 } }
+ \RequirePackage { xunicode-addon }
+ \prop_map_inline:Nn \c__xeCJK_ambigious_char_prop
+ {
+ \tl_map_inline:nn { ##2 }
+ {
+ \xunadd_set_begin_hook:nn { ####1 }
+ { \__xeCJK_inactive_group_begin: }
+ \xunadd_set_end_hook:nn { ####1 }
+ { \__xeCJK_inactive_group_end: }
+ }
+ }
+ \xunadd_append_begin_hook:n { \xeCJK_make_boundary: }
}
-\group_begin:
-\cs_set:Npn \__xeCJK_tmp:w #1
+\cs_new_protected_nopar:Npn \__xeCJK_patch_tuenc_ambigious_char:n #1
{
- \group_end:
- \cs_new_protected_nopar:Npn \__xeCJK_patch_Bxii:nNN ##1##2##3
+ \prop_map_inline:Nn \c__xeCJK_ambigious_char_prop
{
- \tl_put_right:Nx \l__xeCJK_patch_Bxii_tl
+ \tl_map_inline:nn { ##2 }
{
- \__xeCJK_patch_Bxii:Nnn
- #1 { ##1 \token_to_str:N ##2 } { \token_to_str:N ##3 }
+ \cs_if_exist:NF ####1
+ { \DeclareTextSymbol ####1 {#1} { ##1 } }
+ \__xeCJK_patch_ambigious_char:nN {#1} ####1
}
}
}
-\use:n
+\cs_new_protected_nopar:Npn \__xeCJK_patch_ambigious_char:nN #1#2
{
- \char_set_catcode_other:N \\
- \__xeCJK_tmp:w
+ \exp_args:Nx \__xeCJK_patch_ambigious_char:n
+ { #1 \token_to_str:N #2 }
}
- { \ }
-\cs_new_protected_nopar:Npn \__xeCJK_patch_Bxii:n #1
- { \cs_if_free:cF {#1} { \cs_gset_eq:cN {#1} \__xeCJK_Default_Bxii: } }
-\cs_new_protected_nopar:Npn \__xeCJK_patch_Bxii:Nnn #1#2#3
- { \cs_if_free:cF {#2} { \cs_gset_eq:cN { #1#2 - #3 } \__xeCJK_Default_Bxii: } }
-\group_begin:
-\char_set_catcode_other:n { 183 }
-\cs_new_protected_nopar:Npn \__xeCJK_Default_Bxii:
+\cs_new_protected_nopar:Npx \__xeCJK_patch_ambigious_char:nNn #1#2#3
+ {
+ \exp_args:Nx \exp_not:N \__xeCJK_patch_ambigious_char:n
+ {
+ \c_backslash_str #1
+ \exp_not:N \token_to_str:N #2 -
+ \exp_not:N \token_to_str:N #3
+ }
+ }
+\cs_new_protected_nopar:Npn \__xeCJK_patch_ambigious_char:n #1
+ {
+ \cs_if_free:cF {#1}
+ { \exp_args:Nc \__xeCJK_patch_ambigious_char:N {#1} }
+ }
+\cs_new_protected_nopar:Npn \__xeCJK_patch_ambigious_char:N #1
+ {
+ \cs_set_protected_nopar:Npx #1
+ {
+ \__xeCJK_ambigious_char:n
+ { \token_if_chardef:NTF #1 { \utex_char:D } { \exp_not:o } #1 }
+ }
+ }
+\cs_new_protected_nopar:Npn \__xeCJK_ambigious_char:n #1
{
\int_compare:nNnTF \xetex_interchartokenstate:D > \c_zero
- { \__xeCJK_group_begin: \makexeCJKinactive ^^b7 \__xeCJK_group_end: }
- { ^^b7 }
+ { \__xeCJK_inactive_group_begin: #1 \__xeCJK_inactive_group_end: }
+ {#1}
+ }
+\cs_new_protected_nopar:Npn \xeCJK@composite@patch
+ {
+ \str_if_eq_x:nnT { \f@encoding } { \UnicodeEncodingName }
+ { \xeCJK_make_boundary: }
+ }
+\cs_new_protected_nopar:Npn \__xeCJK_patch_tuenc_composite:
+ {
+ \cs_set_nopar:Npn \@text@composite@x ##1
+ {
+ \xeCJK@composite@patch
+ \ifx ##1 \relax
+ \expandafter \@secondoftwo
+ \else
+ \expandafter \@firstoftwo
+ \fi
+ ##1
+ }
+ }
+\group_begin:
+\char_set_catcode_other:n { "A0 }
+\cs_new_protected_nopar:Npn \__xeCJK_patch_tuenc_accent:
+ {
+ \cs_set_protected_nopar:Npn \add@unicode@accent ##1 ##2
+ {
+ \tl_if_blank:nTF { ##2 } { ^^a0 } { ##2 }
+ \utex_char:D \etex_numexpr:D ##1 \scan_stop:
+ }
}
\group_end:
-\clist_map_inline:nn
+\prop_const_from_keyval:Nn \c__xeCJK_middle_dot_prop
{
- { T3 } \textvibyy ,
- { T2A } \cyrchvcrs ,
- { T2B } \cyrchldsc ,
- { T2C } \cyrabhha ,
- { X2 } \cyrchldsc ,
- { TS1 } \textperiodcentered ,
- { LY1 } \textperiodcentered
+ T2A = \cyrchvcrs ,
+ T2B = \cyrchldsc ,
+ T2C = \cyrabhha ,
+ X2 = \cyrchldsc ,
+ TS1 = \textperiodcentered ,
+ LY1 = \textperiodcentered ,
+ T1 = \r u ,
+ T4 = \B t ,
+ T5 = \` \ecircumflex
}
- { \__xeCJK_patch_Bxii:nN #1 }
-\clist_map_inline:nn
+\__xeCJK_after_end_preamble:n { \__xeCJK_patch_middle_dot: }
+\cs_new_protected_nopar:Npn \__xeCJK_patch_middle_dot:
{
- { T1 } \r u ,
- { T4 } \B t ,
- { T5 } \` \ecircumflex ,
- { LGR } \accpsilivaria w
+ \prop_map_inline:Nn \c__xeCJK_middle_dot_prop
+ { \__xeCJK_patch_middle_dot:nw { ##1 } ##2 \q_stop }
+ \__xeCJK_patch_ambigious_char:nNn { T5 } \` { \^ - e }
}
- { \__xeCJK_patch_Bxii:nNN #1 }
-\tl_put_right:Nx \l__xeCJK_patch_Bxii_tl
+\cs_new_protected_nopar:Npn \__xeCJK_patch_middle_dot:nw #1#2#3 \q_stop
{
- \__xeCJK_patch_Bxii:n
- { \token_to_str:N \T 5 \token_to_str:N \` - \token_to_str:N \^ - e }
+ \tl_if_empty:nTF {#3}
+ { \__xeCJK_patch_ambigious_char:nN {#1} #2 }
+ { \__xeCJK_patch_ambigious_char:nNn {#1} #2 {#3} }
}
\__xeCJK_after_end_preamble:n
{
@@ -4793,15 +4883,15 @@
}
\__xeCJK_after_end_preamble:n
{
- \xeCJK_if_package_loaded:nT { hyperref }
+ \cs_if_exist_use:NT \pdfstringdefDisableCommands
{
- \pdfstringdefDisableCommands
- {
- \__xeCJK_gobble_CJKfamily:
- \xeCJK_cs_clear:N \makexeCJKinactive
- \xeCJK_cs_clear:N \__xeCJK_group_begin:
- \xeCJK_cs_clear:N \__xeCJK_group_end:
- }
+ {
+ \__xeCJK_gobble_CJKfamily:
+ \xeCJK_cs_clear:N \__xeCJK_inactive_group_begin:
+ \xeCJK_cs_clear:N \__xeCJK_inactive_group_end:
+ \xeCJK_cs_clear:N \makexeCJKinactive
+ \xeCJK_cs_clear:N \xeCJK@composite@patch
+ }
}
}
\__xeCJK_after_end_preamble:n
@@ -4848,39 +4938,20 @@
\str_if_eq:nnT {#1} { \CJK@UnicodeEnc }
{
\group_begin:
- \cs_set_eq:NN \Unicode \__xeCJK_calc_unicode:nn
- \cs_set_eq:NN \def \xeCJK_char_from_charcode:Nn
+ \cs_set_eq:NN \Unicode \xeCJK_unicode_char:nn
+ \cs_set_eq:NN \def \xdef
#2
\group_end:
- \tl_gset:Nn \CJK@tenthousand { ^^^^4e07 }
- \tl_gset:Nn \CJK@hundredmillion { ^^^^4ebf }
+ \str_gset:Nx \CJK@tenthousand { ^^^^4e07 }
+ \str_gset:Nx \CJK@hundredmillion { ^^^^4ebf }
\tl_if_exist:NF \CJK@UnicodeEnc
{ \tl_const:Nn \CJK@UnicodeEnc { UTF8 } }
\cs_if_exist:NF \Unicode
{ \cs_new_eq:NN \Unicode \xeCJK_unicode_char:nn }
}
}
-\cs_if_exist:NTF \utex_charcat:D
- {
- \cs_new_protected_nopar:Npn \xeCJK_char_from_charcode:Nn #1#2
- { \tl_const:Nx #1 { \char_generate:nn {#2} { \c_eleven } } }
- }
- {
- \cs_new_protected_nopar:Npn \xeCJK_char_from_charcode:Nn #1#2
- {
- \group_begin:
- \char_set_lccode:nn { "4E00 } {#2}
- \tex_lowercase:D
- {
- \group_end:
- \tl_const:Nn #1 { ^^^^4e00 }
- }
- }
- }
-\cs_new_nopar:Npn \__xeCJK_calc_unicode:nn #1#2
- { (#1) * \c_two_hundred_fifty_six + (#2) }
-\cs_new_protected_nopar:Npn \xeCJK_unicode_char:nn #1#2
- { \tex_char:D \etex_numexpr:D \__xeCJK_calc_unicode:nn {#1} {#2} \scan_stop: }
+\cs_new_nopar:Npn \xeCJK_unicode_char:nn #1#2
+ { \utex_char:D \etex_numexpr:D (#1) * 256 + (#2) \scan_stop: }
\bool_if:NT \g__xeCJK_config_bool
{
\ExplSyntaxOff