summaryrefslogtreecommitdiff
path: root/macros/xetex/generic/xetexko/xetexko-font.sty
diff options
context:
space:
mode:
Diffstat (limited to 'macros/xetex/generic/xetexko/xetexko-font.sty')
-rw-r--r--macros/xetex/generic/xetexko/xetexko-font.sty134
1 files changed, 71 insertions, 63 deletions
diff --git a/macros/xetex/generic/xetexko/xetexko-font.sty b/macros/xetex/generic/xetexko/xetexko-font.sty
index 8227485991..d03ae1a18b 100644
--- a/macros/xetex/generic/xetexko/xetexko-font.sty
+++ b/macros/xetex/generic/xetexko/xetexko-font.sty
@@ -1,6 +1,6 @@
% xetexko-font.sty
%
-% Copyright (c) 2013-2018 Dohyun Kim <nomos at ktug org>
+% Copyright (c) 2013-2019 Dohyun Kim <nomos at ktug org>
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3c
@@ -10,7 +10,7 @@
% and version 1.3c or later is part of all distributions of LaTeX
% version 2006/05/20 or later.
-\ProvidesPackage{xetexko-font}[2018/08/08 v2.21 LaTeX Font commands for XeTeX-ko]
+\ProvidesPackage{xetexko-font}[2019/12/01 v2.22 LaTeX Font commands for XeTeX-ko]
\let\xetexko@f@size\f@size
\RequirePackage{fontspec}[2018/07/30]
@@ -25,30 +25,35 @@
% hangul font options
\tl_new:N \l_xtxko_font_opts_tl
\tl_new:N \l_xtxko_font_opts_init_tl
+\tl_new:N \l_xtxko_hangul_font_opts_init_tl
+\tl_new:N \l_xtxko_hanja_font_opts_init_tl
+\tl_new:N \l_xtxko_rem_tl
+\int_const:Nn \c__xtxko_one_int { 1 }
+\int_const:Nn \c__xtxko_two_int { 2 }
\tl_set:Nn \l_xtxko_font_opts_init_tl
{
- \tl_clear:N \xetexkointerhchar
- \tl_clear:N \xetexkolowerexclamation
- \tl_clear:N \xetexkolowerperiod
- \tl_clear:N \xetexkolowercomma
- \tl_clear:N \xetexkolowerquestion
- \tl_clear:N \xetexkopostexclamationkern
- \tl_clear:N \xetexkopostperiodkern
- \tl_clear:N \xetexkopostcommakern
- \tl_clear:N \xetexkopostquestionkern
- \tl_clear:N \xetexkopreexclamationkern
- \tl_clear:N \xetexkopreperiodkern
- \tl_clear:N \xetexkoprecommakern
- \tl_clear:N \xetexkoprequestionkern
- \tl_clear:N \xetexkoquoteraise
- \tl_clear:N \xetexkoquotewidth
- \tl_clear:N \xetexkocharraise
- \tl_set:Nn \xetexkohu {0.05em}
- \tl_set:Nn \xetexkopostmathskip {\dim_eval:n {\xetexkohu*2}}
+ \cs_set_eq:NN \xetexkointerhchar \c_empty_tl
+ \cs_set_eq:NN \xetexkolowerexclamation \c_empty_tl
+ \cs_set_eq:NN \xetexkolowerperiod \c_empty_tl
+ \cs_set_eq:NN \xetexkolowercomma \c_empty_tl
+ \cs_set_eq:NN \xetexkolowerquestion \c_empty_tl
+ \cs_set_eq:NN \xetexkopostexclamationkern \c_empty_tl
+ \cs_set_eq:NN \xetexkopostperiodkern \c_empty_tl
+ \cs_set_eq:NN \xetexkopostcommakern \c_empty_tl
+ \cs_set_eq:NN \xetexkopostquestionkern \c_empty_tl
+ \cs_set_eq:NN \xetexkopreexclamationkern \c_empty_tl
+ \cs_set_eq:NN \xetexkopreperiodkern \c_empty_tl
+ \cs_set_eq:NN \xetexkoprecommakern \c_empty_tl
+ \cs_set_eq:NN \xetexkoprequestionkern \c_empty_tl
+ \cs_set_eq:NN \xetexkoquoteraise \c_empty_tl
+ \cs_set_eq:NN \xetexkoquotewidth \c_empty_tl
+ \cs_set_eq:NN \xetexkocharraise \c_empty_tl
+ \cs_set_nopar:Npn \xetexkohu {0.05em}
+ \cs_set_nopar:Npn \xetexkopostmathskip {\dim_eval:n {\xetexkohu*2}}
}
\cs_new:Nn \__xtxko_add_font_opt:Nn
{
- \tl_put_right:Nn \l_xtxko_font_opts_tl { \tl_set:Nn #1 {#2} }
+ \tl_put_right:Nn \l_xtxko_font_opts_tl { \cs_set_nopar:Npn #1 {#2} }
}
\keys_define:nn { xtxko-font }
{
@@ -93,7 +98,6 @@
PunctRaise .meta:n = { lowerperiod = { \dim_eval:n {-#1} } } ,
CharRaise .meta:n = { charraise = {#1} } ,
}
-\tl_new:N \l_xtxko_rem_tl
\tl_set_eq:NN \l_xtxko_hangul_font_opts_init_tl \l_xtxko_font_opts_init_tl
\cs_new:Nn \__xtxko_hangul_assign_font_opts:n
{
@@ -108,24 +112,24 @@
}
\cs_new:Nn \__xtxko_def_XKhan__fonts:nnn
{
- \tl_if_eq:NNF #1 \relax
+ \cs_if_eq:NNF #1 \relax
{
- \tl_if_eq:ccT \familydefault #2
+ \str_if_eq:eeT \familydefault #2
{
- \tl_if_eq:NNTF \XKhangulfont #1
+ \cs_if_eq:NNTF \XKhangulfont #1
{
- \tl_set:Nn #1
+ \cs_set_nopar:Npn #1
{
\XK@storeltnfont
- \chardef\XKcurrentfont \c_one #3
+ \chardef\XKcurrentfont \c__xtxko_one_int #3
\XK@storecjkfont
}
}
{
- \tl_set:Nn #1
+ \cs_set_nopar:Npn #1
{
\XK@storeltnfont
- \chardef\XKcurrentfont \c_two #3
+ \chardef\XKcurrentfont \c__xtxko_two_int #3
\XK@storecjkfont
}
}
@@ -184,10 +188,10 @@
\__xtxko_hangul_assign_font_opts:n {#1,#3}
\setfontfamily \XK@adhoc@hangul@font [\l_xtxko_rem_tl] {#2}
\tl_put_right:NV \XK@adhoc@hangul@font \l_xtxko_font_opts_tl
- \tl_set:Nn \XKhangulfont
+ \cs_set_nopar:Npn \XKhangulfont
{
\XK@storeltnfont
- \tl_set_eq:NN \XKcurrentfont \c_one
+ \cs_set_eq:NN \XKcurrentfont \c__xtxko_one_int
\XK@adhoc@hangul@font
\XK@storecjkfont
}
@@ -199,10 +203,10 @@
\__xtxko_hanja_assign_font_opts:n {#1,#3}
\setfontfamily \XK@adhoc@hanja@font [\l_xtxko_rem_tl] {#2}
\tl_put_right:NV \XK@adhoc@hanja@font \l_xtxko_font_opts_tl
- \tl_set:Nn \XKhanjafont
+ \cs_set_nopar:Npn \XKhanjafont
{
\XK@storeltnfont
- \tl_set_eq:NN \XKcurrentfont \c_two
+ \cs_set_eq:NN \XKcurrentfont \c__xtxko_two_int
\XK@adhoc@hanja@font
\XK@storecjkfont
}
@@ -213,16 +217,14 @@
\DeclareDocumentCommand \newhangulfontfamily { m O{} m O{} }
{
\__xtxko_hangul_assign_font_opts:n {#2,#4}
- \exp_args:Nc \setfontfamily { XK@newfont@family \token_to_str:N #1 }
- [\l_xtxko_rem_tl] {#3}
- \tl_put_right:cV { XK@newfont@family \token_to_str:N #1 }
- \l_xtxko_font_opts_tl
+ \exp_args:Nc \setfontfamily { XK@newfont@family \token_to_str:N #1 } [\l_xtxko_rem_tl] {#3}
+ \tl_put_right:cV { XK@newfont@family \token_to_str:N #1 } \l_xtxko_font_opts_tl
\DeclareRobustCommand #1
{
- \tl_set:Nn \XKhangulfont
+ \cs_set_nopar:Npn \XKhangulfont
{
\XK@storeltnfont
- \tl_set_eq:NN \XKcurrentfont \c_one
+ \cs_set_eq:NN \XKcurrentfont \c__xtxko_one_int
\use:c { XK@newfont@family \token_to_str:N #1 }
\XK@storecjkfont
}
@@ -231,16 +233,14 @@
\DeclareDocumentCommand \newhanjafontfamily { m O{} m O{} }
{
\__xtxko_hanja_assign_font_opts:n {#2,#4}
- \exp_args:Nc \setfontfamily { XK@newfont@family \token_to_str:N #1 }
- [\l_xtxko_rem_tl] {#3}
- \tl_put_right:cV { XK@newfont@family \token_to_str:N #1 }
- \l_xtxko_font_opts_tl
+ \exp_args:Nc \setfontfamily { XK@newfont@family \token_to_str:N #1 } [\l_xtxko_rem_tl] {#3}
+ \tl_put_right:cV { XK@newfont@family \token_to_str:N #1 } \l_xtxko_font_opts_tl
\DeclareRobustCommand #1
{
- \tl_set:Nn \XKhanjafont
+ \cs_set_nopar:Npn \XKhanjafont
{
\XK@storeltnfont
- \tl_set_eq:NN \XKcurrentfont \c_two
+ \cs_set_eq:NN \XKcurrentfont \c__xtxko_two_int
\use:c { XK@newfont@family \token_to_str:N #1 }
\XK@storecjkfont
}
@@ -249,16 +249,14 @@
\DeclareDocumentCommand \newhangulfontface { m O{} m O{} }
{
\__xtxko_hangul_assign_font_opts:n {#2,#4}
- \exp_args:Nc \newfontface { XK@newfont@family \token_to_str:N #1 }
- [\l_xtxko_rem_tl] {#3}
- \tl_put_right:cV { XK@newfont@family \token_to_str:N #1 }
- \l_xtxko_font_opts_tl
+ \exp_args:Nc \newfontface { XK@newfont@family \token_to_str:N #1 } [\l_xtxko_rem_tl] {#3}
+ \tl_put_right:cV { XK@newfont@family \token_to_str:N #1 } \l_xtxko_font_opts_tl
\DeclareRobustCommand #1
{
- \tl_set:Nn \XKhangulfont
+ \cs_set_nopar:Npn \XKhangulfont
{
\XK@storeltnfont
- \tl_set_eq:NN \XKcurrentfont \c_one
+ \cs_set_eq:NN \XKcurrentfont \c__xtxko_one_int
\use:c { XK@newfont@family \token_to_str:N #1 }
\XK@storecjkfont
}
@@ -267,16 +265,14 @@
\DeclareDocumentCommand \newhanjafontface { m O{} m O{} }
{
\__xtxko_hanja_assign_font_opts:n {#2,#4}
- \exp_args:Nc \newfontface { XK@newfont@family \token_to_str:N #1 }
- [\l_xtxko_rem_tl] {#3}
- \tl_put_right:cV { XK@newfont@family \token_to_str:N #1 }
- \l_xtxko_font_opts_tl
+ \exp_args:Nc \newfontface { XK@newfont@family \token_to_str:N #1 } [\l_xtxko_rem_tl] {#3}
+ \tl_put_right:cV { XK@newfont@family \token_to_str:N #1 } \l_xtxko_font_opts_tl
\DeclareRobustCommand #1
{
- \tl_set:Nn \XKhanjafont
+ \cs_set_nopar:Npn \XKhanjafont
{
\XK@storeltnfont
- \tl_set_eq:NN \XKcurrentfont \c_two
+ \cs_set_eq:NN \XKcurrentfont \c__xtxko_two_int
\use:c { XK@newfont@family \token_to_str:N #1 }
\XK@storecjkfont
}
@@ -293,7 +289,7 @@
\use:x
{
\group_end:
- \exp_not:N \tl_set:Nn \exp_not:N \XKhangulfont
+ \exp_not:N \cs_set_nopar:Npn \exp_not:N \XKhangulfont
{
\exp_not:V \XKhangulfont
\exp_not:N \fontfamily { \f@family } \exp_not:N \selectfont
@@ -314,7 +310,7 @@
\use:x
{
\group_end:
- \exp_not:N \tl_set:Nn \exp_not:N \XKhanjafont
+ \exp_not:N \cs_set_nopar:Npn \exp_not:N \XKhanjafont
{
\exp_not:V \XKhanjafont
\exp_not:N \fontfamily { \f@family } \exp_not:N \selectfont
@@ -382,20 +378,32 @@
\RenewDocumentCommand \setmainfont { O{} m O{} }
{
\__fontspec_main_setmainfont:nn {#1,#3} {#2}
- \protected\edef\rmfamily{\unexpanded\expandafter{\rmfamily\XK@rm@korean@font}}
+ \cs_set_protected_nopar:Npx \rmfamily
+ {
+ \exp_not:V \rmfamily
+ \exp_not:N \XK@rm@korean@font
+ }
\ignorespaces
}
\RenewDocumentCommand \setsansfont { O{} m O{} }
{
\__fontspec_main_setsansfont:nn {#1,#3} {#2}
- \protected\edef\sffamily{\unexpanded\expandafter{\sffamily\XK@sf@korean@font}}
+ \cs_set_protected_nopar:Npx \sffamily
+ {
+ \exp_not:V \sffamily
+ \exp_not:N \XK@sf@korean@font
+ }
\ignorespaces
}
\RenewDocumentCommand \setmonofont { O{} m O{} }
{
\__fontspec_main_setmonofont:nn {#1,#3} {#2}
- \protected\edef\ttfamily{\unexpanded\expandafter{\ttfamily\XK@tt@korean@font
- \disablehangulspacing}}
+ \cs_set_protected_nopar:Npx \ttfamily
+ {
+ \exp_not:V \ttfamily
+ \exp_not:N \XK@tt@korean@font
+ \exp_not:N \disablehangulspacing
+ }
\ignorespaces
}
\cs_set_eq:NN \setromanfont \setmainfont