diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex/fontspec/fontspec-xetex.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/fontspec/fontspec-xetex.sty | 871 |
1 files changed, 656 insertions, 215 deletions
diff --git a/Master/texmf-dist/tex/latex/fontspec/fontspec-xetex.sty b/Master/texmf-dist/tex/latex/fontspec/fontspec-xetex.sty index f1815624afc..e116c14c8bc 100644 --- a/Master/texmf-dist/tex/latex/fontspec/fontspec-xetex.sty +++ b/Master/texmf-dist/tex/latex/fontspec/fontspec-xetex.sty @@ -5,25 +5,292 @@ %% The original source files were: %% %% fontspec.dtx (with options: `fontspec,xetexx') -%% -%% _________________________________________ -%% The fontspec package for XeLaTeX/LuaLaTeX -%% (C) 2004--2015 Will Robertson and Khaled Hosny -%% -%% License information appended. -%% -%% -\ProvidesPackage{fontspec-xetex} - [2015/09/24 v2.4e Font selection for XeLaTeX and LuaLaTeX] - +%% fontspec-vars.dtx (with options: `vars') +%% fontspec-msg.dtx (with options: `msg') +%% 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-keyval.dtx (with options: `fontspec,xetexx') +%% fontspec-math.dtx (with options: `fontspec,xetexx') +%% fontspec-closing.dtx (with options: `fontspec,xetexx') +%% fontspec-patches.dtx (with options: `patches') +%% ------------------------------------------------ +%% The FONTSPEC package for XeLaTeX/LuaLaTeX +%% (C) 2004--2016 Will Robertson and Khaled Hosny +%% License information appended. +%% ------------------------------------------------ +\RequirePackage{expl3} +\RequirePackage{xparse} +\ProvidesExplPackage{fontspec-xetex}% + {2016/01/30}{2.5}{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 +\bool_new:N \l__fontspec_nosc_bool +\bool_new:N \l__fontspec_check_bool +\cs_new:Npn \FontspecSetCheckBoolTrue { \bool_set_true:N \l__fontspec_check_bool } +\cs_new:Npn \FontspecSetCheckBoolFalse { \bool_set_false:N \l__fontspec_check_bool } +\bool_new:N \l__fontspec_tfm_bool +\bool_new:N \l__fontspec_atsui_bool +\bool_new:N \l__fontspec_ot_bool +\bool_new:N \l__fontspec_mm_bool +\bool_new:N \l__fontspec_graphite_bool +\bool_new:N \g__fontspec_math_euler_bool +\bool_new:N \g__fontspec_math_lucida_bool +\bool_new:N \g__fontspec_pkg_euler_loaded_bool +\bool_new:N \g__fontspec_cfg_bool +\bool_new:N \g__fontspec_math_bool +\bool_new:N \g__fontspec_euenc_bool +\int_new:N \l_fontspec_script_int +\int_new:N \l_fontspec_language_int +\int_new:N \l_fontspec_strnum_int +\fp_new:N \l__fontspec_tmpa_fp +\fp_new:N \l__fontspec_tmpb_fp +\dim_new:N \l__fontspec_tmpa_dim +\dim_new:N \l__fontspec_tmpb_dim +\dim_new:N \l__fontspec_tmpc_dim +\tl_set:Nx \c_colon_str { \tl_to_str:N : } +\cs_set:Npn \use_v:nnnnn #1#2#3#4#5 {#5} +\cs_set:Npn \use_iv:nnnnn #1#2#3#4#5 {#4} +\cs_generate_variant:Nn \str_if_eq:nnTF {nv} +\cs_generate_variant:Nn \int_set:Nn {Nv} +\cs_generate_variant:Nn \keys_set:nn {nx} +\cs_generate_variant:Nn \keys_set_known:nnN {nx} +\cs_generate_variant:Nn \tl_if_empty:nTF {x} +\cs_generate_variant:Nn \tl_if_empty:nTF {x} +\cs_generate_variant:Nn \prop_put:Nnn {Nxx} +\cs_new:Nn \__fontspec_int_mult_truncate:Nn + { + \int_set:Nn #1 { \__dim_eval:w #2 #1 \__dim_eval_end: } + } -\ExplSyntaxOn -\tl_set:Nn \g_fontspec_encoding_tl {EU1} +\cs_new:Npn \__fontspec_error:n { \msg_error:nn {fontspec} } +\cs_new:Npn \__fontspec_error:nx { \msg_error:nnx {fontspec} } +\cs_new:Npn \__fontspec_warning:n { \msg_warning:nn {fontspec} } +\cs_new:Npn \__fontspec_warning:nx { \msg_warning:nnx {fontspec} } +\cs_new:Npn \__fontspec_warning:nxx { \msg_warning:nnxx {fontspec} } +\cs_new:Npn \__fontspec_info:n { \msg_info:nn {fontspec} } +\cs_new:Npn \__fontspec_info:nx { \msg_info:nnx {fontspec} } +\cs_new:Npn \__fontspec_info:nxx { \msg_info:nnxx {fontspec} } +\cs_new:Npn \__fontspec_trace:n { \msg_trace:nn {fontspec} } +\msg_new:nnn {fontspec} {no-size-info} + { + Size~ information~ must~ be~ supplied.\\ + For~ example,~ SizeFeatures={Size={8-12},...}. + } +\msg_new:nnnn {fontspec} {font-not-found} + { + The~ font~ "#1"~ cannot~ be~ found. + } + { + A~font~might~not~be~found~for~many~reasons.\\ + Check~the~spelling,~where~the~font~is~installed~etc.~etc.\\\\ + When~in~doubt,~ask~someone~for~help! + } +\msg_new:nnnn {fontspec} {rename-feature-not-exist} + { + The~ feature~ #1~ doesn't~ appear~ to~ be~ defined. + } + { + It~ looks~ like~ you're~ trying~ to~ rename~ a~ feature~ that~ doesn't~ exist. + } +\msg_new:nnn {fontspec} {no-glyph} + { + '\l_fontspec_fontname_tl'~ does~ not~ contain~ glyph~ #1. + } +\msg_new:nnnn {fontspec} {euler-too-late} + { + The~ euler~ package~ must~ be~ loaded~ BEFORE~ fontspec. + } + { + fontspec~ only~ overwrites~ euler's~ attempt~ to~ + define~ the~ maths~ text~ fonts~ if~ fontspec~ is~ + loaded~ after~ euler.~ Type~ <return>~ to~ proceed~ + with~ incorrect~ \string\mathit,~ \string\mathbf,~ etc. + } +\msg_new:nnnn {fontspec} {no-xcolor} + { + Cannot~ load~ named~ colours~ without~ the~ xcolor~ package. + } + { + Sorry,~ I~ can't~ do~ anything~ to~ help.~ Instead~ of~ loading~ + the~ color~ package,~ use~ xcolor~ instead.~ It's~ better. + } +\msg_new:nnnn {fontspec} {unknown-color-model} + { + Error~ loading~ colour~ `#1';~ unknown~ colour~ model. + } + { + Sorry,~ I~ can't~ do~ anything~ to~ help.~ Please~ report~ this~ error~ + to~ my~ developer~ with~ a~ minimal~ example~ that~ causes~ the~ problem. + } +\msg_new:nnnn {fontspec} {not-in-addfontfeatures} + { + The~ "#1"~ font~ feature~ cannot~ be~ used~ in~ \string\addfontfeatures. + } + { + This~ is~ due~ to~ how~ TeX~ loads~ fonts;~ such~ settings~ + are~ global~ so~ adding~ them~ mid-document~ within~ a~ group~ causes~ + confusion.~ You'll~ need~ to~ define~ multiple~ font~ families~ to~ achieve~ + what~ you~ want. + } +\msg_new:nnn {fontspec} {addfontfeatures-ignored} + { + \string\addfontfeature (s)~ ignored~ \msg_line_context:;~ + it~ cannot~ be~ used~ with~ a~ font~ that~ wasn't~ selected~ by~ a~ fontspec~ command.\\ + \\ + The~ current~ font~ is~ "\use:c{font@name}".\\ + \int_compare:nTF { \clist_count:n {#1} = 1 } + { The~ requested~ feature~ is~ "#1". } + { The~ requested~ features~ are~ "#1". } + } +\msg_new:nnn {fontspec} {feature-option-overwrite} + { + Option~ '#2'~ of~ font~ feature~ '#1'~ overwritten. + } +\msg_new:nnn {fontspec} {script-not-exist-latn} + { + Font~ '\l_fontspec_fontname_tl'~ does~ not~ contain~ script~ '#1'.\\ + 'Latin'~ script~ used~ instead. + } +\msg_new:nnn {fontspec} {script-not-exist} + { + Font~ '\l_fontspec_fontname_tl'~ does~ not~ contain~ script~ '#1'. + } +\msg_new:nnn {fontspec} {aat-feature-not-exist} + { + '\l_keys_key_tl=\l_keys_value_tl'~ feature~ not~ supported~ + for~ AAT~ font~ '\l_fontspec_fontname_tl'. + } +\msg_new:nnn {fontspec} {aat-feature-not-exist-in-font} + { + AAT~ feature~ '\l_keys_key_tl=\l_keys_value_tl'~ (#1)~ not~ available~ + in~ font~ '\l_fontspec_fontname_tl'. + } +\msg_new:nnn {fontspec} {icu-feature-not-exist} + { + '\l_keys_key_tl=\l_keys_value_tl'~ feature~ not~ supported~ + for~ OpenType~ font~ '\l_fontspec_fontname_tl' + } +\msg_new:nnn {fontspec} {icu-feature-not-exist-in-font} + { + OpenType~ feature~ '\l_keys_key_tl=\l_keys_value_tl'~ (#1)~ not~ available~ + for~ font~ '\l_fontspec_fontname_tl'~ + with~ script~ '\l__fontspec_script_name_tl'~ and~ language~ '\l__fontspec_lang_name_tl'. + } +\msg_new:nnn {fontspec} {no-opticals} + { + '\l_fontspec_fontname_tl'~ doesn't~ appear~ to~ have~ an~ Optical~ Size~ axis. + } +\msg_new:nnn {fontspec} {language-not-exist} + { + Language~ '#1'~ not~ available~ + for~ font~ '\l_fontspec_fontname_tl'~ + with~ script~ '\l__fontspec_script_name_tl'.\\ + 'Default'~ language~ used~ instead. + } +\msg_new:nnn {fontspec} {only-xetex-feature} + { + Ignored~ XeTeX~ only~ feature:~ '#1'. + } +\msg_new:nnn {fontspec} {only-luatex-feature} + { + Ignored~ LuaTeX~ only~ feature:~ '#1'. + } +\msg_new:nnn {fontspec} {no-mapping} + { + Input~ mapping~ not~ (yet?)~ supported~ in~ LuaTeX. + } +\msg_new:nnn {fontspec} {no-mapping-ligtex} + { + Input~ mapping~ not~ (yet?)~ supported~ in~ LuaTeX.\\ + Use~ "Ligatures=TeX"~ instead~ of~ "Mapping=tex-text". + } +\msg_new:nnn {fontspec} {cm-default-obsolete} + { + The~ "cm-default"~ package~ option~ is~ obsolete. + } +\msg_new:nnn {fontspec} {fakebold-only-xetex} + { + The~ "FakeBold"~ and~ "AutoFakeBold"~ options~ are~ only~ available~ with~ XeLaTeX.\\ + Option~ ignored. + } +\msg_new:nnn {fontspec} {defining-font} + { + Font~ family~'\l_fontspec_family_tl'~ created~ for~ font~ '#2'~ + with~ options~ [\l__fontspec_all_features_clist].\\ + \\ + This~ font~ family~ consists~ of~ the~ following~ NFSS~ series/shapes:\\ + \l_fontspec_defined_shapes_tl + } +\msg_new:nnn {fontspec} {no-font-shape} + { + Could~ not~ resolve~ font~ #1~ (it~ probably~ doesn't~ exist). + } +\msg_new:nnn {fontspec} {set-scale} + { + \l_fontspec_fontname_tl\space scale ~=~ \l__fontspec_scale_tl. + } +\msg_new:nnn {fontspec} {setup-math} + { + Adjusting~ the~ maths~ setup~ (use~ [no-math]~ to~ avoid~ this). + } +\msg_new:nnn {fontspec} {no-scripts} + { + Font~ \l_fontspec_fontname_tl\space does~ not~ contain~ any~ OpenType~ `Script'~ information. + } +\msg_new:nnn {fontspec} {opa-twice} + { + Opacity~ set~ twice,~ in~ both~ Colour~ and~ Opacity.\\ + Using~ specification~ "Opacity=#1". + } +\msg_new:nnn {fontspec} {opa-twice-col} + { + Opacity~ set~ twice,~ in~ both~ Opacity~ and~ Colour.\\ + Using~ an~ opacity~ specification~ in~ hex~ of~ "#1/FF". + } +\msg_new:nnn {fontspec} {bad-colour} + { + Bad~ colour~ declaration~ "#1".~ + Colour~ must~ be~ one~ of:\\ + *~ a~ named~ xcolor~ colour\\ + *~ a~ six-digit~ hex~ colour~ RRGGBB\\ + *~ an~ eight-digit~ hex~ colour~ RRGGBBTT~ with~ opacity + } +\DeclareOption{cm-default} + { \__fontspec_warning:n {cm-default-obsolete} } +\DeclareOption{math}{\bool_set_true:N \g__fontspec_math_bool} +\DeclareOption{no-math}{\bool_set_false:N \g__fontspec_math_bool} +\DeclareOption{config}{\bool_set_true:N \g__fontspec_cfg_bool} +\DeclareOption{no-config}{\bool_set_false:N \g__fontspec_cfg_bool} +\DeclareOption{euenc}{\bool_set_true:N \g__fontspec_euenc_bool} +\DeclareOption{tuenc}{\bool_set_false:N \g__fontspec_euenc_bool} +\DeclareOption{quiet} + { + \msg_redirect_module:nnn { fontspec } { warning } { info } + \msg_redirect_module:nnn { fontspec } { info } { none } + } +\DeclareOption{silent} + { + \msg_redirect_module:nnn { fontspec } { warning } { none } + \msg_redirect_module:nnn { fontspec } { info } { none } + } +\ExecuteOptions{config,math,euenc} +\ProcessOptions* +\tl_set:Nn \g_fontspec_encoding_tl {TU} +\file_if_exist:nF {tuenc.def} { \bool_set_true:N \g__fontspec_euenc_bool } +\bool_if:NT \g__fontspec_euenc_bool + { + \tl_set:Nn \g_fontspec_encoding_tl {EU1} + } \tl_set:Nn \rmdefault {lmr} \tl_set:Nn \sfdefault {lmss} \tl_set:Nn \ttdefault {lmtt} \RequirePackage[\g_fontspec_encoding_tl]{fontenc} -\tl_set_eq:NN \UTFencname \g_fontspec_encoding_tl % for xunicode +\tl_set_eq:NN \UTFencname \g_fontspec_encoding_tl % for xunicode if needed +\normalsize % to overcome the encoding changing the current font size \tl_set_eq:NN \cyrillicencoding \g_fontspec_encoding_tl \tl_set_eq:NN \latinencoding \g_fontspec_encoding_tl \AtBeginDocument @@ -31,7 +298,51 @@ \tl_set_eq:NN \cyrillicencoding \g_fontspec_encoding_tl \tl_set_eq:NN \latinencoding \g_fontspec_encoding_tl } -\RequirePackage{xunicode} +\bool_if:NT \g__fontspec_euenc_bool + { + \RequirePackage{xunicode} + } + +\cs_set:Nn \__fontspec_fontwrap:n { "#1" } +\cs_set:Npn \__fontspec_primitive_font_set:Nnn #1#2#3 + { + \font #1 = #2 ~at~ #3 \scan_stop: + } + +\cs_set:Npn \__fontspec_primitive_font_gset:Nnn #1#2#3 + { + \global \font #1 = #2 ~at~ #3 \scan_stop: + } + +\cs_set:Npn \__fontspec_font_suppress_not_found_error: + { + \int_set_eq:NN \xetex_suppressfontnotfounderror:D \c_one + } + +\prg_set_conditional:Nnn \__fontspec_font_if_null:N {p,TF,T,F} + { + \ifx #1 \nullfont + \prg_return_true: + \else + \prg_return_false: + \fi + } +\cs_new:Nn \__fontspec_font_set:Nnn + { + \__fontspec_primitive_font_set:Nnn #1 { \__fontspec_fontwrap:n {#2} } {#3} + } +\cs_new:Nn \__fontspec_font_gset:Nnn + { + \__fontspec_primitive_font_gset:Nnn #1 { \__fontspec_fontwrap:n {#2} } {#3} + } +\prg_new_conditional:Nnn \font_glyph_if_exist:Nn {p,TF,T,F} + { + \etex_iffontchar:D #1 #2 \scan_stop: + \prg_return_true: + \else: + \prg_return_false: + \fi: + } \cs_new:Nn \__fontspec_pass_args:nnn { \IfNoValueTF {#2} @@ -45,8 +356,8 @@ \cs_new:Nn \__fontspec_fontspec:nn { - \fontencoding {\g_fontspec_encoding_tl} - \fontspec_set_family:Nnn \f@family {#1}{#2} + \fontspec_set_family:Nnn \f@family {#1} {#2} + \fontencoding { \l__fontspec_nfss_enc_tl } \selectfont \ignorespaces } @@ -132,8 +443,9 @@ { \exp_not:N \DeclareRobustCommand \exp_not:N #1 { - \exp_not:N \fontencoding {\g_fontspec_encoding_tl} - \exp_not:N \fontfamily { \use:c {g__fontspec_ \cs_to_str:N #1 _family} } \exp_not:N \selectfont + \exp_not:N \fontfamily { \use:c {g__fontspec_ \cs_to_str:N #1 _family} } + \exp_not:N \fontencoding { \l__fontspec_nfss_enc_tl } + \exp_not:N \selectfont } } } @@ -184,7 +496,13 @@ { \tl_set:Nx #1 {#2} \clist_map_inline:Nn \l__fontspec_extensions_clist - { \tl_remove_once:Nn #1 {##1} } + { + \tl_if_in:NnT #1 {##1} + { + \tl_remove_once:Nn #1 {##1} + \clist_map_break: + } + } } \bool_new:N \l__fontspec_disable_defaults_bool \DeclareDocumentCommand \addfontfeatures {m} @@ -192,6 +510,7 @@ \fontspec_if_fontspec_font:TF { \group_begin: + \keys_set_known:nnN {fontspec-addfeatures} {#1} \l__fontspec_tmp_tl \prop_get:cnN {g__fontspec_ \f@family _prop} {options} \l__fontspec_options_tl \prop_get:cnN {g__fontspec_ \f@family _prop} {fontname} \l__fontspec_fontname_tl \bool_set_true:N \l__fontspec_disable_defaults_bool @@ -204,7 +523,7 @@ \fontfamily\l_fontspec_family_tl\selectfont } { - \__fontspec_warning:n {addfontfeatures-ignored} + \__fontspec_warning:nx {addfontfeatures-ignored} {#1} } \ignorespaces } @@ -268,48 +587,10 @@ \DeclareDocumentCommand \newfontscript {mm} { \fontspec_new_script:nn {#1} {#2} - \fontspec_new_script:nn {#2} {#2} - } -\keys_define:nn { fontspec } { Script .choice: } -\cs_new:Nn \fontspec_new_script:nn - { - \keys_define:nn { fontspec } { Script / #1 .code:n = - \fontspec_check_script:nTF {#2} - { - \tl_set:Nn \l_fontspec_script_tl {#2} - \int_set:Nn \l_fontspec_script_int {\l_fontspec_strnum_int} - } - { - \fontspec_check_script:nTF {latn} - { - \__fontspec_warning:nx {script-not-exist-latn} {#1} - \keys_set:nn {fontspec} {Script=Latin} - } - { - \__fontspec_warning:nx {script-not-exist} {#1} - } - } - } } \DeclareDocumentCommand \newfontlanguage {mm} { \fontspec_new_lang:nn {#1} {#2} - \fontspec_new_lang:nn {#2} {#2} - } -\keys_define:nn { fontspec } { Language .choice: } -\cs_new:Nn \fontspec_new_lang:nn - { - \keys_define:nn { fontspec } { Language / #1 .code:n = - \fontspec_check_lang:nTF {#2} - { - \tl_set:Nn \l_fontspec_lang_tl {#2} - \int_set:Nn \l_fontspec_language_int {\l_fontspec_strnum_int} - } - { - \__fontspec_warning:nx {language-not-exist} {#1} - \keys_set:nn { fontspec } { Language = Default } - } - } } \DeclareDocumentCommand \DeclareFontsExtensions {m} { @@ -317,6 +598,7 @@ \tl_remove_all:Nn \l__fontspec_extensions_clist {~} } \DeclareFontsExtensions{.otf,.ttf,.OTF,.TTF,.ttc,.TTC,.dfont} + \prg_new_conditional:Nnn \fontspec_if_fontspec_font: {TF,T,F} { \cs_if_exist:cTF {g__fontspec_ \f@family _prop} \prg_return_true: \prg_return_false: @@ -497,46 +779,6 @@ \tl_set_eq:NN #1 \l_fontspec_font \tl_set_eq:NN #2 \l_fontspec_family_tl } -\cs_set:Nn \__fontspec_fontwrap:n { "#1" } -\cs_set:Npn \__fontspec_primitive_font_set:Nnn #1#2#3 - { - \font #1 = #2 ~at~ #3 \scan_stop: - } - -\cs_set:Npn \__fontspec_primitive_font_gset:Nnn #1#2#3 - { - \global \font #1 = #2 ~at~ #3 \scan_stop: - } - -\cs_set:Npn \__fontspec_font_suppress_not_found_error: - { - \int_set_eq:NN \xetex_suppressfontnotfounderror:D \c_one - } - -\prg_set_conditional:Nnn \__fontspec_font_if_null:N {p,TF,T,F} - { - \ifx #1 \nullfont - \prg_return_true: - \else - \prg_return_false: - \fi - } -\cs_new:Nn \__fontspec_font_set:Nnn - { - \__fontspec_primitive_font_set:Nnn #1 { \__fontspec_fontwrap:n {#2} } {#3} - } -\cs_new:Nn \__fontspec_font_gset:Nnn - { - \__fontspec_primitive_font_gset:Nnn #1 { \__fontspec_fontwrap:n {#2} } {#3} - } -\prg_new_conditional:Nnn \font_glyph_if_exist:Nn {p,TF,T,F} - { - \etex_iffontchar:D #1 #2 \scan_stop: - \prg_return_true: - \else: - \prg_return_false: - \fi: - } \cs_set:Nn \fontspec_select:nn { \group_begin: @@ -560,7 +802,7 @@ { \__fontspec_save_fontinfo: \__fontspec_find_autofonts: - \DeclareFontFamily{\g_fontspec_encoding_tl}{\l_fontspec_family_tl}{} + \DeclareFontFamily{\l__fontspec_nfss_enc_tl}{\l_fontspec_family_tl}{} \__fontspec_set_faces: \__fontspec_info:nxx {defining-font} {#1} {#2} } @@ -738,12 +980,12 @@ } \cs_new:Nn \__fontspec_set_faces: { - \__fontspec_add_nfssfont:oooo \mddefault \updefault \l_fontspec_fontname_tl \l__fontspec_fontfeat_up_clist - \__fontspec_add_nfssfont:oooo \bfdefault \updefault \l_fontspec_fontname_bf_tl \l__fontspec_fontfeat_bf_clist - \__fontspec_add_nfssfont:oooo \mddefault \itdefault \l_fontspec_fontname_it_tl \l__fontspec_fontfeat_it_clist - \__fontspec_add_nfssfont:oooo \mddefault \sldefault \l_fontspec_fontname_sl_tl \l__fontspec_fontfeat_sl_clist - \__fontspec_add_nfssfont:oooo \bfdefault \itdefault \l_fontspec_fontname_bfit_tl \l__fontspec_fontfeat_bfit_clist - \__fontspec_add_nfssfont:oooo \bfdefault \sldefault \l_fontspec_fontname_bfsl_tl \l__fontspec_fontfeat_bfsl_clist + \__fontspec_add_nfssfont:nnnn \mddefault \updefault \l_fontspec_fontname_tl \l__fontspec_fontfeat_up_clist + \__fontspec_add_nfssfont:nnnn \bfdefault \updefault \l_fontspec_fontname_bf_tl \l__fontspec_fontfeat_bf_clist + \__fontspec_add_nfssfont:nnnn \mddefault \itdefault \l_fontspec_fontname_it_tl \l__fontspec_fontfeat_it_clist + \__fontspec_add_nfssfont:nnnn \mddefault \sldefault \l_fontspec_fontname_sl_tl \l__fontspec_fontfeat_sl_clist + \__fontspec_add_nfssfont:nnnn \bfdefault \itdefault \l_fontspec_fontname_bfit_tl \l__fontspec_fontfeat_bfit_clist + \__fontspec_add_nfssfont:nnnn \bfdefault \sldefault \l_fontspec_fontname_bfsl_tl \l__fontspec_fontfeat_bfsl_clist \prop_map_inline:Nn \l__fontspec_nfssfont_prop { \__fontspec_set_faces_aux:nnnnn ##2 } } @@ -865,9 +1107,10 @@ } - \__fontspec_declare_shapes_normal:nn {#1} {#2} - \__fontspec_declare_shape_slanted:nn {#1} {#2} - \__fontspec_declare_shape_loginfo:nnn {#1} {#2} {#3} + \__fontspec_declare_shapes_normal:nn {#1} {#2} + \__fontspec_declare_shapes_smcaps:nn {#1} {#2} + \__fontspec_declare_shape_slanted:nn {#1} {#2} + \__fontspec_declare_shape_loginfo:nn {#1} {#2} } \cs_generate_variant:Nn \__fontspec_declare_shape:nnnn {nnxx} @@ -888,18 +1131,25 @@ } \cs_new:Nn \__fontspec_declare_shapes_normal:nn - { - \__fontspec_DeclareFontShape:xxxxxx {\g_fontspec_encoding_tl} {\l_fontspec_family_tl} + { + \__fontspec_DeclareFontShape:xxxxxx {\l__fontspec_nfss_enc_tl} {\l_fontspec_family_tl} {#1} {#2} {\l__fontspec_nfss_tl}{\l__fontspec_postadjust_tl} + } +\cs_new:Nn \__fontspec_declare_shapes_smcaps:nn + { \bool_if:NF \l__fontspec_nosc_bool { - \__fontspec_DeclareFontShape:xxxxxx {\g_fontspec_encoding_tl} {\l_fontspec_family_tl} - {#1} - {\str_if_eq_x:nnTF {#2} {\itdefault} \sidefault \scdefault} - {\l__fontspec_nfss_sc_tl}{\l__fontspec_postadjust_tl} + \__fontspec_DeclareFontShape:xxxxxx {\l__fontspec_nfss_enc_tl} {\l_fontspec_family_tl} {#1} + { \__fontspec_combo_sc_shape:n {#2} } {\l__fontspec_nfss_sc_tl} {\l__fontspec_postadjust_tl} } - } + } +\cs_new:Nn \__fontspec_combo_sc_shape:n + { + \tl_if_exist:cTF { \__fontspec_shape_merge:nn {#1} {\scdefault} } + { \tl_use:c { \__fontspec_shape_merge:nn {#1} {\scdefault} } } + { \scdefault } + } \cs_new:Nn \__fontspec_DeclareFontShape:nnnnnn { @@ -918,40 +1168,44 @@ !(\str_if_eq_x_p:nn {\itdefault} {\sldefault}) } { - \__fontspec_DeclareFontShape:xxxxxx {\g_fontspec_encoding_tl}{\l_fontspec_family_tl}{#1}{\sldefault} + \__fontspec_DeclareFontShape:xxxxxx {\l__fontspec_nfss_enc_tl}{\l_fontspec_family_tl}{#1}{\sldefault} {<->ssub*\l_fontspec_family_tl/#1/\itdefault}{\l__fontspec_postadjust_tl} } } -\cs_new:Nn \__fontspec_declare_shape_loginfo:nnn +\cs_new:Nn \__fontspec_declare_shape_loginfo:nn { \tl_gput_right:Nx \l_fontspec_defined_shapes_tl { - \exp_not:n { \\ \\ } - *~ '\exp_not:N \str_case:nnF {#1/#2} + -~ \exp_not:N \str_case:nn {#1/#2} { - {\mddefault/\updefault} {normal} - {\bfdefault/\updefault} {bold} - {\mddefault/\itdefault} {italic} - {\bfdefault/\itdefault} {bold~ italic} - } {#2/#3}'~ - with~ NFSS~ spec.: \exp_not:N \\ + {\mddefault/\updefault} {'normal'~} + {\bfdefault/\updefault} {'bold'~} + {\mddefault/\itdefault} {'italic'~} + {\mddefault/\sldefault} {'slanted'~} + {\bfdefault/\itdefault} {'bold~ italic'~} + {\bfdefault/\sldefault} {'bold~ slanted'~} + } (#1/#2)~ + with~ NFSS~ spec.:~ \l__fontspec_nfss_tl - \exp_not:n { \\ \\ } - *~ '\exp_not:N \str_case:nnF {#1/\scdefault} + \exp_not:n { \\ } + -~ \exp_not:N \str_case:nn { #1 / \__fontspec_combo_sc_shape:n {#2} } { - {\mddefault/\scdefault} {small~ caps} - {\bfdefault/\scdefault} {bold~ small~ caps} - {\mddefault/\sidefault} {italic~ small~ caps} - {\bfdefault/\sidefault} {bold~ italic~ small~ caps} - } {#2/#3}'~ - with~ NFSS~ spec.: \exp_not:N \\ + {\mddefault/\scdefault} {'small~ caps'~} + {\bfdefault/\scdefault} {'bold~ small~ caps'~} + {\mddefault/\itscdefault} {'italic~ small~ caps'~} + {\bfdefault/\itscdefault} {'bold~ italic~ small~ caps'~} + {\mddefault/\slscdefault} {'slanted~ small~ caps'~} + {\bfdefault/\slscdefault} {'bold~ slanted~ small~ caps'~} + }~( #1 / \__fontspec_combo_sc_shape:n {#2} )~ + with~ NFSS~ spec.:~ \l__fontspec_nfss_sc_tl - \tl_if_empty:NF \l__fontspec_postadjust_tl + \tl_if_empty:fF {\l__fontspec_postadjust_tl} { \exp_not:N \\ and~ font~ adjustment~ code: \exp_not:N \\ \l__fontspec_postadjust_tl } } } +\cs_generate_variant:Nn \tl_if_empty:nF {f} \clist_set:Nn \l__fontspec_pre_feat_sclist { \bool_if:NT \l__fontspec_ot_bool @@ -1020,6 +1274,7 @@ \tl_clear:N \l_fontspec_renderer_tl \tl_clear:N \l_fontspec_defined_shapes_tl \tl_clear:N \g__fontspec_curr_series_tl + \tl_gset_eq:NN \l__fontspec_nfss_enc_tl \g_fontspec_encoding_tl % This is for detecting font families when assigning default features. % Replace defaults for the standard families because they're not set in the usual way: @@ -1178,17 +1433,17 @@ \fontspec_iv_str_to_num:Nn \l_fontspec_strnum_int {#1} \int_set:Nn \l_tmpb_int { \XeTeXOTcountscripts \l_fontspec_font } \int_zero:N \l_tmpa_int - \@tempswafalse + \bool_set_false:N \l__fontspec_check_bool \bool_until_do:nn { \int_compare_p:nNn \l_tmpa_int = \l_tmpb_int } { \ifnum \XeTeXOTscripttag\l_fontspec_font \l_tmpa_int = \l_fontspec_strnum_int - \@tempswatrue + \bool_set_true:N \l__fontspec_check_bool \int_set:Nn \l_tmpa_int {\l_tmpb_int} \else \int_incr:N \l_tmpa_int \fi } - \if@tempswa \prg_return_true: \else: \prg_return_false: \fi: + \bool_if:NTF \l__fontspec_check_bool \prg_return_true: \prg_return_false: } \prg_new_conditional:Nnn \fontspec_check_lang:n {TF} { @@ -1196,17 +1451,17 @@ \int_set:Nn \l_tmpb_int { \XeTeXOTcountlanguages \l_fontspec_font \l_fontspec_script_int } \int_zero:N \l_tmpa_int - \@tempswafalse + \bool_set_false:N \l__fontspec_check_bool \bool_until_do:nn { \int_compare_p:nNn \l_tmpa_int = \l_tmpb_int } { \ifnum\XeTeXOTlanguagetag\l_fontspec_font\l_fontspec_script_int \l_tmpa_int =\l_fontspec_strnum_int - \@tempswatrue + \bool_set_true:N \l__fontspec_check_bool \int_set:Nn \l_tmpa_int {\l_tmpb_int} \else \int_incr:N \l_tmpa_int \fi } - \if@tempswa \prg_return_true: \else: \prg_return_false: \fi: + \bool_if:NTF \l__fontspec_check_bool \prg_return_true: \prg_return_false: } \prg_new_conditional:Nnn \fontspec_check_ot_feat:n {TF,T} { @@ -1218,23 +1473,29 @@ } \fontspec_v_str_to_num:Nn \l_fontspec_strnum_int {#1} \int_zero:N \l_tmpa_int - \@tempswafalse + \bool_set_false:N \l__fontspec_check_bool \bool_until_do:nn { \int_compare_p:nNn \l_tmpa_int = \l_tmpb_int } { \ifnum\XeTeXOTfeaturetag\l_fontspec_font\l_fontspec_script_int\l_fontspec_language_int \l_tmpa_int =\l_fontspec_strnum_int - \@tempswatrue + \bool_set_true:N \l__fontspec_check_bool \int_set:Nn \l_tmpa_int {\l_tmpb_int} \else \int_incr:N \l_tmpa_int \fi } - \if@tempswa \prg_return_true: \else: \prg_return_false: \fi: + \bool_if:NTF \l__fontspec_check_bool \prg_return_true: \prg_return_false: } + \cs_new:Nn \__fontspec_keys_define_code:nnn { \keys_define:nn {#1} { #2 .code:n = {#3} } } +\cs_new:Nn \__fontspec_aff_error:n + { + \__fontspec_keys_define_code:nnn {fontspec-addfeatures} {#1} + { \__fontspec_error:nx {not-in-addfontfeatures} {#1} } + } \bool_new:N \l__fontspec_external_bool \__fontspec_keys_define_code:nnn {fontspec-preparse-external} {ExternalLocation} { @@ -1428,6 +1689,10 @@ { \fontspec_complete_fontname:Nn \l__fontspec_sizedfont_tl {#1} } +\__fontspec_keys_define_code:nnn {fontspec-preparse} {NFSSEncoding} + { + \tl_gset:Nx \l__fontspec_nfss_enc_tl { #1 } + } \__fontspec_keys_define_code:nnn {fontspec-preparse} {NFSSFamily} { \tl_set:Nx \l__fontspec_nfss_fam_tl { #1 } @@ -1450,7 +1715,7 @@ } } - \__fontspec_add_nfssfont:oooo + \__fontspec_add_nfssfont:nnnn {\use_i:nnn #1}{\use_ii:nnn #1}{\l__fontspec_this_font_tl}{\l__fontspec_this_feat_tl} } \cs_new:Nn \__fontspec_add_nfssfont:nnnn @@ -1467,8 +1732,6 @@ { {#1}{#2}{\l__fontspec_this_font_tl}{#4}{\l__fontspec_sizefeat_clist} } } } -\cs_generate_variant:Nn \__fontspec_add_nfssfont:nnnn {ooo} -\cs_generate_variant:Nn \__fontspec_add_nfssfont:nnnn {oooo} \__fontspec_keys_define_code:nnn {fontspec} {Scale} { \str_case:nnF {#1} @@ -1514,6 +1777,7 @@ \bool_if:NF \l__fontspec_firsttime_bool { \_fontspec_parse_wordspace:w #1,,,\q_stop } } +\__fontspec_aff_error:n {WordSpace} \cs_set:Npn \_fontspec_parse_wordspace:w #1,#2,#3,#4 \q_stop { \tl_if_empty:nTF {#4} @@ -1554,6 +1818,7 @@ { \fontdimen 7 \font = #1 \fontdimen 7 \font } } } +\__fontspec_aff_error:n {PunctuationSpace} \__fontspec_keys_define_code:nnn {fontspec} {FontAdjustment} { \tl_put_right:Nx \l__fontspec_postadjust_tl {#1} @@ -1564,6 +1829,9 @@ } \__fontspec_keys_define_code:nnn {fontspec} {HyphenChar} { + \bool_if:NT \l__fontspec_addfontfeatures_bool + { \__fontspec_error:nx {not-in-addfontfeatures} {HyphenChar} } + \str_if_eq:nnTF {#1} {None} { \tl_put_right:Nn \l__fontspec_postadjust_tl @@ -1581,6 +1849,7 @@ { \__fontspec_error:nx {no-glyph}{#1} } } } +\__fontspec_aff_error:n {HyphenChar} \__fontspec_keys_define_code:nnn {fontspec} {Color} { \cs_if_exist:cTF { \token_to_str:N \color@ #1 } @@ -1624,7 +1893,7 @@ \tl_set:Nx \l__fontspec_opacity_tl { \int_compare:nT { \l__fontspec_tmp_int <= "F } {0} % zero pad - \int_to_hexadecimal:n { \l__fontspec_tmp_int } + \int_to_hex:n { \l__fontspec_tmp_int } } } \__fontspec_keys_define_code:nnn {fontspec} {Mapping} @@ -1939,8 +2208,34 @@ } } } +\keys_define:nn { fontspec } { Script .choice: } +\cs_new:Nn \fontspec_new_script:nn + { + \keys_define:nn { fontspec } { Script / #1 .code:n = + \clist_map_inline:nn {#2} + { + \fontspec_check_script:nTF {####1} + { + \tl_set:Nn \l_fontspec_script_tl {####1} + \int_set:Nn \l_fontspec_script_int {\l_fontspec_strnum_int} + \clist_map_break: + } + { + \fontspec_check_script:nTF {latn} + { + \__fontspec_warning:nx {script-not-exist-latn} {#1} + \keys_set:nn {fontspec} {Script=Latin} + } + { + \__fontspec_warning:nx {script-not-exist} {#1} + } + } + } + } + } \newfontscript{Arabic}{arab} \newfontscript{Armenian}{armn} -\newfontscript{Balinese}{bali} \newfontscript{Bengali}{beng} +\newfontscript{Balinese}{bali} +\newfontscript{Bengali}{bng2,beng} \newfontscript{Bopomofo}{bopo} \newfontscript{Braille}{brai} \newfontscript{Buginese}{bugi} \newfontscript{Buhid}{buhd} \newfontscript{Byzantine~Music}{byzm} @@ -1949,24 +2244,29 @@ \newfontscript{CJK~Ideographic}{hani} \newfontscript{Coptic}{copt} \newfontscript{Cypriot~Syllabary}{cprt} \newfontscript{Cyrillic}{cyrl} \newfontscript{Default}{DFLT} \newfontscript{Deseret}{dsrt} -\newfontscript{Devanagari}{deva} \newfontscript{Ethiopic}{ethi} +\newfontscript{Devanagari}{dev2,deva} +\newfontscript{Ethiopic}{ethi} \newfontscript{Georgian}{geor} \newfontscript{Glagolitic}{glag} \newfontscript{Gothic}{goth} \newfontscript{Greek}{grek} -\newfontscript{Gujarati}{gujr} \newfontscript{Gurmukhi}{guru} +\newfontscript{Gujarati}{gjr2,gujr} +\newfontscript{Gurmukhi}{gur2,guru} \newfontscript{Hangul~Jamo}{jamo} \newfontscript{Hangul}{hang} \newfontscript{Hanunoo}{hano} \newfontscript{Hebrew}{hebr} \newfontscript{Hiragana~and~Katakana}{kana} -\newfontscript{Javanese}{java} \newfontscript{Kannada}{knda} +\newfontscript{Javanese}{java} +\newfontscript{Kannada}{knd2,knda} \newfontscript{Kharosthi}{khar} \newfontscript{Khmer}{khmr} \newfontscript{Lao}{lao~} \newfontscript{Latin}{latn} \newfontscript{Limbu}{limb} \newfontscript{Linear~B}{linb} -\newfontscript{Malayalam}{mlym} \newfontscript{Math}{math} +\newfontscript{Malayalam}{mlm2,mlym} +\newfontscript{Math}{math} \newfontscript{Mongolian}{mong} \newfontscript{Musical~Symbols}{musc} \newfontscript{Myanmar}{mymr} \newfontscript{N'ko}{nko~} \newfontscript{Ogham}{ogam} \newfontscript{Old~Italic}{ital} \newfontscript{Old~Persian~Cuneiform}{xpeo} -\newfontscript{Oriya}{orya} \newfontscript{Osmanya}{osma} +\newfontscript{Oriya}{ory2,orya} +\newfontscript{Osmanya}{osma} \newfontscript{Phags-pa}{phag} \newfontscript{Phoenician}{phnx} \newfontscript{Runic}{runr} \newfontscript{Shavian}{shaw} \newfontscript{Sinhala}{sinh} @@ -1974,13 +2274,29 @@ \newfontscript{Syloti~Nagri}{sylo} \newfontscript{Syriac}{syrc} \newfontscript{Tagalog}{tglg} \newfontscript{Tagbanwa}{tagb} \newfontscript{Tai~Le}{tale} \newfontscript{Tai~Lu}{talu} -\newfontscript{Tamil}{taml} \newfontscript{Telugu}{telu} +\newfontscript{Tamil}{tml2,taml} +\newfontscript{Telugu}{tel2,telu} \newfontscript{Thaana}{thaa} \newfontscript{Thai}{thai} \newfontscript{Tibetan}{tibt} \newfontscript{Tifinagh}{tfng} \newfontscript{Ugaritic~Cuneiform}{ugar}\newfontscript{Yi}{yi~~} \newfontscript{Kana}{kana} \newfontscript{Maths}{math} \newfontscript{CJK}{hani} +\keys_define:nn { fontspec } { Language .choice: } +\cs_new:Nn \fontspec_new_lang:nn + { + \keys_define:nn { fontspec } { Language / #1 .code:n = + \fontspec_check_lang:nTF {#2} + { + \tl_set:Nn \l_fontspec_lang_tl {#2} + \int_set:Nn \l_fontspec_language_int {\l_fontspec_strnum_int} + } + { + \__fontspec_warning:nx {language-not-exist} {#1} + \keys_set:nn { fontspec } { Language = Default } + } + } + } \newfontlanguage{Abaza}{ABA}\newfontlanguage{Abkhazian}{ABK} \newfontlanguage{Adyghe}{ADY}\newfontlanguage{Afrikaans}{AFK} \newfontlanguage{Afar}{AFR}\newfontlanguage{Agaw}{AGW} @@ -2207,43 +2523,6 @@ { \__fontspec_update_featstr:n {#1} } -\providecommand*{\sidefault}{si} -\DeclareRobustCommand{\sishape} - { - \not@math@alphabet\sishape\relax - \fontshape\sidefault\selectfont - } -\DeclareTextFontCommand{\textsi}{\sishape} -\cs_new:Nn \fontspec_blend_shape:nnn - { - \bool_if:nTF - { - \str_if_eq_x_p:nn {\f@shape} {#2} && - \cs_if_exist_p:c {\f@encoding/\f@family/\f@series/#3} - } - { \fontshape{#3}\selectfont } - { \fontshape{#1}\selectfont } - } -\DeclareRobustCommand \itshape - { - \not@math@alphabet\itshape\mathit - \fontspec_blend_shape:nnn\itdefault\scdefault\sidefault - } -\DeclareRobustCommand \slshape - { - \not@math@alphabet\slshape\relax - \fontspec_blend_shape:nnn\sldefault\scdefault\sidefault - } -\DeclareRobustCommand \scshape - { - \not@math@alphabet\scshape\relax - \fontspec_blend_shape:nnn\scdefault\itdefault\sidefault - } -\DeclareRobustCommand \upshape - { - \not@math@alphabet\upshape\relax - \fontspec_blend_shape:nnn\updefault\sidefault\scdefault - } \@ifpackageloaded{euler} { \bool_set_true:N \g__fontspec_pkg_euler_loaded_bool @@ -2346,7 +2625,7 @@ { \ifx\define@antt@mathversions a\bool_set_false:N \g__fontspec_math_bool\fi }{} - \@ifpackageloaded{arev}{\bool_set_false:N \g__fontspec_math_bool}{} + \@ifpackageloaded{arevmath}{\bool_set_false:N \g__fontspec_math_bool}{} \@ifpackageloaded{eulervm}{\bool_set_false:N \g__fontspec_math_bool}{} \@ifpackageloaded{mathdesign}{\bool_set_false:N \g__fontspec_math_bool}{} \@ifpackageloaded{concmath}{\bool_set_false:N \g__fontspec_math_bool}{} @@ -2379,39 +2658,201 @@ } } \AtBeginDocument{\fontspec_maybe_setup_maths:} +\tl_set:Nn \zf@enc { \g_fontspec_encoding_tl } +\cs_set:Npn \zf@fontspec #1 #2 + { + \fontspec_select: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} {} {\typeout{No~ fontspec.cfg~ file~ found;~ no~ configuration~ loaded.}} } -\tl_set:Nn \zf@enc { \g_fontspec_encoding_tl } -\cs_set:Npn \zf@fontspec #1 #2 +\providecommand*\itscdefault{\itdefault\scdefault} +\providecommand*\slscdefault{\sldefault\scdefault} +\DeclareRobustCommand{\sishape} { - \fontspec_select:nn {#1} {#2} - \tl_set:Nn \zf@family { \l_fontspec_family_tl } - \tl_set:Nn \zf@basefont { \l_fontspec_font } + \not@math@alphabet\sishape\relax + \fontshape{\itscdefault}\selectfont } -\ExplSyntaxOff -%% -%% Copyright 2004--2015 Will Robertson <wspr81@gmail.com> +\DeclareTextFontCommand{\textsi}{\sishape} +\cs_new:Nn \__fontspec_shape_merge:nn { c__fontspec_shape_#1_#2_tl } +\tl_const:cn { \__fontspec_shape_merge:nn \itdefault \scdefault } {\itscdefault} +\tl_const:cn { \__fontspec_shape_merge:nn \sldefault \scdefault } {\slscdefault} +\tl_const:cn { \__fontspec_shape_merge:nn \scdefault \itdefault } {\itscdefault} +\tl_const:cn { \__fontspec_shape_merge:nn \scdefault \sldefault } {\slscdefault} +\tl_const:cn { \__fontspec_shape_merge:nn \slscdefault \itdefault } {\itscdefault} +\tl_const:cn { \__fontspec_shape_merge:nn \itscdefault \sldefault } {\slscdefault} +\tl_const:cn { \__fontspec_shape_merge:nn \itscdefault \updefault } {\scdefault} +\tl_const:cn { \__fontspec_shape_merge:nn \slscdefault \updefault } {\scdefault} +\cs_new:Nn \fontspec_merge_shape:n + { + \bool_if:nTF + { + \tl_if_exist_p:c { \__fontspec_shape_merge:nn {\f@shape} {#1} } && + \cs_if_exist_p:c + { + \f@encoding/\f@family/\f@series/ + \tl_use:c { \__fontspec_shape_merge:nn {\f@shape} {#1} } + } + } + { \fontshape { \tl_use:c { \__fontspec_shape_merge:nn {\f@shape} {#1} } } \selectfont } + { \fontshape {#1} \selectfont } + } +\DeclareRobustCommand \itshape + { + \not@math@alphabet\itshape\mathit + \fontspec_merge_shape:n\itdefault + } +\DeclareRobustCommand \slshape + { + \not@math@alphabet\slshape\relax + \fontspec_merge_shape:n\sldefault + } +\DeclareRobustCommand \scshape + { + \not@math@alphabet\scshape\relax + \fontspec_merge_shape:n\scdefault + } +\DeclareRobustCommand \upshape + { + \not@math@alphabet\upshape\relax + \fontspec_merge_shape:n\updefault + } +\int_new:N \l__fontspec_em_int +\int_new:N \l__fontspec_emdef_int +\cs_new_protected:Npn \emfontdeclare #1 + { + \int_zero:N \l__fontspec_emdef_int + \clist_map_inline:nn {#1} + { + \int_incr:N \l__fontspec_emdef_int + \cs_set:cpn {__fontspec_em_font_ \int_use:N \l__fontspec_emdef_int _switch:} {##1} + } + } +\DeclareRobustCommand \em + { + \@nomath\em + \int_incr:N \l__fontspec_em_int + \use:c {__fontspec_em_font_ \int_use:N \l__fontspec_em_int _switch:} + } +\DeclareTextFontCommand{\emph}{\em} +\cs_set:Npn \emshape { \itshape } +\cs_set:Npn \eminnershape { \upshape } +\emfontdeclare{ \emshape, \eminnershape } +\DeclareRobustCommand{\-} + { + \discretionary + { + \char\ifnum\hyphenchar\font<\z@ + \xlx@defaulthyphenchar + \else + \hyphenchar\font + \fi + }{}{} + } +\def\xlx@defaulthyphenchar{`\-} +\cs_new:Nn \fontspec_visible_space: + { + \font_glyph_if_exist:NnTF \font {"2423} + { \char"2423\scan_stop: } + { \fontspec_visible_space_fallback: } + } +\cs_new:Nn \fontspec_visible_space_fallback: + { + { + \usefont{\g_fontspec_encoding_tl}{lmtt}{\f@series}{\f@shape} + \textvisiblespace + } + } +\group_begin: +\char_set_catcode_active:n{"20}% +\cs_gset:Npn\fontspec_print_visible_spaces:{% +\char_set_catcode_active:n{"20}% +\cs_set_eq:NN^^20\fontspec_visible_space:% +}% +\group_end: +\def\verb + { + \relax\ifmmode\hbox\else\leavevmode\null\fi + \bgroup + \verb@eol@error \let\do\@makeother \dospecials + \verbatim@font\@noligs + \@ifstar\__fontspecsverb\@verb + } +\def\__fontspecsverb{\fontspec_print_visible_spaces:\@sverb} +\AtBeginDocument + { + \fontspec_patch_verbatim: + \fontspec_patch_moreverb: + \fontspec_patch_fancyvrb: + \fontspec_patch_listings: + } +\cs_set:Npn \fontspec_patch_verbatim: + { + \@ifpackageloaded{verbatim} + { + \cs_set:cpn {verbatim*} + { + \group_begin: \@verbatim \fontspec_print_visible_spaces: \verbatim@start + } + } + { + \cs_set:cpn {verbatim*} + { + \@verbatim \fontspec_print_visible_spaces: \@sxverbatim + } + } + } +\cs_set:Npn \fontspec_patch_moreverb: + { + \@ifpackageloaded{moreverb}{ + \cs_set:cpn {listingcont*} + { + \cs_set:Npn \verbatim@processline + { + \thelisting@line \global\advance\listing@line\c_one + \the\verbatim@line\par + } + \@verbatim \fontspec_print_visible_spaces: \verbatim@start + } + }{} + } +\cs_set:Npn \fontspec_patch_fancyvrb: + { + \@ifpackageloaded{fancyvrb} + { + \cs_set_eq:NN \FancyVerbSpace \fontspec_visible_space: + }{} + } +\cs_set:Npn \fontspec_patch_listings: + { + \@ifpackageloaded{listings} + { + \cs_set_eq:NN \lst@visiblespace \fontspec_visible_space: + }{} + } +\RenewDocumentCommand \oldstylenums {m} + { + { \addfontfeature{Numbers=OldStyle} #1 } + } +\NewDocumentCommand \liningnums {m} + { + { \addfontfeature{Numbers=Lining} #1 } + } +%% ------------------------------------------------ +%% Copyright 2004--2016 Will Robertson <wspr81@gmail.com> %% Copyright 2009--2013 Khaled Hosny <khaledhosny@eglug.org> %% -%% Distributable under the LaTeX Project Public License, -%% version 1.3c or higher (your choice). The latest version of -%% this license is at: http://www.latex-project.org/lppl.txt +%% Distributable under the LaTeX Project Public License, version 1.3c or higher. +%% The latest version of this license is at: http://www.latex-project.org/lppl.txt %% %% This work is "maintained" by Will Robertson. -%% -%% This work consists of this file fontspec.dtx -%% and the derived files fontspec.sty, -%% fontspec.lua, -%% fontspec.cfg, -%% fontspec-xetex.sty, -%% fontspec-luatex.sty, -%% fontspec-patches.sty, -%% fontspec-example.tex, -%% and fontspec.pdf. -%% +%% It consists of the files: fontspec*.dtx, fontspec.cfg, fontspec-example.tex. +%% And the derived files: fontspec*.sty,fontspec.lua, and fontspec.pdf. +%% ------------------------------------------------ %% %% End of file `fontspec-xetex.sty'. |