summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/fontspec/fontspec-xetex.sty
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/latex/fontspec/fontspec-xetex.sty')
-rw-r--r--Master/texmf-dist/tex/latex/fontspec/fontspec-xetex.sty298
1 files changed, 158 insertions, 140 deletions
diff --git a/Master/texmf-dist/tex/latex/fontspec/fontspec-xetex.sty b/Master/texmf-dist/tex/latex/fontspec/fontspec-xetex.sty
index 6ff78f06dbb..ee1f0dbdf01 100644
--- a/Master/texmf-dist/tex/latex/fontspec/fontspec-xetex.sty
+++ b/Master/texmf-dist/tex/latex/fontspec/fontspec-xetex.sty
@@ -4,26 +4,27 @@
%%
%% The original source files were:
%%
-%% fontspec.dtx (with options: `fontspec,xetexx')
-%% fontspec-vars.dtx (with options: `fontspec,xetexx')
-%% fontspec-msg.dtx (with options: `fontspec,xetexx')
-%% fontspec-opening.dtx (with options: `fontspec,xetexx')
-%% fontspec-fontload.dtx (with options: `fontspec,xetexx')
-%% fontspec-user.dtx (with options: `fontspec,xetexx')
-%% fontspec-api.dtx (with options: `fontspec,xetexx')
-%% fontspec-internal.dtx (with options: `fontspec,xetexx')
-%% fontspec-opentype.dtx (with options: `fontspec,xetexx')
-%% fontspec-graphite.dtx (with options: `fontspec,xetexx')
-%% fontspec-keyval.dtx (with options: `fontspec,xetexx')
-%% fontspec-feat-opentype.dtx (with options: `fontspec,xetexx')
-%% fontspec-scripts.dtx (with options: `fontspec,xetexx')
-%% fontspec-lang.dtx (with options: `fontspec,xetexx')
-%% fontspec-feat-aat.dtx (with options: `fontspec,xetexx')
-%% fontspec-enc.dtx (with options: `fontspec,xetexx')
-%% fontspec-math.dtx (with options: `fontspec,xetexx')
-%% fontspec-closing.dtx (with options: `fontspec,xetexx')
-%% fontspec-xfss.dtx (with options: `fontspec,xetexx')
-%% fontspec-patches.dtx (with options: `fontspec,xetexx')
+%% fontspec.dtx (with options: `fontspec,XE,xetexx')
+%% fontspec-vars.dtx (with options: `fontspec,XE,xetexx')
+%% fontspec-msg.dtx (with options: `fontspec,XE,xetexx')
+%% fontspec-opening.dtx (with options: `fontspec,XE,xetexx')
+%% fontspec-fontload.dtx (with options: `fontspec,XE,xetexx')
+%% fontspec-interfaces.dtx (with options: `fontspec,XE,xetexx')
+%% fontspec-user.dtx (with options: `fontspec,XE,xetexx')
+%% fontspec-api.dtx (with options: `fontspec,XE,xetexx')
+%% fontspec-internal.dtx (with options: `fontspec,XE,xetexx')
+%% fontspec-opentype.dtx (with options: `fontspec,XE,xetexx')
+%% fontspec-graphite.dtx (with options: `fontspec,XE,xetexx')
+%% fontspec-keyval.dtx (with options: `fontspec,XE,xetexx')
+%% fontspec-feat-opentype.dtx (with options: `fontspec,XE,xetexx')
+%% fontspec-scripts.dtx (with options: `fontspec,XE,xetexx')
+%% fontspec-lang.dtx (with options: `fontspec,XE,xetexx')
+%% fontspec-feat-aat.dtx (with options: `fontspec,XE,xetexx')
+%% fontspec-enc.dtx (with options: `fontspec,XE,xetexx')
+%% fontspec-math.dtx (with options: `fontspec,XE,xetexx')
+%% fontspec-closing.dtx (with options: `fontspec,XE,xetexx')
+%% fontspec-xfss.dtx (with options: `fontspec,XE,xetexx')
+%% fontspec-patches.dtx (with options: `fontspec,XE,xetexx')
%% ------------------------------------------------
%% The FONTSPEC package for XeLaTeX/LuaLaTeX
%% (C) 2004--2017 Will Robertson and Khaled Hosny
@@ -32,7 +33,7 @@
\RequirePackage{expl3}
\RequirePackage{xparse}
\ProvidesExplPackage{fontspec-xetex}%
- {2017/08/14}{2.6d}{Font selection for XeLaTeX and LuaLaTeX}
+ {2017/09/22}{2.6e}{Font selection for XeLaTeX and LuaLaTeX}
\bool_new:N \l__fontspec_firsttime_bool
\bool_new:N \l__fontspec_nobf_bool
\bool_new:N \l__fontspec_noit_bool
@@ -468,24 +469,116 @@
\prg_return_false:
\fi:
}
+\cs_new:Nn \__fontspec_primitive_font_set_hyphenchar:Nn
+ {
+ \tex_hyphenchar:D #1 = #2 \scan_stop:
+ }
\NewDocumentCommand \fontspec { O{} m O{} }
{
- \__fontspec_main_fontspec:nnn {#1} {#2} {#3}
+ \__fontspec_main_fontspec:nn {#1,#3} {#2}
+ }
+\NewDocumentCommand \setmainfont { O{} m O{} }
+ {
+ \__fontspec_main_setmainfont:nn {#1,#3} {#2}
+ }
+\NewDocumentCommand \setsansfont { O{} m O{} }
+ {
+ \__fontspec_main_setsansfont:nn {#1,#3} {#2}
+ }
+\NewDocumentCommand \setmonofont { O{} m O{} }
+ {
+ \__fontspec_main_setmonofont:nn {#1,#3} {#2}
+ }
+\NewDocumentCommand \setmathrm { O{} m O{} }
+ {
+ \__fontspec_main_setmathrm:nn {#1,#3} {#2}
+ }
+\NewDocumentCommand \setboldmathrm { O{} m O{} }
+ {
+ \__fontspec_main_setboldmathrm:nn {#1,#3} {#2}
+ }
+\NewDocumentCommand \setmathsf { O{} m O{} }
+ {
+ \__fontspec_main_setmathsf:nn {#1,#3} {#2}
+ }
+\NewDocumentCommand \setmathtt { O{} m O{} }
+ {
+ \__fontspec_main_setmathtt:nn {#1,#3} {#2}
+ }
+\NewDocumentCommand \setromanfont { O{} m O{} }
+ {
+ \__fontspec_main_setmainfont:nn {#1,#3} {#2}
+ }
+\NewDocumentCommand \newfontfamily { m O{} m O{} }
+ {
+ \__fontspec_main_newfontfamily:nnn {#1} {#2,#4} {#3}
+ }
+\NewDocumentCommand \newfontface { m O{} m O{} }
+ {
+ \__fontspec_main_newfontface:nnn {#1} {#2,#4} {#3}
+ }
+\NewDocumentCommand \defaultfontfeatures { t+ o m }
+ {
+ \__fontspec_main_defaultfontfeatures:nnn {#1} {#2} {#3}
+ }
+\NewDocumentCommand \addfontfeatures {m}
+ {
+ \__fontspec_main_addfontfeatures:n {#1}
+ }
+\NewDocumentCommand \addfontfeature {m}
+ {
+ \__fontspec_main_addfontfeatures:n {#1}
+ }
+\NewDocumentCommand \newfontfeature {mm}
+ {
+ \__fontspec_main_newfontfeature:nn {#1} {#2}
+ }
+\NewDocumentCommand \newAATfeature {mmmm}
+ {
+ \__fontspec_main_newAATfeature:nnnn {#1} {#2} {#3} {#4}
+ }
+\NewDocumentCommand \newopentypefeature {mmm}
+ {
+ \__fontspec_main_newopentypefeature:nnn {#1} {#2} {#3}
+ }
+\NewDocumentCommand \newICUfeature {mmm}
+ {
+ \__fontspec_main_newopentypefeature:nnn {#1} {#2} {#3}
+ }
+\NewDocumentCommand \aliasfontfeature {mm}
+ {
+ \__fontspec_main_aliasfontfeature:nn {#1} {#2}
+ }
+\NewDocumentCommand \aliasfontfeatureoption {mmm}
+ {
+ \__fontspec_main_aliasfontfeatureoption:nnn {#1} {#2} {#3}
+ }
+\NewDocumentCommand \newfontscript {mm}
+ {
+ \fontspec_new_script:nn {#1} {#2}
+ }
+\NewDocumentCommand \newfontlanguage {mm}
+ {
+ \fontspec_new_lang:nn {#1} {#2}
+ }
+\NewDocumentCommand \DeclareFontsExtensions {m}
+ {
+ \__fontspec_main_DeclareFontsExtensions:n {#1}
+ }
+\NewDocumentCommand \IfFontFeatureActiveTF {mmm}
+ {
+ \__fontspec_main_IfFontFeatureActiveTF:nnn {#1} {#2} {#3}
}
-\cs_set:Nn \__fontspec_main_fontspec:nnn
+\cs_set:Nn \__fontspec_main_fontspec:nn
{
- \fontspec_set_family:Nnn \f@family {#1,#3} {#2}
+ \fontspec_set_family:Nnn \f@family {#1} {#2}
\fontencoding { \l__fontspec_nfss_enc_tl }
\selectfont
\ignorespaces
}
-\DeclareDocumentCommand \setmainfont { O{} m O{} }
- {
- \__fontspec_main_setmainfont:nnn {#1} {#2} {#3}
- }
-\cs_set:Nn \__fontspec_main_setmainfont:nnn
+\cs_set:Nn \__fontspec_main_setmainfont:nn
{
- \fontspec_set_family:Nnn \g__fontspec_rmfamily_family {#1,#3} {#2}
+ \fontspec_set_family:Nnn \g__fontspec_rmfamily_family {#1} {#2}
\tl_set_eq:NN \rmdefault \g__fontspec_rmfamily_family
\use:x { \exp_not:n { \DeclareRobustCommand \rmfamily }
{
@@ -496,16 +589,13 @@
}
\str_if_eq_x:nnT {\familydefault} {\rmdefault}
{ \tl_set_eq:NN \encodingdefault \l__fontspec_nfss_enc_tl }
+ \__fontspec_setmainfont_hook:nn {#1} {#2}
\normalfont
\ignorespaces
}
-\DeclareDocumentCommand \setsansfont { O{} m O{} }
- {
- \__fontspec_main_setsansfont:nnn {#1} {#2} {#3}
- }
-\cs_set:Nn \__fontspec_main_setsansfont:nnn
+\cs_set:Nn \__fontspec_main_setsansfont:nn
{
- \fontspec_set_family:Nnn \g__fontspec_sffamily_family {#1,#3} {#2}
+ \fontspec_set_family:Nnn \g__fontspec_sffamily_family {#1} {#2}
\tl_set_eq:NN \sfdefault \g__fontspec_sffamily_family
\use:x { \exp_not:n { \DeclareRobustCommand \sffamily }
{
@@ -516,16 +606,13 @@
}
\str_if_eq_x:nnT {\familydefault} {\sfdefault}
{ \tl_set_eq:NN \encodingdefault \l__fontspec_nfss_enc_tl }
+ \__fontspec_setsansfont_hook:nn {#1} {#2}
\normalfont
\ignorespaces
}
-\DeclareDocumentCommand \setmonofont { O{} m O{} }
- {
- \__fontspec_main_setmonofont:nnn {#1} {#2} {#3}
- }
-\cs_set:Nn \__fontspec_main_setmonofont:nnn
+\cs_set:Nn \__fontspec_main_setmonofont:nn
{
- \fontspec_set_family:Nnn \g__fontspec_ttfamily_family {#1,#3} {#2}
+ \fontspec_set_family:Nnn \g__fontspec_ttfamily_family {#1} {#2}
\tl_set_eq:NN \ttdefault \g__fontspec_ttfamily_family
\use:x { \exp_not:n { \DeclareRobustCommand \ttfamily }
{
@@ -536,45 +623,37 @@
}
\str_if_eq_x:nnT {\familydefault} {\ttdefault}
{ \tl_set_eq:NN \encodingdefault \l__fontspec_nfss_enc_tl }
+ \__fontspec_setmonofont_hook:nn {#1} {#2}
\normalfont
\ignorespaces
}
-\DeclareDocumentCommand \setromanfont { O{} m O{} }
+\cs_set:Nn \__fontspec_main_setmathrm:nn
{
- \__fontspec_main_setmainfont:nnn {#1} {#2} {#3}
+ \fontspec_set_family:Nnn \g__fontspec_mathrm_tl {#1} {#2}
+ \__fontspec_setmathrm_hook:nn {#1} {#2}
}
-\DeclareDocumentCommand \setmathrm { O{} m O{} }
+\cs_set:Nn \__fontspec_main_setboldmathrm:nn
{
- \__fontspec_main_setmathrm:nnn {#1} {#2} {#3}
+ \fontspec_set_family:Nnn \g__fontspec_bfmathrm_tl {#1} {#2}
+ \__fontspec_setboldmathrm_hook:nn {#1} {#2}
}
-\cs_set:Nn \__fontspec_main_setmathrm:nnn
- {
- \fontspec_set_family:Nnn \g__fontspec_mathrm_tl {#1} {#2}
- }
-\DeclareDocumentCommand \setboldmathrm { O{} m O{} }
- {
- \__fontspec_main_setboldmathrm:nnn {#1} {#2} {#3}
- }
-\cs_set:Nn \__fontspec_main_setboldmathrm:nnn
- {
- \fontspec_set_family:Nnn \g__fontspec_bfmathrm_tl {#1} {#2}
- }
-\DeclareDocumentCommand \setmathsf { O{} m O{} }
+\cs_set:Nn \__fontspec_main_setmathsf:nn
{
- \__fontspec_main_setmathsf:nnn {#1} {#2} {#3}
+ \fontspec_set_family:Nnn \g__fontspec_mathsf_tl {#1} {#2}
+ \__fontspec_setmathsf_hook:nn {#1} {#2}
}
-\cs_set:Nn \__fontspec_main_setmathsf:nnn
- {
- \fontspec_set_family:Nnn \g__fontspec_mathsf_tl {#1} {#2}
- }
-\DeclareDocumentCommand \setmathtt { O{} m O{} }
+\cs_set:Nn \__fontspec_main_setmathtt:nn
{
- \__fontspec_main_setmathtt:nnn {#1} {#2} {#3}
+ \fontspec_set_family:Nnn \g__fontspec_mathtt_tl {#1} {#2}
+ \__fontspec_setmathtt_hook:nn {#1} {#2}
}
-\cs_set:Nn \__fontspec_main_setmathtt:nnn
- {
- \fontspec_set_family:Nnn \g__fontspec_mathtt_tl {#1} {#2}
- }
+\cs_set_eq:NN \__fontspec_setmainfont_hook:nn \use_none:nn
+\cs_set_eq:NN \__fontspec_setsansfont_hook:nn \use_none:nn
+\cs_set_eq:NN \__fontspec_setmonofont_hook:nn \use_none:nn
+\cs_set_eq:NN \__fontspec_setmathrm_hook:nn \use_none:nn
+\cs_set_eq:NN \__fontspec_setmathsf_hook:nn \use_none:nn
+\cs_set_eq:NN \__fontspec_setmathtt_hook:nn \use_none:nn
+\cs_set_eq:NN \__fontspec_setboldmathrm_hook:nn \use_none:nn
\@onlypreamble\setmathrm
\@onlypreamble\setboldmathrm
\@onlypreamble\setmathsf
@@ -582,13 +661,9 @@
\tl_set:Nn \g__fontspec_mathrm_tl {\rmdefault}
\tl_set:Nn \g__fontspec_mathsf_tl {\sfdefault}
\tl_set:Nn \g__fontspec_mathtt_tl {\ttdefault}
-\DeclareDocumentCommand \newfontfamily { m O{} m O{} }
- {
- \__fontspec_main_newfontfamily:nnnn {#1} {#2} {#3} {#4}
- }
-\cs_set:Nn \__fontspec_main_newfontfamily:nnnn
+\cs_set:Nn \__fontspec_main_newfontfamily:nnn
{
- \fontspec_set_family:cnn { g__fontspec_ \cs_to_str:N #1 _family } {#2,#4} {#3}
+ \fontspec_set_family:cnn { g__fontspec_ \cs_to_str:N #1 _family } {#2} {#3}
\use:x
{
\exp_not:N \DeclareRobustCommand \exp_not:N #1
@@ -599,15 +674,11 @@
}
}
}
-\DeclareDocumentCommand \newfontface { m O{} m O{} }
- {
- \__fontspec_main_newfontface:nnnn {#1} {#2} {#3} {#4}
- }
-\cs_set:Nn \__fontspec_main_newfontface:nnnn
+\cs_set:Nn \__fontspec_main_newfontface:nnn
{
- \newfontfamily #1 [ BoldFont={},ItalicFont={},SmallCapsFont={},#2,#4 ] {#3}
+ \newfontfamily #1 [ BoldFont={},ItalicFont={},SmallCapsFont={},#2 ] {#3}
}
-\DeclareDocumentCommand \defaultfontfeatures { t+ o m }
+\cs_set:Nn \__fontspec_main_defaultfontfeatures:nnn
{
\IfNoValueTF {#2}
{ \__fontspec_set_default_features:nn {#1} {#3} }
@@ -641,10 +712,6 @@
}
}
}
-\DeclareDocumentCommand \addfontfeatures {m}
- {
- \__fontspec_main_addfontfeatures:n {#1}
- }
\cs_set:Nn \__fontspec_main_addfontfeatures:n
{
\fontspec_if_fontspec_font:TF
@@ -667,11 +734,6 @@
}
\ignorespaces
}
-\cs_set_eq:NN \addfontfeature \addfontfeatures
-\DeclareDocumentCommand \newfontfeature {mm}
- {
- \__fontspec_main_newfontfeature:nn {#1} {#2}
- }
\cs_set:Nn \__fontspec_main_newfontfeature:nn
{
\keys_define:nn { fontspec }
@@ -682,10 +744,6 @@
}
}
}
-\DeclareDocumentCommand \newAATfeature {mmmm}
- {
- \__fontspec_main_newAATfeature:nnnn {#1} {#2} {#3} {#4}
- }
\cs_set:Nn \__fontspec_main_newAATfeature:nnnn
{
\keys_if_exist:nnF { fontspec } {#1}
@@ -696,10 +754,6 @@
\__fontspec_define_aat_feature:nnnn {#1}{#2}{#3}{#4}
}
-\DeclareDocumentCommand \newopentypefeature {mmm}
- {
- \__fontspec_main_newopentypefeature:nnn {#1} {#2} {#3}
- }
\cs_set:Nn \__fontspec_main_newopentypefeature:nnn
{
\keys_if_exist:nnF { fontspec / options } {#1}
@@ -716,14 +770,6 @@
{
\str_case:nnF {#1} { {+} {#2} {-} {#2} } {#1#2}
}
-\DeclareDocumentCommand \newICUfeature {mmm}
- {
- \__fontspec_main_newopentypefeature:nnn {#1} {#2} {#3}
- }
-\DeclareDocumentCommand \aliasfontfeature {mm}
- {
- \__fontspec_main_aliasfontfeature:nn {#1} {#2}
- }
\cs_set:Nn \__fontspec_main_aliasfontfeature:nn
{
\bool_set_false:N \l__fontspec_alias_bool
@@ -741,10 +787,6 @@
\bool_if:NF \l__fontspec_alias_bool
{ \__fontspec_warning:nx {rename-feature-not-exist} {#1} }
}
-\DeclareDocumentCommand \aliasfontfeatureoption {mmm}
- {
- \__fontspec_main_aliasfontfeatureoption:nnn {#1} {#2} {#3}
- }
\cs_set:Nn \__fontspec_main_aliasfontfeatureoption:nnn
{
\bool_set_false:N \l__fontspec_alias_bool
@@ -774,29 +816,12 @@
\bool_if:NF \l__fontspec_alias_bool
{ \__fontspec_warning:nx {rename-feature-not-exist} {#1/#2} }
}
-\DeclareDocumentCommand \newfontscript {mm}
- {
- \fontspec_new_script:nn {#1} {#2}
- }
-\DeclareDocumentCommand \newfontlanguage {mm}
- {
- \fontspec_new_lang:nn {#1} {#2}
- }
-\DeclareDocumentCommand \DeclareFontsExtensions {m}
- {
- \__fontspec_main_DeclareFontsExtensions:n {#1}
- }
\cs_set:Nn \__fontspec_main_DeclareFontsExtensions:n
{
\clist_set:Nn \l__fontspec_extensions_clist { #1 }
\tl_remove_all:Nn \l__fontspec_extensions_clist {~}
}
\DeclareFontsExtensions{.otf,.ttf,.OTF,.TTF,.ttc,.TTC,.dfont}
-
-\DeclareDocumentCommand \IfFontFeatureActiveTF {mmm}
- {
- \__fontspec_main_IfFontFeatureActiveTF:nnn {#1} {#2} {#3}
- }
\cs_set:Nn \__fontspec_main_IfFontFeatureActiveTF:nnn
{
\__fontspec_if_font_feature:nTF {#1} {#2} {#3}
@@ -1075,7 +1100,7 @@
}
\group_end:
}
-\cs_set_eq:NN \fontspec_select:nn \__fontspec_select_font_family:nn
+\cs_set_eq:NN \fontspec_select:nn \__fontspec_select_font_family:nn %% deprecated, for compatibility only
\cs_new:Nn \__fontspec_sanitise_fontname:Nn
{
\tl_set:Nx #1 {#2}
@@ -2319,13 +2344,13 @@
}
\__fontspec_keys_define_code:nnn {fontspec} {HyphenChar}
{
- \__fontspec_warning:nx {only-xetex-feature} {HyphenChar}
\str_if_eq:nnTF {#1} {None}
{
\tl_put_right:Nn \l__fontspec_postadjust_tl
- { \hyphenchar \font = -1 \relax }
+ { \__fontspec_primitive_font_set_hyphenchar:Nn \font {-1} }
}
{
+ \__fontspec_warning:nx {only-xetex-feature} {HyphenChar}
\tl_if_single:nTF {#1}
{ \tl_set:Nn \l_fontspec_hyphenchar_tl {`#1} }
@@ -2334,7 +2359,7 @@
\__fontspec_primitive_font_glyph_if_exist:NnTF \l_fontspec_font {\l_fontspec_hyphenchar_tl}
{
\tl_put_right:Nn \l__fontspec_postadjust_tl
- { \hyphenchar \font = \l_fontspec_hyphenchar_tl \scan_stop: }
+ { \__fontspec_primitive_font_set_hyphenchar:Nn \font { \l_fontspec_hyphenchar_tl } }
}
{ \__fontspec_error:nx {no-glyph}{#1} }
@@ -3734,13 +3759,6 @@
}
}
\AtBeginDocument{\fontspec_maybe_setup_maths:}
-\tl_set:Nn \zf@enc { \g_fontspec_encoding_tl }
-\cs_set:Npn \zf@fontspec #1 #2
- {
- \__fontspec_select_font_family:nn {#1} {#2}
- \tl_set:Nn \zf@family { \l_fontspec_family_tl }
- \tl_set:Nn \zf@basefont { \l_fontspec_font }
- }
\bool_if:NT \g__fontspec_cfg_bool
{
\InputIfFileExists{fontspec.cfg}