From 3e7a5bba844bbc4aca70a24ec2f32ee902592c98 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Fri, 31 Mar 2017 23:22:58 +0000 Subject: fontspec (31mar17) git-svn-id: svn://tug.org/texlive/trunk@43661 c570f23f-e606-0410-a88d-b1316a301751 --- .../tex/latex/fontspec/fontspec-xetex.sty | 160 +++++++++++++++++---- 1 file changed, 130 insertions(+), 30 deletions(-) (limited to 'Master/texmf-dist/tex/latex/fontspec/fontspec-xetex.sty') diff --git a/Master/texmf-dist/tex/latex/fontspec/fontspec-xetex.sty b/Master/texmf-dist/tex/latex/fontspec/fontspec-xetex.sty index 5162253dd0b..89a2168a0b8 100644 --- a/Master/texmf-dist/tex/latex/fontspec/fontspec-xetex.sty +++ b/Master/texmf-dist/tex/latex/fontspec/fontspec-xetex.sty @@ -32,7 +32,7 @@ \RequirePackage{expl3} \RequirePackage{xparse} \ProvidesExplPackage{fontspec-xetex}% - {2017/02/12}{2.6}{Font selection for XeLaTeX and LuaLaTeX} + {2017/03/31}{2.6a}{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 @@ -467,6 +467,10 @@ \fi: } \NewDocumentCommand \fontspec { O{} m O{} } + { + \__fontspec_main_fontspec:nnn {#1} {#2} {#3} + } +\cs_set:Nn \__fontspec_main_fontspec:nnn { \fontspec_set_family:Nnn \f@family {#1,#3} {#2} \fontencoding { \l__fontspec_nfss_enc_tl } @@ -474,6 +478,10 @@ \ignorespaces } \DeclareDocumentCommand \setmainfont { O{} m O{} } + { + \__fontspec_main_setmainfont:nnn {#1} {#2} {#3} + } +\cs_set:Nn \__fontspec_main_setmainfont:nnn { \fontspec_set_family:Nnn \g__fontspec_rmfamily_family {#1,#3} {#2} \tl_set_eq:NN \rmdefault \g__fontspec_rmfamily_family @@ -490,6 +498,10 @@ \ignorespaces } \DeclareDocumentCommand \setsansfont { O{} m O{} } + { + \__fontspec_main_setsansfont:nnn {#1} {#2} {#3} + } +\cs_set:Nn \__fontspec_main_setsansfont:nnn { \fontspec_set_family:Nnn \g__fontspec_sffamily_family {#1,#3} {#2} \tl_set_eq:NN \sfdefault \g__fontspec_sffamily_family @@ -506,6 +518,10 @@ \ignorespaces } \DeclareDocumentCommand \setmonofont { O{} m O{} } + { + \__fontspec_main_setmonofont:nnn {#1} {#2} {#3} + } +\cs_set:Nn \__fontspec_main_setmonofont:nnn { \fontspec_set_family:Nnn \g__fontspec_ttfamily_family {#1,#3} {#2} \tl_set_eq:NN \ttdefault \g__fontspec_ttfamily_family @@ -521,23 +537,39 @@ \normalfont \ignorespaces } -\cs_set_eq:NN \setromanfont \setmainfont +\DeclareDocumentCommand \setromanfont { O{} m O{} } + { + \__fontspec_main_setmainfont:nnn {#1} {#2} {#3} + } \DeclareDocumentCommand \setmathrm { O{} m O{} } + { + \__fontspec_main_setmathrm:nnn {#1} {#2} {#3} + } +\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{} } + { + \__fontspec_main_setmathsf:nnn {#1} {#2} {#3} + } +\cs_set:Nn \__fontspec_main_setmathsf:nnn { \fontspec_set_family:Nnn \g__fontspec_mathsf_tl {#1} {#2} } - \DeclareDocumentCommand \setmathtt { O{} m O{} } + { + \__fontspec_main_setmathtt:nnn {#1} {#2} {#3} + } +\cs_set:Nn \__fontspec_main_setmathtt:nnn { \fontspec_set_family:Nnn \g__fontspec_mathtt_tl {#1} {#2} } @@ -549,6 +581,10 @@ \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 { \fontspec_set_family:cnn { g__fontspec_ \cs_to_str:N #1 _family } {#2,#4} {#3} \use:x @@ -562,21 +598,25 @@ } } \DeclareDocumentCommand \newfontface { m O{} m O{} } + { + \__fontspec_main_newfontface:nnnn {#1} {#2} {#3} {#4} + } +\cs_set:Nn \__fontspec_main_newfontface:nnnn { \newfontfamily #1 [ BoldFont={},ItalicFont={},SmallCapsFont={},#2,#4 ] {#3} } \DeclareDocumentCommand \defaultfontfeatures { t+ o m } - { - \IfNoValueTF {#2} - { \__fontspec_set_default_features:nn {#1} {#3} } - { \__fontspec_set_font_default_features:nnn {#1} {#2} {#3} } - \ignorespaces - } + { + \IfNoValueTF {#2} + { \__fontspec_set_default_features:nn {#1} {#3} } + { \__fontspec_set_font_default_features:nnn {#1} {#2} {#3} } + \ignorespaces + } \cs_new:Nn \__fontspec_set_default_features:nn - { - \IfBooleanTF {#1} \clist_put_right:Nn \clist_set:Nn - \g__fontspec_default_fontopts_clist {#2} - } + { + \IfBooleanTF {#1} \clist_put_right:Nn \clist_set:Nn + \g__fontspec_default_fontopts_clist {#2} + } \cs_new:Nn \__fontspec_set_font_default_features:nnn { \clist_map_inline:nn {#2} @@ -600,6 +640,10 @@ } } \DeclareDocumentCommand \addfontfeatures {m} + { + \__fontspec_main_addfontfeatures:n {#1} + } +\cs_set:Nn \__fontspec_main_addfontfeatures:n { \fontspec_if_fontspec_font:TF { @@ -623,6 +667,10 @@ } \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 } { @@ -633,14 +681,24 @@ } } \DeclareDocumentCommand \newAATfeature {mmmm} + { + \__fontspec_main_newAATfeature:nnnn {#1} {#2} {#3} {#4} + } +\cs_set:Nn \__fontspec_main_newAATfeature:nnnn { \keys_if_exist:nnF { fontspec } {#1} { \__fontspec_define_aat_feature_group:n {#1} } + \keys_if_choice_exist:nnnT {fontspec} {#1} {#2} { \__fontspec_warning:nxx {feature-option-overwrite} {#1} {#2} } + \__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} { \__fontspec_define_opentype_feature_group:n {#1} } @@ -648,15 +706,23 @@ \keys_if_choice_exist:nnnT {fontspec} {#1} {#2} { \__fontspec_warning:nxx {feature-option-overwrite} {#1} {#2} } - \exp_args:Nnnx \__fontspec_define_opentype_feature:nnnnn {#1}{#2}{ \__fontspec_strip_plus_minus:n {#3} }{#3}{} + \exp_args:Nnnx \__fontspec_define_opentype_feature:nnnnn + {#1} {#2} { \__fontspec_strip_plus_minus:n {#3} } {#3} {} } - \cs_new:Nn \__fontspec_strip_plus_minus:n { \__fontspec_strip_plus_minus_aux:Nq #1 \q_nil } \cs_new:Npn \__fontspec_strip_plus_minus_aux:Nq #1#2 \q_nil - { \str_case:nnF {#1} { {+} {#2} {-} {#2} } {#1#2} } - -\cs_set_eq:NN \newICUfeature \newopentypefeature % deprecated + { + \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 @@ -674,6 +740,10 @@ { \__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 @@ -685,6 +755,18 @@ \keys_define:nn { ##1 / #1 } { #3 .code:n = { \keys_set:nn {##1} { #1 = {#2} } } } } + + \keys_if_exist:nnT { ##1 / #1 } {#2Reset} + { + \keys_define:nn { ##1 / #1 } + { #3Reset .code:n = { \keys_set:nn {##1} { #1 = {#2Reset} } } } + } + + \keys_if_exist:nnT { ##1 / #1 } {#2Off} + { + \keys_define:nn { ##1 / #1 } + { #3Off .code:n = { \keys_set:nn {##1} { #1 = {#2Off} } } } + } } \bool_if:NF \l__fontspec_alias_bool @@ -699,6 +781,10 @@ \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 {~} @@ -706,6 +792,10 @@ \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} } @@ -1557,16 +1647,26 @@ } } \cs_new:Nn \__fontspec_define_opentype_feature:nnnnn - { - \__fontspec_feat_prop_add:nn {#3} {#1\,=\,#2} - \keys_define:nn {fontspec-opentype} - { - #1/#2 .code:n = - { - \__fontspec_make_OT_feature:nnn {#3} {#4} {#5} - } - } - } + { + \__fontspec_feat_prop_add:nn {#3} {#1\,=\,#2} + \tl_if_empty:nTF {#4} + { + \keys_define:nn {fontspec-opentype} + { + #1/#2 .code:n = + { \__fontspec_remove_clashing_featstr:n {#5} } + } + } + { + \keys_define:nn {fontspec-opentype} + { + #1/#2 .code:n = + { + \__fontspec_make_OT_feature:nnn {#3} {#4} {#5} + } + } + } + } \cs_new:Nn \__fontspec_feat_off:n {#1Off} \cs_new:Nn \__fontspec_feat_reset:n {#1Reset} \cs_new:Nn \__fontspec_define_opentype_onoffreset:nnnnn -- cgit v1.2.3