diff options
author | Karl Berry <karl@freefriends.org> | 2017-01-22 22:34:22 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2017-01-22 22:34:22 +0000 |
commit | 4f70a140932277cc2ef6292e47ebe25c5d8c3230 (patch) | |
tree | 09c23cbf4ffd71fde1b8049902f73511adef85d9 /Master/texmf-dist/tex/latex/fontspec/fontspec-xetex.sty | |
parent | 60a21cad39ca930406807ef85e67b5b3f8407b2a (diff) |
fontspec (22jan17)
git-svn-id: svn://tug.org/texlive/trunk@43016 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/fontspec/fontspec-xetex.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/fontspec/fontspec-xetex.sty | 2928 |
1 files changed, 1886 insertions, 1042 deletions
diff --git a/Master/texmf-dist/tex/latex/fontspec/fontspec-xetex.sty b/Master/texmf-dist/tex/latex/fontspec/fontspec-xetex.sty index 272a2f4257c..c8a4e568aa7 100644 --- a/Master/texmf-dist/tex/latex/fontspec/fontspec-xetex.sty +++ b/Master/texmf-dist/tex/latex/fontspec/fontspec-xetex.sty @@ -5,26 +5,33 @@ %% The original source files were: %% %% fontspec.dtx (with options: `fontspec,xetexx') -%% fontspec-vars.dtx (with options: `vars') -%% fontspec-msg.dtx (with options: `msg') +%% 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-patches.dtx (with options: `patches') +%% fontspec-patches.dtx (with options: `fontspec,xetexx') %% ------------------------------------------------ %% The FONTSPEC package for XeLaTeX/LuaLaTeX -%% (C) 2004--2016 Will Robertson and Khaled Hosny +%% (C) 2004--2017 Will Robertson and Khaled Hosny %% License information appended. %% ------------------------------------------------ \RequirePackage{expl3} \RequirePackage{xparse} \ProvidesExplPackage{fontspec-xetex}% - {2016/02/01}{2.5a}{Font selection for XeLaTeX and LuaLaTeX} + {2017/01/02}{2.5c}{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 @@ -43,30 +50,93 @@ \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 +\bool_new:N \l__fontspec_disable_defaults_bool +\bool_new:N \l__fontspec_alias_bool +\bool_new:N \l__fontspec_external_bool +\bool_new:N \l__fontspec_never_check_bool +\bool_new:N \l__fontspec_defining_encoding_bool +\bool_new:N \l__fontspec_script_exist_bool +\int_new:N \l__fontspec_script_int +\int_new:N \l__fontspec_language_int +\int_new:N \l__fontspec_strnum_int +\int_new:N \l__fontspec_tmp_int +\int_new:N \l__fontspec_em_int +\int_new:N \l__fontspec_emdef_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} +\seq_new:N \g__fontspec_bf_series_seq +\clist_new:N \g__fontspec_default_fontopts_clist +\clist_new:N \g__fontspec_all_keyval_modules_clist +\clist_set:Nn \l__fontspec_sizefeat_clist {Size={-}} +\prop_new:N \g__fontspec_fontopts_prop +\prop_new:N \l__fontspec_nfss_prop +\prop_new:N \l__fontspec_nfssfont_prop +\prop_new:N \g__fontspec_OT_features_prop +\prop_new:N \g__fontspec_all_opentype_feature_names_prop +\prop_new:N \g__fontspec_em_prop +\tl_new:N \g__fontspec_mathrm_tl +\tl_new:N \g__fontspec_bfmathrm_tl +\tl_new:N \g__fontspec_mathsf_tl +\tl_new:N \g__fontspec_mathtt_tl +\tl_new:N \l__fontspec_family_label_tl +\tl_new:N \l__fontspec_fake_slant_tl +\tl_new:N \l__fontspec_fake_embolden_tl +\tl_new:N \l__fontspec_fontname_up_tl +\tl_new:N \l__fontspec_fontname_bf_tl +\tl_new:N \l__fontspec_fontname_it_tl +\tl_new:N \l__fontspec_fontname_bfit_tl +\tl_new:N \l__fontspec_fontname_sl_tl +\tl_new:N \l__fontspec_fontname_bfsl_tl +\tl_new:N \l__fontspec_fontname_sc_tl +\tl_new:N \l__fontspec_fontfeat_up_clist +\tl_new:N \l__fontspec_fontfeat_bf_clist +\tl_new:N \l__fontspec_fontfeat_it_clist +\tl_new:N \l__fontspec_fontfeat_bfit_clist +\tl_new:N \l__fontspec_fontfeat_sl_clist +\tl_new:N \l__fontspec_fontfeat_bfsl_clist +\tl_new:N \l__fontspec_fontfeat_sc_clist +\tl_new:N \l__fontspec_script_name_tl +\tl_new:N \l_fontspec_script_tl +\tl_new:N \l__fontspec_lang_name_tl +\tl_new:N \l_fontspec_lang_tl +\tl_new:N \g__fontspec_hexcol_tl +\tl_new:N \g__fontspec_opacity_tl +\tl_set:Nn \g__fontspec_hexcol_tl {000000} +\tl_set:Nn \g__fontspec_opacity_tl {FF~} +\tl_set:Nn \g__fontspec_postadjust_tl { \l__fontspec_wordspace_adjust_tl \l__fontspec_punctspace_adjust_tl } +\cs_new:Nn \__fontspec_keys_set_known:nnN + { + \keys_set_known:nnN {#1} {#2} #3 + } +\cs_generate_variant:Nn \__fontspec_keys_set_known:nnN {nx} +\cs_set:Npn \__fontspec_head_ii:n #1 { \__fontspec_head_ii:w #1 *** \q_stop} +\cs_set:Npn \__fontspec_head_ii:w #1#2#3 \q_stop { #1#2 } +\cs_generate_variant:Nn \__fontspec_head_ii:n {o} \cs_new:Nn \__fontspec_int_mult_truncate:Nn { \int_set:Nn #1 { \__dim_eval:w #2 #1 \__dim_eval_end: } } +\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 \prop_put:Nnn {Nxx} +\cs_generate_variant:Nn \prop_put:Nnn {NxV} +\cs_generate_variant:Nn \prop_gput:Nnn {NxV} +\cs_generate_variant:Nn \prop_gput:Nnn {Nxn} +\cs_generate_variant:Nn \prop_get:NnNT {NxN} +\cs_generate_variant:Nn \prop_get:NnNTF {NxN} +\cs_generate_variant:Nn \str_if_eq:nnTF {nv} +\cs_generate_variant:Nn \tl_if_empty:nTF {x} +\cs_generate_variant:Nn \tl_if_empty:nF {x} +\cs_generate_variant:Nn \tl_if_empty:nF {f} +\cs_generate_variant:Nn \tl_if_eq:nnT {ox} +\cs_generate_variant:Nn \tl_replace_all:Nnn {Nnx} \cs_new:Npn \__fontspec_error:n { \msg_error:nn {fontspec} } +\cs_new:Npn \__fontspec_error:nn { \msg_error:nnn {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} } @@ -75,190 +145,226 @@ \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} +\cs_generate_variant:Nn \msg_new:nnn {nnx} +\cs_generate_variant:Nn \msg_new:nnnn {nnxx} +\cs_new:Nn \__fontspec_msg_new:nnn + { \msg_new:nnx {#1} {#2} { \tl_trim_spaces:n {#3} } } +\cs_new:Nn \__fontspec_msg_new:nnnn + { \msg_new:nnxx {#1} {#2} { \tl_trim_spaces:n {#3} } { \tl_trim_spaces:n {#4} } } +\char_set_catcode_space:n {32} +\__fontspec_msg_new:nnn {fontspec} {only-inside-encdef} + { + \exp_not:N#1can only be used in the second argument + to \string\DeclareUnicodeEncoding. + } +\__fontspec_msg_new:nnn {fontspec} {only-import-tu} { - Size~ information~ must~ be~ supplied.\\ - For~ example,~ SizeFeatures={Size={8-12},...}. + The "\string\ImportEncoding" command can only take "TU" as an argument at this stage. } -\msg_new:nnnn {fontspec} {font-not-found} +\__fontspec_msg_new:nnn {fontspec} {no-size-info} { - The~ font~ "#1"~ cannot~ be~ found. + Size information must be supplied.\\ + For example, SizeFeatures={Size={8-12},...}. } +\__fontspec_msg_new:nnnn {fontspec} {font-not-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! + The font "#1" cannot be found. } -\msg_new:nnnn {fontspec} {rename-feature-not-exist} { - The~ feature~ #1~ doesn't~ appear~ to~ be~ defined. + 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! } +\__fontspec_msg_new:nnnn {fontspec} {rename-feature-not-exist} { - It~ looks~ like~ you're~ trying~ to~ rename~ a~ feature~ that~ doesn't~ exist. + The feature #1 doesn't appear to be defined. } -\msg_new:nnn {fontspec} {no-glyph} { - '\l_fontspec_fontname_tl'~ does~ not~ contain~ glyph~ #1. + It looks like you're trying to rename a feature that doesn't exist. } -\msg_new:nnnn {fontspec} {euler-too-late} +\__fontspec_msg_new:nnn {fontspec} {no-glyph} { - The~ euler~ package~ must~ be~ loaded~ BEFORE~ fontspec. + '\l_fontspec_fontname_tl' does not contain glyph #1. } +\__fontspec_msg_new:nnnn {fontspec} {euler-too-late} { - 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. + The euler package must be loaded BEFORE fontspec. } -\msg_new:nnnn {fontspec} {no-xcolor} { - Cannot~ load~ named~ colours~ without~ the~ xcolor~ package. + 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. } +\__fontspec_msg_new:nnnn {fontspec} {no-xcolor} { - Sorry,~ I~ can't~ do~ anything~ to~ help.~ Instead~ of~ loading~ - the~ color~ package,~ use~ xcolor~ instead.~ It's~ better. + Cannot load named colours without the xcolor package. } -\msg_new:nnnn {fontspec} {unknown-color-model} { - Error~ loading~ colour~ `#1';~ unknown~ colour~ model. + Sorry, I can't do anything to help. Instead of loading + the color package, use xcolor instead. } +\__fontspec_msg_new:nnnn {fontspec} {unknown-color-model} { - Sorry,~ I~ can't~ do~ anything~ to~ help.~ Please~ report~ this~ error~ - to~ my~ developer~ with~ a~ minimal~ example~ that~ causes~ the~ problem. + Error loading colour `#1'; unknown colour model. } -\msg_new:nnnn {fontspec} {not-in-addfontfeatures} { - The~ "#1"~ font~ feature~ cannot~ be~ used~ in~ \string\addfontfeatures. + Sorry, I can't do anything to help. Please report this error + to my developer with a minimal example that causes the problem. } +\__fontspec_msg_new:nnnn {fontspec} {not-in-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. + The "#1" font feature cannot be used in \string\addfontfeatures. } -\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.\\ + 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. + } +\__fontspec_msg_new:nnn {fontspec} {tu-clash} + { + I have found the tuenc.def encoding definition file but the TU encoding is not + defined by the LaTeX2e kernel; attempting to correct but you really should update + to the latest version of LaTeX2e. + } +\__fontspec_msg_new:nnn {fontspec} {tu-missing} + { + The TU encoding seems to be missing; please update to the latest version of LaTeX2e. + } +\__fontspec_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}".\\ + 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". } + { The requested feature is "#1". } + { The requested features are "#1". } } -\msg_new:nnn {fontspec} {feature-option-overwrite} +\__fontspec_msg_new:nnn {fontspec} {feature-option-overwrite} { - Option~ '#2'~ of~ font~ feature~ '#1'~ overwritten. + Option '#2' of font feature '#1' overwritten. } -\msg_new:nnn {fontspec} {script-not-exist-latn} +\__fontspec_msg_new:nnn {fontspec} {script-not-exist-latn} { - Font~ '\l_fontspec_fontname_tl'~ does~ not~ contain~ script~ '#1'.\\ - 'Latin'~ script~ used~ instead. + Font '\l_fontspec_fontname_tl' does not contain script '#1'.\\ + 'Latin' script used instead. } -\msg_new:nnn {fontspec} {script-not-exist} +\__fontspec_msg_new:nnn {fontspec} {script-not-exist} { - Font~ '\l_fontspec_fontname_tl'~ does~ not~ contain~ script~ '#1'. + Font '\l_fontspec_fontname_tl' does not contain script '#1'. } -\msg_new:nnn {fontspec} {aat-feature-not-exist} +\__fontspec_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'. + '\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} +\__fontspec_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'. + 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} +\__fontspec_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' + '\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} +\__fontspec_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'. + 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} +\__fontspec_msg_new:nnn {fontspec} {no-opticals} { - '\l_fontspec_fontname_tl'~ doesn't~ appear~ to~ have~ an~ Optical~ Size~ axis. + '\l_fontspec_fontname_tl' doesn't appear to have an Optical Size axis. } -\msg_new:nnn {fontspec} {language-not-exist} +\__fontspec_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. + 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} +\__fontspec_msg_new:nnn {fontspec} {only-xetex-feature} { - Ignored~ XeTeX~ only~ feature:~ '#1'. + Ignored XeTeX only feature: '#1'. } -\msg_new:nnn {fontspec} {only-luatex-feature} +\__fontspec_msg_new:nnn {fontspec} {only-luatex-feature} { - Ignored~ LuaTeX~ only~ feature:~ '#1'. + Ignored LuaTeX only feature: '#1'. } -\msg_new:nnn {fontspec} {no-mapping} +\__fontspec_msg_new:nnn {fontspec} {no-mapping} { - Input~ mapping~ not~ (yet?)~ supported~ in~ LuaTeX. + Input mapping not (yet?) supported in LuaTeX. } -\msg_new:nnn {fontspec} {no-mapping-ligtex} +\__fontspec_msg_new:nnn {fontspec} {no-mapping-ligtex} { - Input~ mapping~ not~ (yet?)~ supported~ in~ LuaTeX.\\ - Use~ "Ligatures=TeX"~ instead~ of~ "Mapping=tex-text". + Input mapping not (yet?) supported in LuaTeX.\\ + Use "Ligatures=TeX" instead of "Mapping=tex-text". } -\msg_new:nnn {fontspec} {cm-default-obsolete} +\__fontspec_msg_new:nnn {fontspec} {cm-default-obsolete} { - The~ "cm-default"~ package~ option~ is~ obsolete. + The "cm-default" package option is obsolete. } -\msg_new:nnn {fontspec} {fakebold-only-xetex} +\__fontspec_msg_new:nnn {fontspec} {fakebold-only-xetex} { - The~ "FakeBold"~ and~ "AutoFakeBold"~ options~ are~ only~ available~ with~ XeLaTeX.\\ - Option~ ignored. + The "FakeBold" and "AutoFakeBold" options are only available with XeLaTeX.\\ + Option ignored. } -\msg_new:nnn {fontspec} {defining-font} +\__fontspec_msg_new:nnn {fontspec} {font-index-needs-ttc} { - Font~ family~'\l_fontspec_family_tl'~ created~ for~ font~ '#2'~ - with~ options~ [\l__fontspec_all_features_clist].\\ + The "FontIndex" feature is only supported by TTC (TrueType Collection) fonts.\\ + Feature ignored. + } +\__fontspec_msg_new:nnn {fontspec} {feat-cannot-remove} + { + The "#1" feature cannot be deactivated. Request ignored. + } +\__fontspec_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:\\ + This font family consists of the following NFSS series/shapes:\\ \l_fontspec_defined_shapes_tl } -\msg_new:nnn {fontspec} {no-font-shape} +\__fontspec_msg_new:nnn {fontspec} {no-font-shape} { - Could~ not~ resolve~ font~ #1~ (it~ probably~ doesn't~ exist). + Could not resolve font "#1" (it probably doesn't exist). } -\msg_new:nnn {fontspec} {set-scale} +\__fontspec_msg_new:nnn {fontspec} {set-scale} { - \l_fontspec_fontname_tl\space scale ~=~ \l__fontspec_scale_tl. + \l_fontspec_fontname_tl\space scale = \l__fontspec_scale_tl. } -\msg_new:nnn {fontspec} {setup-math} +\__fontspec_msg_new:nnn {fontspec} {setup-math} { - Adjusting~ the~ maths~ setup~ (use~ [no-math]~ to~ avoid~ this). + Adjusting the maths setup (use [no-math] to avoid this). } -\msg_new:nnn {fontspec} {no-scripts} +\__fontspec_msg_new:nnn {fontspec} {no-scripts} { - Font~ \l_fontspec_fontname_tl\space does~ not~ contain~ any~ OpenType~ `Script'~ information. + Font "\l_fontspec_fontname_tl" does not contain any OpenType `Script' information. } -\msg_new:nnn {fontspec} {opa-twice} +\__fontspec_msg_new:nnn {fontspec} {opa-twice} { - Opacity~ set~ twice,~ in~ both~ Colour~ and~ Opacity.\\ - Using~ specification~ "Opacity=#1". + Opacity set twice, in both Colour and Opacity.\\ + Using specification "Opacity=#1". } -\msg_new:nnn {fontspec} {opa-twice-col} +\__fontspec_msg_new:nnn {fontspec} {opa-twice-col} { - Opacity~ set~ twice,~ in~ both~ Opacity~ and~ Colour.\\ - Using~ an~ opacity~ specification~ in~ hex~ of~ "#1/FF". + Opacity set twice, in both Opacity and Colour.\\ + Using an opacity specification in hex of "#1/FF". } -\msg_new:nnn {fontspec} {bad-colour} +\__fontspec_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 + 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 } +\char_set_catcode_ignore:n {32} \DeclareOption{cm-default} { \__fontspec_warning:n {cm-default-obsolete} } \DeclareOption{math}{\bool_set_true:N \g__fontspec_math_bool} @@ -277,20 +383,35 @@ \msg_redirect_module:nnn { fontspec } { warning } { none } \msg_redirect_module:nnn { fontspec } { info } { none } } -\ExecuteOptions{config,math,euenc} +\ExecuteOptions{config,math,tuenc} \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 +\bool_if:NF \g__fontspec_euenc_bool + { + \file_if_exist:nTF {tuenc.def} + { + \cs_if_exist:cF {T@TU} + { + \__fontspec_warning:n {tu-clash} + \DeclareFontEncoding{TU}{}{} + \DeclareFontSubstitution{TU}{lmr}{m}{n} + } + } + { + \__fontspec_warning:n {tu-missing} + \bool_set_true:N \g__fontspec_euenc_bool + } + } +\bool_if:NTF \g__fontspec_euenc_bool { \tl_set:Nn \g_fontspec_encoding_tl {EU1} } + { \tl_set:Nn \g_fontspec_encoding_tl { TU } } \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 if needed -\normalsize % to overcome the encoding changing the current font size +\tl_if_in:NnT \@filelist {.cls} { \normalsize } \tl_set_eq:NN \cyrillicencoding \g_fontspec_encoding_tl \tl_set_eq:NN \latinencoding \g_fontspec_encoding_tl \AtBeginDocument @@ -303,23 +424,19 @@ \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} +\prg_set_conditional:Nnn \__fontspec_primitive_font_if_null:N {p,TF,T,F} { \ifx #1 \nullfont \prg_return_true: @@ -327,102 +444,95 @@ \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} - { \__fontspec_post_arg:w {#1} {#3} } - { #1 {#2} {#3} } - } -\NewDocumentCommand \__fontspec_post_arg:w { m m O{} } - { #1 {#3} {#2} } -\NewDocumentCommand \fontspec { o m } - { \__fontspec_pass_args:nnn \__fontspec_fontspec:nn {#1} {#2} } - -\cs_new:Nn \__fontspec_fontspec:nn +\prg_set_conditional:Nnn \__fontspec_primitive_font_if_exist:n {TF,T,F} + { + \group_begin: + \__fontspec_font_suppress_not_found_error: + \__fontspec_primitive_font_set:Nnn \l__fontspec_primitive_font {#1} {10pt} + \__fontspec_primitive_font_if_null:NTF \l__fontspec_primitive_font + { \group_end: \prg_return_false: } + { \group_end: \prg_return_true: } + } +\prg_new_conditional:Nnn \__fontspec_primitive_font_glyph_if_exist:Nn {p,TF,T,F} + { + \etex_iffontchar:D #1 #2 \scan_stop: + \prg_return_true: + \else: + \prg_return_false: + \fi: + } +\NewDocumentCommand \fontspec { O{} m O{} } { - \fontspec_set_family:Nnn \f@family {#1} {#2} + \fontspec_set_family:Nnn \f@family {#1,#3} {#2} \fontencoding { \l__fontspec_nfss_enc_tl } \selectfont \ignorespaces } -\DeclareDocumentCommand \setmainfont { o m } - { \__fontspec_pass_args:nnn \__fontspec_setmainfont:nn {#1} {#2} } - -\cs_new:Nn \__fontspec_setmainfont:nn +\DeclareDocumentCommand \setmainfont { O{} m O{} } { - \fontspec_set_family:Nnn \rmdefault {#1}{#2} + \fontspec_set_family:Nnn \g__fontspec_rmfamily_family {#1,#3} {#2} + \tl_set_eq:NN \rmdefault \g__fontspec_rmfamily_family + \use:x { \exp_not:n { \DeclareRobustCommand \rmfamily } + { + \exp_not:N \fontencoding { \l__fontspec_nfss_enc_tl } + \exp_not:N \fontfamily { \g__fontspec_rmfamily_family } + \exp_not:N \selectfont + } + } + \str_if_eq_x:nnT {\familydefault} {\rmdefault} + { \tl_set_eq:NN \encodingdefault \l__fontspec_nfss_enc_tl } \normalfont \ignorespaces } - -\DeclareDocumentCommand \setsansfont { o m } - { \__fontspec_pass_args:nnn \__fontspec_setsansfont:nn {#1} {#2} } - -\cs_new:Nn \__fontspec_setsansfont:nn +\DeclareDocumentCommand \setsansfont { O{} m O{} } { - \fontspec_set_family:Nnn \sfdefault {#1}{#2} + \fontspec_set_family:Nnn \g__fontspec_sffamily_family {#1,#3} {#2} + \tl_set_eq:NN \sfdefault \g__fontspec_sffamily_family + \use:x { \exp_not:n { \DeclareRobustCommand \sffamily } + { + \exp_not:N \fontencoding { \l__fontspec_nfss_enc_tl } + \exp_not:N \fontfamily { \g__fontspec_sffamily_family } + \exp_not:N \selectfont + } + } + \str_if_eq_x:nnT {\familydefault} {\sfdefault} + { \tl_set_eq:NN \encodingdefault \l__fontspec_nfss_enc_tl } \normalfont \ignorespaces } - -\DeclareDocumentCommand \setmonofont { o m } - { \__fontspec_pass_args:nnn \__fontspec_setmonofont:nn {#1} {#2} } - -\cs_new:Nn \__fontspec_setmonofont:nn +\DeclareDocumentCommand \setmonofont { O{} m O{} } { - \fontspec_set_family:Nnn \ttdefault {#1}{#2} + \fontspec_set_family:Nnn \g__fontspec_ttfamily_family {#1,#3} {#2} + \tl_set_eq:NN \ttdefault \g__fontspec_ttfamily_family + \use:x { \exp_not:n { \DeclareRobustCommand \ttfamily } + { + \exp_not:N \fontencoding { \l__fontspec_nfss_enc_tl } + \exp_not:N \fontfamily { \g__fontspec_ttfamily_family } + \exp_not:N \selectfont + } + } + \str_if_eq_x:nnT {\familydefault} {\ttdefault} + { \tl_set_eq:NN \encodingdefault \l__fontspec_nfss_enc_tl } \normalfont \ignorespaces } \cs_set_eq:NN \setromanfont \setmainfont -\tl_new:N \g__fontspec_mathrm_tl -\tl_new:N \g__fontspec_bfmathrm_tl -\tl_new:N \g__fontspec_mathsf_tl -\tl_new:N \g__fontspec_mathtt_tl -\DeclareDocumentCommand \setmathrm { o m } - { \__fontspec_pass_args:nnn \__fontspec_setmathrm:nn {#1} {#2} } - -\cs_new:Nn \__fontspec_setmathrm:nn +\DeclareDocumentCommand \setmathrm { O{} m O{} } { \fontspec_set_family:Nnn \g__fontspec_mathrm_tl {#1} {#2} } -\DeclareDocumentCommand \setboldmathrm { o m } - { \__fontspec_pass_args:nnn \__fontspec_setboldmathrm:nn {#1} {#2} } - -\cs_new:Nn \__fontspec_setboldmathrm:nn +\DeclareDocumentCommand \setboldmathrm { O{} m O{} } { \fontspec_set_family:Nnn \g__fontspec_bfmathrm_tl {#1} {#2} } -\DeclareDocumentCommand \setmathsf { o m } - { \__fontspec_pass_args:nnn \__fontspec_setmathsf:nn {#1} {#2} } - -\cs_new:Nn \__fontspec_setmathsf:nn +\DeclareDocumentCommand \setmathsf { O{} m O{} } { \fontspec_set_family:Nnn \g__fontspec_mathsf_tl {#1} {#2} } -\DeclareDocumentCommand \setmathtt { o m } - { \__fontspec_pass_args:nnn \__fontspec_setmathtt:nn {#1} {#2} } - -\cs_new:Nn \__fontspec_setmathtt:nn +\DeclareDocumentCommand \setmathtt { O{} m O{} } { \fontspec_set_family:Nnn \g__fontspec_mathtt_tl {#1} {#2} } @@ -433,12 +543,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 } - { \__fontspec_pass_args:nnn { \__fontspec_newfontfamily:Nnn #1 } {#2} {#3} } - -\cs_new:Nn \__fontspec_newfontfamily:Nnn +\DeclareDocumentCommand \newfontfamily { m O{} m O{} } { - \fontspec_set_family:cnn { g__fontspec_ \cs_to_str:N #1 _family } {#2} {#3} + \fontspec_set_family:cnn { g__fontspec_ \cs_to_str:N #1 _family } {#2,#4} {#3} \use:x { \exp_not:N \DeclareRobustCommand \exp_not:N #1 @@ -449,15 +556,10 @@ } } } -\DeclareDocumentCommand \newfontface { m o m } - { \__fontspec_pass_args:nnn { \__fontspec_newfontface:Nnn #1 } {#2} {#3} } - -\cs_new:Nn \__fontspec_newfontface:Nnn +\DeclareDocumentCommand \newfontface { m O{} m O{} } { - \newfontfamily #1 [ BoldFont={},ItalicFont={},SmallCapsFont={},#2 ] {#3} + \newfontfamily #1 [ BoldFont={},ItalicFont={},SmallCapsFont={},#2,#4 ] {#3} } -\clist_new:N \g__fontspec_default_fontopts_clist -\prop_new:N \g__fontspec_fontopts_prop \DeclareDocumentCommand \defaultfontfeatures { t+ o m } { \IfNoValueTF {#2} @@ -492,19 +594,6 @@ } } } -\cs_new:Nn \__fontspec_sanitise_fontname:Nn - { - \tl_set:Nx #1 {#2} - \clist_map_inline:Nn \l__fontspec_extensions_clist - { - \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} { \fontspec_if_fontspec_font:TF @@ -516,7 +605,7 @@ \bool_set_true:N \l__fontspec_disable_defaults_bool \use:x { - \exp_not:N \fontspec_select:nn + \__fontspec_select_font_family:nn { \l__fontspec_options_tl , #1 } {\l__fontspec_fontname_tl} } \group_end: @@ -541,49 +630,57 @@ \DeclareDocumentCommand \newAATfeature {mmmm} { \keys_if_exist:nnF { fontspec } {#1} - { \__fontspec_define_font_feature:n {#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_feature_option:nnnnn {#1}{#2}{#3}{#4}{} + \__fontspec_define_aat_feature:nnnn {#1}{#2}{#3}{#4} } \DeclareDocumentCommand \newopentypefeature {mmm} { \keys_if_exist:nnF { fontspec / options } {#1} - { \__fontspec_define_font_feature:n {#1} } + { \__fontspec_define_opentype_feature_group:n {#1} } \keys_if_choice_exist:nnnT {fontspec} {#1} {#2} { \__fontspec_warning:nxx {feature-option-overwrite} {#1} {#2} } - \__fontspec_define_feature_option:nnnnn {#1}{#2}{}{}{#3} + \__fontspec_define_opentype_feature:nnn {#1}{#2}{#3} } \cs_set_eq:NN \newICUfeature \newopentypefeature % deprecated -\bool_new:N \l__fontspec_alias_bool \DeclareDocumentCommand \aliasfontfeature {mm} { \bool_set_false:N \l__fontspec_alias_bool \clist_map_inline:nn - { fontspec, fontspec-preparse, fontspec-preparse-external, + { fontspec, fontspec-opentype, fontspec-aat, fontspec-preparse, fontspec-preparse-external, fontspec-preparse-nested, fontspec-renderer } { \keys_if_exist:nnT {##1} {#1} { \bool_set_true:N \l__fontspec_alias_bool - \__fontspec_alias_font_feature:nnn {##1} {#1} {#2} + \keys_define:nn {##1} + { #2 .code:n = { \keys_set:nn {##1} { #1 = {####1} } } } } } \bool_if:NF \l__fontspec_alias_bool { \__fontspec_warning:nx {rename-feature-not-exist} {#1} } } +\DeclareDocumentCommand \aliasfontfeatureoption {mmm} + { + \bool_set_false:N \l__fontspec_alias_bool -\cs_set:Nn \__fontspec_alias_font_feature:nnn - { - \keys_define:nn {#1} - { #3 .code:n = { \keys_set:nn {#1} { #2 = {##1} } } } - } + \clist_map_inline:Nn \g__fontspec_all_keyval_modules_clist + { -\DeclareDocumentCommand \aliasfontfeatureoption {mmm} - { \keys_define:nn { fontspec / #1 } { #3 .meta:n = {#2} } } + \keys_if_exist:nnT {##1} {#1} + { + \bool_set_true:N \l__fontspec_alias_bool + \keys_define:nn { ##1 / #1 } { #3 .meta:n = {#2} } + } + } + + \bool_if:NF \l__fontspec_alias_bool + { \__fontspec_warning:nx {rename-feature-not-exist} {#1} } + } \DeclareDocumentCommand \newfontscript {mm} { \fontspec_new_script:nn {#1} {#2} @@ -599,6 +696,31 @@ } \DeclareFontsExtensions{.otf,.ttf,.OTF,.TTF,.ttc,.TTC,.dfont} +\DeclareDocumentCommand \IfFontFeatureActiveTF {mmm} + { + \__fontspec_if_font_feature:nTF {#1} {#2} {#3} + } +\prg_new_conditional:Nnn \__fontspec_if_font_feature:n {TF} + { + \tl_gclear:N \g__fontspec_single_feat_tl + \group_begin: + \__fontspec_font_suppress_not_found_error: + \__fontspec_init: + \bool_set_true:N \l__fontspec_ot_bool + \bool_set_true:N \l__fontspec_never_check_bool + \bool_set_false:N \l__fontspec_firsttime_bool + \clist_clear:N \l__fontspec_fontfeat_clist + \__fontspec_get_features:Nn \l__fontspec_rawfeatures_sclist {#1} + \group_end: + + + \tl_if_empty:NTF \g__fontspec_single_feat_tl { \prg_return_false: } + { + \exp_args:NV \fontspec_if_current_feature:nTF \g__fontspec_single_feat_tl + { \prg_return_true: } { \prg_return_false: } + } + } + \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: @@ -608,10 +730,10 @@ \fontspec_if_fontspec_font:TF { \prop_get:cnN {g__fontspec_ \f@family _prop} {fontdef} \l__fontspec_fontdef_tl - \__fontspec_font_set:Nnn \l_fontspec_font {\l__fontspec_fontdef_tl} {\f@size pt} + \__fontspec_primitive_font_set:Nnn \l_fontspec_font {\l__fontspec_fontdef_tl} {\f@size pt} \bool_if:NTF \l__fontspec_atsui_bool { - \fontspec_make_AAT_feature_string:nnTF {#1}{#2} + \__fontspec_make_AAT_feature_string:nnTF {#1}{#2} \prg_return_true: \prg_return_false: } { @@ -627,7 +749,7 @@ \fontspec_if_fontspec_font:TF { \prop_get:cnN {g__fontspec_ \f@family _prop} {fontdef} \l__fontspec_fontdef_tl - \__fontspec_font_set:Nnn \l_fontspec_font {\l__fontspec_fontdef_tl} {\f@size pt} + \__fontspec_primitive_font_set:Nnn \l_fontspec_font {\l__fontspec_fontdef_tl} {\f@size pt} \__fontspec_set_font_type: \bool_if:NTF \l__fontspec_ot_bool \prg_return_true: \prg_return_false: } @@ -640,20 +762,20 @@ \fontspec_if_fontspec_font:TF { \prop_get:cnN {g__fontspec_ \f@family _prop} {fontdef} \l__fontspec_fontdef_tl - \__fontspec_font_set:Nnn \l_fontspec_font {\l__fontspec_fontdef_tl} {\f@size pt} + \__fontspec_primitive_font_set:Nnn \l_fontspec_font {\l__fontspec_fontdef_tl} {\f@size pt} \__fontspec_set_font_type: \bool_if:NTF \l__fontspec_ot_bool { \prop_get:cnN {g__fontspec_ \f@family _prop} {script-num} \l__fontspec_tmp_tl - \int_set:Nn \l_fontspec_script_int {\l__fontspec_tmp_tl} + \int_set:Nn \l__fontspec_script_int {\l__fontspec_tmp_tl} \prop_get:cnN {g__fontspec_ \f@family _prop} {lang-num} \l__fontspec_tmp_tl - \int_set:Nn \l_fontspec_language_int {\l__fontspec_tmp_tl} + \int_set:Nn \l__fontspec_language_int {\l__fontspec_tmp_tl} \prop_get:cnN {g__fontspec_ \f@family _prop} {script-tag} \l_fontspec_script_tl \prop_get:cnN {g__fontspec_ \f@family _prop} {lang-tag} \l_fontspec_lang_tl - \fontspec_check_ot_feat:nTF {#1} {\prg_return_true:} {\prg_return_false:} + \__fontspec_check_ot_feat:nTF {#1} {\prg_return_true:} {\prg_return_false:} } { \prg_return_false: @@ -668,13 +790,13 @@ \fontspec_if_fontspec_font:TF { \prop_get:cnN {g__fontspec_ \f@family _prop} {fontdef} \l__fontspec_fontdef_tl - \__fontspec_font_set:Nnn \l_fontspec_font {\l__fontspec_fontdef_tl} {\f@size pt} + \__fontspec_primitive_font_set:Nnn \l_fontspec_font {\l__fontspec_fontdef_tl} {\f@size pt} \__fontspec_set_font_type: \bool_if:NTF \l__fontspec_ot_bool { - \fontspec_iv_str_to_num:Nn \l_fontspec_script_int {#1} - \fontspec_iv_str_to_num:Nn \l_fontspec_language_int {#2} - \fontspec_check_ot_feat:nTF {#3} \prg_return_true: \prg_return_false: + \__fontspec_iv_str_to_num:Nn \l__fontspec_script_int {#1} + \__fontspec_iv_str_to_num:Nn \l__fontspec_language_int {#2} + \__fontspec_check_ot_feat:nTF {#3} \prg_return_true: \prg_return_false: } { \prg_return_false: } } @@ -685,11 +807,11 @@ \fontspec_if_fontspec_font:TF { \prop_get:cnN {g__fontspec_ \f@family _prop} {fontdef} \l__fontspec_fontdef_tl - \__fontspec_font_set:Nnn \l_fontspec_font {\l__fontspec_fontdef_tl} {\f@size pt} + \__fontspec_primitive_font_set:Nnn \l_fontspec_font {\l__fontspec_fontdef_tl} {\f@size pt} \__fontspec_set_font_type: \bool_if:NTF \l__fontspec_ot_bool { - \fontspec_check_script:nTF {#1} \prg_return_true: \prg_return_false: + \__fontspec_check_script:nTF {#1} \prg_return_true: \prg_return_false: } { \prg_return_false: } } @@ -700,15 +822,15 @@ \fontspec_if_fontspec_font:TF { \prop_get:cnN {g__fontspec_ \f@family _prop} {fontdef} \l__fontspec_fontdef_tl - \__fontspec_font_set:Nnn \l_fontspec_font {\l__fontspec_fontdef_tl} {\f@size pt} + \__fontspec_primitive_font_set:Nnn \l_fontspec_font {\l__fontspec_fontdef_tl} {\f@size pt} \__fontspec_set_font_type: \bool_if:NTF \l__fontspec_ot_bool { \prop_get:cnN {g__fontspec_ \f@family _prop} {script-num} \l__fontspec_tmp_tl - \int_set:Nn \l_fontspec_script_int {\l__fontspec_tmp_tl} + \int_set:Nn \l__fontspec_script_int {\l__fontspec_tmp_tl} \prop_get:cnN {g__fontspec_ \f@family _prop} {script-tag} \l_fontspec_script_tl - \fontspec_check_lang:nTF {#1} \prg_return_true: \prg_return_false: + \__fontspec_check_lang:nTF {#1} \prg_return_true: \prg_return_false: } { \prg_return_false: } } @@ -719,13 +841,13 @@ \fontspec_if_fontspec_font:TF { \prop_get:cnN {g__fontspec_ \f@family _prop} {fontdef} \l__fontspec_fontdef_tl - \__fontspec_font_set:Nnn \l_fontspec_font {\l__fontspec_fontdef_tl} {\f@size pt} + \__fontspec_primitive_font_set:Nnn \l_fontspec_font {\l__fontspec_fontdef_tl} {\f@size pt} \__fontspec_set_font_type: \bool_if:NTF \l__fontspec_ot_bool { \tl_set:Nn \l_fontspec_script_tl {#1} - \fontspec_iv_str_to_num:Nn \l_fontspec_script_int {#1} - \fontspec_check_lang:nTF {#2} \prg_return_true: \prg_return_false: + \__fontspec_iv_str_to_num:Nn \l__fontspec_script_int {#1} + \__fontspec_check_lang:nTF {#2} \prg_return_true: \prg_return_false: } { \prg_return_false: } } @@ -736,7 +858,7 @@ \fontspec_if_fontspec_font:TF { \prop_get:cnN {g__fontspec_ \f@family _prop} {fontdef} \l__fontspec_fontdef_tl - \__fontspec_font_set:Nnn \l_fontspec_font {\l__fontspec_fontdef_tl} {\f@size pt} + \__fontspec_primitive_font_set:Nnn \l_fontspec_font {\l__fontspec_fontdef_tl} {\f@size pt} \__fontspec_set_font_type: \bool_if:NTF \l__fontspec_ot_bool { @@ -753,7 +875,7 @@ \fontspec_if_fontspec_font:TF { \prop_get:cnN {g__fontspec_ \f@family _prop} {fontdef} \l__fontspec_fontdef_tl - \__fontspec_font_set:Nnn \l_fontspec_font {\l__fontspec_fontdef_tl} {\f@size pt} + \__fontspec_primitive_font_set:Nnn \l_fontspec_font {\l__fontspec_fontdef_tl} {\f@size pt} \__fontspec_set_font_type: \bool_if:NTF \l__fontspec_ot_bool { @@ -768,48 +890,103 @@ \cs_new:Nn \fontspec_set_family:Nnn { \tl_set:Nn \l__fontspec_family_label_tl { #1 } - \fontspec_select:nn {#2}{#3} + \__fontspec_select_font_family:nn {#2}{#3} \tl_set_eq:NN #1 \l_fontspec_family_tl } \cs_generate_variant:Nn \fontspec_set_family:Nnn {c} \cs_new:Nn \fontspec_set_fontface:NNnn { \tl_set:Nn \l__fontspec_family_label_tl { #1 } - \fontspec_select:nn {#3}{#4} + \__fontspec_select_font_family:nn {#3}{#4} \tl_set_eq:NN #1 \l_fontspec_font \tl_set_eq:NN #2 \l_fontspec_family_tl } -\cs_set:Nn \fontspec_select:nn +\prg_new_conditional:Nnn \fontspec_font_if_exist:n {TF,T,F} + { + \group_begin: + \__fontspec_init: + \__fontspec_if_detect_external:nT {#1} { \__fontspec_font_is_file: } + \__fontspec_primitive_font_if_exist:nTF { \__fontspec_construct_font_call:nn {#1} {} } + { \group_end: \prg_return_true: } + { \group_end: \prg_return_false: } + } +\cs_set_eq:NN \IfFontExistsTF \fontspec_font_if_exist:nTF + +\prg_new_conditional:Nnn \fontspec_if_current_feature:n {TF,T,F} + { + \exp_args:Nxx \tl_if_in:nnTF + { \fontname\font } { \tl_to_str:n {#1} } + { \prg_return_true: } { \prg_return_false: }% + } + +\cs_new_protected:Nn \__fontspec_select_font_family:nn { \group_begin: \__fontspec_font_suppress_not_found_error: \__fontspec_init: - \tl_set:Nx \l_fontspec_fontname_tl {#2} - \tl_set:Nx \l_fontspec_fontname_up_tl {#2} - \tl_set:Nx \l__fontspec_basename_tl {#2} + \__fontspec_sanitise_fontname:Nn \l_fontspec_fontname_tl {#2} + \__fontspec_sanitise_fontname:Nn \l__fontspec_fontname_up_tl {#2} + \__fontspec_sanitise_fontname:Nn \l__fontspec_basename_tl {#2} + \__fontspec_if_detect_external:nT {#2} + { \keys_set:nn {fontspec-preparse-external} {Path} } + + \__fontspec_init_ttc:n {#2} \__fontspec_load_external_fontoptions:Nn \l_fontspec_fontname_tl {#2} + \__fontspec_extract_all_features:n {#1} - \__fontspec_preparse_features: + \tl_set:Nx \l__fontspec_fontid_tl { \tl_to_str:N \l_fontspec_fontname_tl-:-\tl_to_str:N \l__fontspec_all_features_clist } + + \__fontspec_preparse_features: \__fontspec_load_font: \__fontspec_set_scriptlang: \__fontspec_get_features:Nn \l__fontspec_rawfeatures_sclist {} \bool_set_false:N \l__fontspec_firsttime_bool - \__fontspec_save_family:nTF {#2} + \__fontspec_save_family_needed:nTF {#2} { - \__fontspec_save_fontinfo: - \__fontspec_find_autofonts: - \DeclareFontFamily{\l__fontspec_nfss_enc_tl}{\l_fontspec_family_tl}{} - \__fontspec_set_faces: - \__fontspec_info:nxx {defining-font} {#1} {#2} + \__fontspec_save_family:nn {#1} {#2} } { } \group_end: } +\cs_set_eq:NN \fontspec_select:nn \__fontspec_select_font_family:nn +\cs_new:Nn \__fontspec_sanitise_fontname:Nn + { + \tl_set:Nx #1 {#2} + \clist_map_inline:Nn \l__fontspec_extensions_clist + { + \tl_if_in:NnT #1 {##1} + { + \tl_remove_once:Nn #1 {##1} + \tl_set:Nn \l__fontspec_extension_tl {##1} + \clist_map_break: + } + } + } +\prg_new_conditional:Nnn \__fontspec_if_detect_external:n {T} + { + \clist_map_inline:Nn \l__fontspec_extensions_clist + { + \bool_set_false:N \l__fontspec_tmpa_bool + \exp_args:Nx % <- this should be handled earlier + \tl_if_in:nnT {#1 <= end_of_string} {##1 <= end_of_string} + { \bool_set_true:N \l__fontspec_tmpa_bool \clist_map_break: } + } + \bool_if:NTF \l__fontspec_tmpa_bool \prg_return_true: \prg_return_false: + } +\cs_new:Nn \__fontspec_init_ttc:n + { + \str_if_eq_x:nnT { \str_lower_case:f {\l__fontspec_extension_tl} } {.ttc} + { + \__fontspec_sanitise_fontname:Nn \l__fontspec_fontname_it_tl {#1} + \__fontspec_sanitise_fontname:Nn \l__fontspec_fontname_bf_tl {#1} + \__fontspec_sanitise_fontname:Nn \l__fontspec_fontname_bfit_tl {#1} + } + } \cs_new:Nn \__fontspec_load_external_fontoptions:Nn { \__fontspec_sanitise_fontname:Nn #1 {#2} @@ -843,64 +1020,68 @@ #1 } } - \tl_set:Nx \l__fontspec_fontid_tl { \tl_to_str:N \l_fontspec_fontname_tl-:-\tl_to_str:N \l__fontspec_all_features_clist } } \cs_new:Nn \__fontspec_preparse_features: { - \__fontspec_if_detect_external:VT \l__fontspec_basename_tl - { \keys_set:nn {fontspec-preparse-external} {ExternalLocation} } - \keys_set_known:nxN {fontspec-preparse-external} + \__fontspec_keys_set_known:nxN {fontspec-preparse-external} { \l__fontspec_all_features_clist } \l__fontspec_keys_leftover_clist - \tl_set_eq:NN \l_fontspec_fontname_tl \l_fontspec_fontname_up_tl - \keys_set_known:nxN {fontspec-renderer} {\l__fontspec_keys_leftover_clist} + + \tl_set_eq:NN \l_fontspec_fontname_tl \l__fontspec_fontname_up_tl + \__fontspec_keys_set_known:nxN {fontspec-renderer} {\l__fontspec_keys_leftover_clist} \l__fontspec_keys_leftover_clist - \keys_set_known:nxN {fontspec-preparse} {\l__fontspec_keys_leftover_clist} + \__fontspec_keys_set_known:nxN {fontspec-preparse} {\l__fontspec_keys_leftover_clist} \l__fontspec_fontfeat_clist } \cs_new:Nn \__fontspec_load_font: { - \__fontspec_font_set:Nnn \l_fontspec_font - { \__fontspec_fullname:n {\l_fontspec_fontname_up_tl} } {\f@size pt} - \__fontspec_font_if_null:NT \l_fontspec_font { \__fontspec_error:nx {font-not-found} {\l_fontspec_fontname_up_tl} } + \__fontspec_primitive_font_set:Nnn \l_fontspec_font + { \__fontspec_construct_font_call:nn { \l__fontspec_fontname_up_tl } {} } {\f@size pt} + \__fontspec_primitive_font_if_null:NT \l_fontspec_font { \__fontspec_error:nx {font-not-found} {\l__fontspec_fontname_up_tl} } \__fontspec_set_font_type: - \__fontspec_font_gset:Nnn \l_fontspec_font - { \__fontspec_fullname:n {\l_fontspec_fontname_up_tl} } {\f@size pt} + \__fontspec_primitive_font_gset:Nnn \l_fontspec_font + { \__fontspec_construct_font_call:nn { \l__fontspec_fontname_up_tl } {} } {\f@size pt} \l_fontspec_font % this is necessary for LuaLaTeX to check the scripts properly } -\prg_new_conditional:Nnn \__fontspec_if_detect_external:n {T} +\cs_set:Nn \__fontspec_construct_font_call:nnnnnn { - \clist_map_inline:Nn \l__fontspec_extensions_clist - { - \bool_set_false:N \l__fontspec_tmpa_bool - \tl_if_in:nnT {#1 <= end_of_string} {##1 <= end_of_string} - { \bool_set_true:N \l__fontspec_tmpa_bool \clist_map_break: } - } - \bool_if:NTF \l__fontspec_tmpa_bool \prg_return_true: \prg_return_false: + " \__fontspec_fontname_wrap:n { #1 #2 #3 } #4 #5 + \str_if_eq_x:nnF {#6}{} {:#6} " } -\cs_generate_variant:Nn \__fontspec_if_detect_external:nT {V} -\cs_set:Nn \__fontspec_fullname:n +\cs_set:Nn \__fontspec_construct_font_call:nn { - \__fontspec_namewrap:n { #1 \l__fontspec_extension_tl } - \l_fontspec_renderer_tl - \l__fontspec_optical_size_tl + \__fontspec_construct_font_call:nnnnnn + {#1} + \l__fontspec_extension_tl + \l__fontspec_ttc_index_tl + \l_fontspec_renderer_tl + \l__fontspec_optical_size_tl + {#2} } +\cs_new:Nn \__fontspec_font_is_name: + { + \cs_set_eq:NN \__fontspec_fontname_wrap:n \use:n + } +\cs_new:Nn \__fontspec_font_is_file: + { + \cs_set:Npn \__fontspec_fontname_wrap:n ##1 { [ \l__fontspec_font_path_tl ##1 ] } + } \cs_new:Nn \__fontspec_set_scriptlang: { \bool_if:NT \l__fontspec_firsttime_bool { \tl_if_empty:NTF \l__fontspec_script_name_tl { - \fontspec_check_script:nTF {latn} + \__fontspec_check_script:nTF {latn} { \tl_set:Nn \l__fontspec_script_name_tl {Latin} \tl_if_empty:NT \l__fontspec_lang_name_tl { \tl_set:Nn \l__fontspec_lang_name_tl {Default} } - \keys_set:nx {fontspec} {Script=\l__fontspec_script_name_tl} - \keys_set:nx {fontspec} {Language=\l__fontspec_lang_name_tl} + \keys_set:nx {fontspec-opentype} {Script=\l__fontspec_script_name_tl} + \keys_set:nx {fontspec-opentype} {Language=\l__fontspec_lang_name_tl} } { \__fontspec_info:n {no-scripts} @@ -911,13 +1092,36 @@ { \tl_set:Nn \l__fontspec_lang_name_tl {Default} } - \keys_set:nx {fontspec} {Script=\l__fontspec_script_name_tl} - \keys_set:nx {fontspec} {Language=\l__fontspec_lang_name_tl} + \keys_set:nx {fontspec-opentype} {Script=\l__fontspec_script_name_tl} + \keys_set:nx {fontspec-opentype} {Language=\l__fontspec_lang_name_tl} } } } -\prg_new_conditional:Nnn \__fontspec_save_family:n {TF} +\cs_set:Nn \__fontspec_get_features:Nn { + \__fontspec_init_fontface: + \__fontspec_keys_set_known:nxN {fontspec-renderer} {\l__fontspec_fontfeat_clist,#2} + \l__fontspec_keys_leftover_clist + \__fontspec_keys_set_known:nxN {fontspec} {\l__fontspec_keys_leftover_clist} \l__fontspec_keys_leftover_clist + \bool_if:NTF \l__fontspec_ot_bool + { + \keys_set:nx {fontspec-opentype} {\l__fontspec_keys_leftover_clist} + } + { + \bool_if:NT \l__fontspec_atsui_bool + { \keys_set:nx {fontspec-aat} {\l__fontspec_keys_leftover_clist} } + } + + \str_if_eq_x:nnF { \l__fontspec_hexcol_tl \l__fontspec_opacity_tl } + { \g__fontspec_hexcol_tl \g__fontspec_opacity_tl } + { \__fontspec_update_featstr:n { color = \l__fontspec_hexcol_tl\l__fontspec_opacity_tl } } + + \tl_set_eq:NN #1 \l__fontspec_rawfeatures_sclist + } +\prg_new_conditional:Nnn \__fontspec_save_family_needed:n {TF} + { + + \cs_if_exist:NT \l__fontspec_nfss_fam_tl { \cs_set_eq:cN {g__fontspec_UID_\l__fontspec_fontid_tl} \l__fontspec_nfss_fam_tl @@ -941,51 +1145,58 @@ \cs_if_exist:cTF {g__fontspec_ \l_fontspec_family_tl _prop} \prg_return_false: \prg_return_true: } -\cs_new:Nn \__fontspec_save_fontinfo: +\cs_new:Nn \__fontspec_save_family:nn + { + \__fontspec_save_fontinfo:n {#2} + \__fontspec_find_autofonts: + \DeclareFontFamily{\l__fontspec_nfss_enc_tl}{\l_fontspec_family_tl}{} + \__fontspec_set_faces: + \__fontspec_info:nxx {defining-font} {#1} {#2} + } +\cs_new:Nn \__fontspec_save_fontinfo:n { \prop_new:c {g__fontspec_ \l_fontspec_family_tl _prop} - \prop_gput:cnx {g__fontspec_ \l_fontspec_family_tl _prop} {fontname} { \l__fontspec_basename_tl } + \prop_gput:cnx {g__fontspec_ \l_fontspec_family_tl _prop} {fontname} { #1 } \prop_gput:cnx {g__fontspec_ \l_fontspec_family_tl _prop} {options} { \l__fontspec_all_features_clist } \prop_gput:cnx {g__fontspec_ \l_fontspec_family_tl _prop} {fontdef} { - \__fontspec_fullname:n {\l_fontspec_fontname_tl} : - \l__fontspec_pre_feat_sclist \l__fontspec_rawfeatures_sclist + \__fontspec_construct_font_call:nn {\l_fontspec_fontname_tl} + { \l__fontspec_pre_feat_sclist \l__fontspec_rawfeatures_sclist } } - \prop_gput:cnV {g__fontspec_ \l_fontspec_family_tl _prop} {script-num} \l_fontspec_script_int - \prop_gput:cnV {g__fontspec_ \l_fontspec_family_tl _prop} {lang-num} \l_fontspec_language_int + \prop_gput:cnV {g__fontspec_ \l_fontspec_family_tl _prop} {script-num} \l__fontspec_script_int + \prop_gput:cnV {g__fontspec_ \l_fontspec_family_tl _prop} {lang-num} \l__fontspec_language_int \prop_gput:cnV {g__fontspec_ \l_fontspec_family_tl _prop} {script-tag} \l_fontspec_script_tl \prop_gput:cnV {g__fontspec_ \l_fontspec_family_tl _prop} {lang-tag} \l_fontspec_lang_tl - } \cs_new:Nn \__fontspec_find_autofonts: { \bool_if:nF {\l__fontspec_noit_bool || \l__fontspec_nobf_bool} { - \__fontspec_set_autofont:Nnn \l_fontspec_fontname_bfit_tl {\l_fontspec_fontname_it_tl} {/B} - \__fontspec_set_autofont:Nnn \l_fontspec_fontname_bfit_tl {\l_fontspec_fontname_bf_tl} {/I} - \__fontspec_set_autofont:Nnn \l_fontspec_fontname_bfit_tl {\l_fontspec_fontname_tl} {/BI} + \__fontspec_set_autofont:Nnn \l__fontspec_fontname_bfit_tl {\l__fontspec_fontname_it_tl} {/B} + \__fontspec_set_autofont:Nnn \l__fontspec_fontname_bfit_tl {\l__fontspec_fontname_bf_tl} {/I} + \__fontspec_set_autofont:Nnn \l__fontspec_fontname_bfit_tl {\l_fontspec_fontname_tl} {/BI} } \bool_if:NF \l__fontspec_nobf_bool { - \__fontspec_set_autofont:Nnn \l_fontspec_fontname_bf_tl {\l_fontspec_fontname_tl} {/B} + \__fontspec_set_autofont:Nnn \l__fontspec_fontname_bf_tl {\l_fontspec_fontname_tl} {/B} } \bool_if:NF \l__fontspec_noit_bool { - \__fontspec_set_autofont:Nnn \l_fontspec_fontname_it_tl {\l_fontspec_fontname_tl} {/I} + \__fontspec_set_autofont:Nnn \l__fontspec_fontname_it_tl {\l_fontspec_fontname_tl} {/I} } - \__fontspec_set_autofont:Nnn \l_fontspec_fontname_bfsl_tl {\l_fontspec_fontname_sl_tl} {/B} + \__fontspec_set_autofont:Nnn \l__fontspec_fontname_bfsl_tl {\l__fontspec_fontname_sl_tl} {/B} } \cs_new:Nn \__fontspec_set_faces: { \__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 + \__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 } } @@ -994,6 +1205,25 @@ \fontspec_complete_fontname:Nn \l__fontspec_curr_fontname_tl {#3} \__fontspec_make_font_shapes:Nnnnn \l__fontspec_curr_fontname_tl {#1} {#2} {#4} {#5} } +\cs_set:Nn \fontspec_complete_fontname:Nn + { + \tl_set:Nx #1 {#2} + \tl_replace_all:Nnx #1 {*} {\l__fontspec_basename_tl} + } +\cs_new:Nn \__fontspec_add_nfssfont:nnnn + { + \tl_set:Nx \l__fontspec_this_font_tl {#3} + + \tl_if_empty:xTF {#4} + { \clist_set:Nn \l__fontspec_sizefeat_clist {Size={-}} } + { \__fontspec_keys_set_known:nxN {fontspec-preparse-nested} {#4} \l__fontspec_tmp_tl } + + \tl_if_empty:NF \l__fontspec_this_font_tl + { + \prop_put:Nxx \l__fontspec_nfssfont_prop {#1/#2} + { {#1}{#2}{\l__fontspec_this_font_tl}{#4}{\l__fontspec_sizefeat_clist} } + } + } \cs_new:Nn \__fontspec_set_font_type: { \bool_set_false:N \l__fontspec_tfm_bool @@ -1021,7 +1251,6 @@ } } } -\cs_generate_variant:Nn \tl_if_empty:nF {x} \cs_new:Nn \__fontspec_set_autofont:Nnn { \bool_if:NF \l__fontspec_external_bool @@ -1040,8 +1269,8 @@ \prg_new_conditional:Nnn \__fontspec_if_autofont:nn {T,TF} { - \__fontspec_font_set:Nnn \l_tmpa_font { \__fontspec_fullname:n {#1} } {\f@size pt} - \__fontspec_font_set:Nnn \l_tmpb_font { \__fontspec_fullname:n {#1#2} } {\f@size pt} + \__fontspec_primitive_font_set:Nnn \l_tmpa_font { \__fontspec_construct_font_call:nn {#1} {} } {\f@size pt} + \__fontspec_primitive_font_set:Nnn \l_tmpb_font { \__fontspec_construct_font_call:nn {#1#2} {} } {\f@size pt} \str_if_eq_x:nnTF { \fontname \l_tmpa_font } { \fontname \l_tmpb_font } { \prg_return_false: } { \prg_return_true: } @@ -1049,7 +1278,7 @@ \cs_new:Nn \__fontspec_make_font_shapes:Nnnnn { \group_begin: - \keys_set_known:nxN {fontspec-preparse-external} { #4 } \l__fontspec_leftover_clist + \__fontspec_keys_set_known:nxN {fontspec-preparse-external} { #4 } \l__fontspec_leftover_clist \__fontspec_load_fontname:n {#1} \__fontspec_declare_shape:nnxx {#2} {#3} { \l__fontspec_fontopts_clist, \l__fontspec_leftover_clist } {#5} \group_end: @@ -1060,8 +1289,8 @@ \__fontspec_load_external_fontoptions:Nn \l_fontspec_fontname_tl {#1} \prop_get:NVNF \g__fontspec_fontopts_prop \l_fontspec_fontname_tl \l__fontspec_fontopts_clist { \clist_clear:N \l__fontspec_fontopts_clist } - \__fontspec_font_set:Nnn \l_fontspec_font {\__fontspec_fullname:n {\l_fontspec_fontname_tl}} {\f@size pt} - \__fontspec_font_if_null:NT \l_fontspec_font { \__fontspec_error:nx {font-not-found} {#1} } + \__fontspec_primitive_font_set:Nnn \l_fontspec_font { \__fontspec_construct_font_call:nn {\l_fontspec_fontname_tl} {} } {\f@size pt} + \__fontspec_primitive_font_if_null:NT \l_fontspec_font { \__fontspec_error:nx {font-not-found} {#1} } } \cs_new:Nn \__fontspec_declare_shape:nnnn { @@ -1069,25 +1298,33 @@ \tl_clear:N \l__fontspec_nfss_sc_tl \tl_set_eq:NN \l__fontspec_saved_fontname_tl \l_fontspec_fontname_tl - \exp_args:Nx \clist_map_inline:nn {#4} - { + \exp_args:Nx \clist_map_inline:nn {#4} { \__fontspec_setup_single_size:nn {#3} {##1} } + + \__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} +\cs_new:Nn \__fontspec_setup_single_size:nn + { \tl_clear:N \l__fontspec_size_tl \tl_set_eq:NN \l__fontspec_sizedfont_tl \l__fontspec_saved_fontname_tl % in case not spec'ed - \keys_set_known:nxN {fontspec-sizing} { \exp_after:wN \use:n ##1 } + \keys_set_known:nxN {fontspec-sizing} { \exp_after:wN \use:n #2 } \l__fontspec_sizing_leftover_clist \tl_if_empty:NT \l__fontspec_size_tl { \__fontspec_error:n {no-size-info} } % "normal" \__fontspec_load_fontname:n {\l__fontspec_sizedfont_tl} - \__fontspec_setup_nfss:Nnn \l__fontspec_nfss_tl {#3} {} + \__fontspec_setup_nfss:Nnnn \l__fontspec_nfss_tl {#1} {\l__fontspec_sizing_leftover_clist} {} % small caps \clist_set_eq:NN \l__fontspec_fontfeat_curr_clist \l__fontspec_fontfeat_sc_clist \bool_if:NF \l__fontspec_nosc_bool { - \tl_if_empty:NTF \l_fontspec_fontname_sc_tl + \tl_if_empty:NTF \l__fontspec_fontname_sc_tl { \__fontspec_make_smallcaps:TF { @@ -1097,60 +1334,47 @@ \bool_set_true:N \l__fontspec_nosc_bool } } - { \__fontspec_load_fontname:n {\l_fontspec_fontname_sc_tl} }% local for each size + { \__fontspec_load_fontname:n {\l__fontspec_fontname_sc_tl} }% local for each size } \bool_if:NF \l__fontspec_nosc_bool { - \__fontspec_setup_nfss:Nnn \l__fontspec_nfss_sc_tl {#3} {\l__fontspec_fontfeat_curr_clist} + \__fontspec_setup_nfss:Nnnn \l__fontspec_nfss_sc_tl + {#1} {\l__fontspec_sizing_leftover_clist} {\l__fontspec_fontfeat_curr_clist} } - - } - - \__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} - -\cs_new:Nn \__fontspec_setup_nfss:Nnn + } +\cs_new:Nn \__fontspec_setup_nfss:Nnnn { - \__fontspec_get_features:Nn \l__fontspec_rawfeatures_sclist - { #2 , \l__fontspec_sizing_leftover_clist , #3 } + + \__fontspec_get_features:Nn \l__fontspec_rawfeatures_sclist { #2 , #3 , #4 } \tl_put_right:Nx #1 { <\l__fontspec_size_tl> \l__fontspec_scale_tl - \__fontspec_fontwrap:n - { - \__fontspec_fullname:n { \l_fontspec_fontname_tl } - : \l__fontspec_pre_feat_sclist \l__fontspec_rawfeatures_sclist - } + \__fontspec_construct_font_call:nn { \l_fontspec_fontname_tl } + { \l__fontspec_pre_feat_sclist \l__fontspec_rawfeatures_sclist } } } - \cs_new:Nn \__fontspec_declare_shapes_normal:nn { \__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 + \tl_if_empty:NF \l__fontspec_nfss_sc_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 { \group_begin: @@ -1176,6 +1400,7 @@ { \tl_gput_right:Nx \l_fontspec_defined_shapes_tl { + \exp_not:n { \\ } -~ \exp_not:N \str_case:nn {#1/#2} { {\mddefault/\updefault} {'normal'~} @@ -1205,7 +1430,6 @@ } } } -\cs_generate_variant:Nn \tl_if_empty:nF {f} \clist_set:Nn \l__fontspec_pre_feat_sclist { \bool_if:NT \l__fontspec_ot_bool @@ -1217,226 +1441,148 @@ } } } -\cs_set:Nn \__fontspec_get_features:Nn +\cs_set:Nn \__fontspec_make_ot_smallcaps:TF { - \sclist_clear:N \l__fontspec_rawfeatures_sclist - \tl_clear:N \l__fontspec_scale_tl - \tl_set_eq:NN \l__fontspec_opacity_tl \g__fontspec_opacity_tl - \tl_set_eq:NN \l__fontspec_hexcol_tl \g__fontspec_hexcol_tl - \tl_set_eq:NN \l__fontspec_postadjust_tl \g__fontspec_postadjust_tl - \tl_clear:N \l__fontspec_wordspace_adjust_tl - \tl_clear:N \l__fontspec_punctspace_adjust_tl - - \keys_set_known:nxN {fontspec-renderer} {\l__fontspec_fontfeat_clist,#2} - \l__fontspec_keys_leftover_clist - \keys_set:nx {fontspec} {\l__fontspec_keys_leftover_clist} - \str_if_eq_x:nnF { \l__fontspec_hexcol_tl \l__fontspec_opacity_tl } - { \g__fontspec_hexcol_tl \g__fontspec_opacity_tl } + \__fontspec_check_ot_feat:nTF {smcp} {#1} {#2} + } +\cs_set:Nn \__fontspec_make_smallcaps:TF + { + \bool_if:NTF \l__fontspec_ot_bool + { \__fontspec_make_ot_smallcaps:TF {#1} {#2} } { - \__fontspec_update_featstr:n { color = \l__fontspec_hexcol_tl\l__fontspec_opacity_tl } + \bool_if:NT \l__fontspec_atsui_bool + { \__fontspec_make_AAT_feature_string:nnTF {3}{3} {#1} {#2} } } - - \tl_set_eq:NN #1 \l__fontspec_rawfeatures_sclist } -\tl_clear:N \l__fontspec_family_label_tl -\tl_clear:N \l_fontspec_fontname_bf_tl -\tl_clear:N \l_fontspec_fontname_it_tl -\tl_clear:N \l_fontspec_fake_slant_tl -\tl_clear:N \l_fontspec_fake_embolden_tl -\tl_clear:N \l_fontspec_fontname_bfit_tl -\tl_clear:N \l_fontspec_fontname_sl_tl -\tl_clear:N \l_fontspec_fontname_bfsl_tl -\tl_clear:N \l_fontspec_fontname_sc_tl -\tl_clear:N \l__fontspec_fontfeat_up_clist -\tl_clear:N \l__fontspec_fontfeat_bf_clist -\tl_clear:N \l__fontspec_fontfeat_it_clist -\tl_clear:N \l__fontspec_fontfeat_bfit_clist -\tl_clear:N \l__fontspec_fontfeat_sl_clist -\tl_clear:N \l__fontspec_fontfeat_bfsl_clist -\tl_clear:N \l__fontspec_fontfeat_sc_clist -\tl_clear:N \l__fontspec_script_name_tl -\tl_clear:N \l_fontspec_script_tl -\tl_clear:N \l__fontspec_lang_name_tl -\tl_clear:N \l_fontspec_lang_tl -\tl_set:Nn \g__fontspec_postadjust_tl { \l__fontspec_wordspace_adjust_tl \l__fontspec_punctspace_adjust_tl } - -\clist_set:Nn \l__fontspec_sizefeat_clist {Size={-}} -\tl_new:N \g__fontspec_hexcol_tl -\tl_new:N \g__fontspec_opacity_tl -\tl_set:Nn \g__fontspec_hexcol_tl {000000} -\tl_set:Nn \g__fontspec_opacity_tl {FF~} +\cs_new:Nn \__fontspec_update_featstr:n + { + \bool_if:NF \l__fontspec_firsttime_bool + { + \tl_gset:Nx \g__fontspec_single_feat_tl { #1 } + \tl_gput_right:Nx \l__fontspec_rawfeatures_sclist {#1;} + } + } +\cs_new:Nn \__fontspec_remove_clashing_featstr:n + { + \clist_map_inline:nn {#1} + { + \tl_gremove_all:Nn \l__fontspec_rawfeatures_sclist {##1;} + } + } \cs_set:Npn \__fontspec_init: { \bool_set_false:N \l__fontspec_ot_bool \bool_set_true:N \l__fontspec_firsttime_bool - \cs_set:Npn \__fontspec_namewrap:n ##1 { ##1 } + \__fontspec_font_is_name: + \tl_clear:N \l__fontspec_font_path_tl \tl_clear:N \l__fontspec_optical_size_tl + \tl_clear:N \l__fontspec_ttc_index_tl \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: - \exp_args:NV \str_case:nnF {\l__fontspec_family_label_tl} - { - {\rmdefault} { \tl_set:Nn \l__fontspec_family_label_tl {\g__fontspec_rmfamily_family} } - {\sfdefault} { \tl_set:Nn \l__fontspec_family_label_tl {\g__fontspec_sffamily_family} } - {\ttdefault} { \tl_set:Nn \l__fontspec_family_label_tl {\g__fontspec_ttfamily_family} } - }{} - } -\cs_set:Nn \fontspec_make_ot_smallcaps:TF +\cs_new:Nn \__fontspec_init_fontface: + { + \tl_clear:N \l__fontspec_rawfeatures_sclist + \tl_clear:N \l__fontspec_scale_tl + \tl_set_eq:NN \l__fontspec_opacity_tl \g__fontspec_opacity_tl + \tl_set_eq:NN \l__fontspec_hexcol_tl \g__fontspec_hexcol_tl + \tl_set_eq:NN \l__fontspec_postadjust_tl \g__fontspec_postadjust_tl + \tl_clear:N \l__fontspec_wordspace_adjust_tl + \tl_clear:N \l__fontspec_punctspace_adjust_tl + } +\cs_set:Nn \__fontspec_iv_str_to_num:Nn { - \fontspec_check_ot_feat:nTF {+smcp} {#1} {#2} + \__fontspec_iv_str_to_num:w #1 \q_nil #2 \c_empty_tl \c_empty_tl \q_nil } -\cs_set:Nn \__fontspec_make_smallcaps:TF +\cs_set:Npn \__fontspec_iv_str_to_num:w #1 \q_nil #2#3#4#5#6 \q_nil { - \bool_if:NTF \l__fontspec_ot_bool - { \fontspec_make_ot_smallcaps:TF {#1} {#2} } + \int_set:Nn #1 { - \bool_if:NT \l__fontspec_atsui_bool - { \fontspec_make_AAT_feature_string:nnTF {3}{3} {#1} {#2} } + `#2 * "1000000 + + `#3 * "10000 + + \ifx \c_empty_tl #4 32 \else `#4 \fi * "100 + + \ifx \c_empty_tl #5 32 \else `#5 \fi } } -\cs_set_eq:NN \sclist_clear:N \tl_clear:N -\cs_new:Nn \sclist_gput_right:Nn - { \tl_gput_right:Nn #1 {#2;} } -\cs_generate_variant:Nn \sclist_gput_right:Nn {Nx} -\cs_new:Nn \__fontspec_update_featstr:n +\cs_generate_variant:Nn \__fontspec_iv_str_to_num:Nn {No} +\cs_new:Nn \__fontspec_define_opentype_feature_group:n + { + \keys_define:nn {fontspec-opentype} { #1 .multichoice: } + } +\cs_new:Nn \__fontspec_feat_prop_add:nn + { + \tl_if_empty:nF {#1} + { + \prop_if_in:NnF \g__fontspec_OT_features_prop {#1} + { + \prop_gput:Nnn \g__fontspec_OT_features_prop {#1} {#2} + } + } + } +\cs_new:Nn \__fontspec_define_opentype_feature:nnnnn { - \bool_if:NF \l__fontspec_firsttime_bool + \__fontspec_feat_prop_add:nn {#3} {#1\,=\,#2} + \keys_define:nn {fontspec-opentype} { - \sclist_gput_right:Nx \l__fontspec_rawfeatures_sclist {#1} + #1/#2 .code:n = { \__fontspec_make_OT_feature:nnn {#3} {#4} {#5} } } } -\cs_new:Nn \fontspec_make_feature:nnn +\cs_new:Nn \__fontspec_feat_off:n {#1Off} +\cs_new:Nn \__fontspec_feat_reset:n {#1Reset} +\cs_new:Nn \__fontspec_define_opentype_onoffreset:nnnnn { - \bool_if:NTF \l__fontspec_ot_bool - { \fontspec_make_OT_feature:n {#3} } - { - \bool_if:NT \l__fontspec_atsui_bool - { \fontspec_make_AAT_feature:nn {#1}{#2} } - } + \exp_args:Nnx \__fontspec_define_opentype_feature:nnnnn {#1} {#2} {#3} {+#4} {#5} + \exp_args:Nnx \__fontspec_define_opentype_feature:nnnnn {#1} { \__fontspec_feat_off:n {#2} } {#3} {-#4} {} + \exp_args:Nnx \__fontspec_define_opentype_feature:nnnnn {#1} { \__fontspec_feat_reset:n {#2} } {} {} {+#4,-#4} } -\cs_generate_variant:Nn \fontspec_make_feature:nnn {nnx} -\cs_new:Nn \fontspec_make_AAT_feature:nn +\cs_new:Nn \__fontspec_define_opentype_onreset:nnnnn { - \tl_if_empty:nTF {#1} - { \__fontspec_warning:n {aat-feature-not-exist} } - { - \fontspec_make_AAT_feature_string:nnTF {#1}{#2} - { - \__fontspec_update_featstr:n {\l_fontspec_feature_string_tl} - } - { \__fontspec_warning:nx {aat-feature-not-exist-in-font} {#1,#2} } - } + \exp_args:Nnx \__fontspec_define_opentype_feature:nnnnn {#1} {#2} {#3} {#4} {#5} + \exp_args:Nnx \__fontspec_define_opentype_feature:nnnnn {#1} { \__fontspec_feat_reset:n {#2} } {} {} {#4} } -\cs_new:Nn \fontspec_make_OT_feature:n - { - \tl_if_empty:nTF {#1} - { \__fontspec_warning:n {icu-feature-not-exist} } - { - \fontspec_check_ot_feat:nTF {#1} +\cs_new:Nn \__fontspec_make_OT_feature:nnn + { + + \bool_set_true:N \l__fontspec_proceed_bool + \bool_set_true:N \l__fontspec_check_feat_bool + + \tl_if_empty:nT {#1} { \bool_set_false:N \l__fontspec_check_feat_bool } + \bool_if:NT \l__fontspec_check_feat_bool { - \__fontspec_update_featstr:n {#1} + \__fontspec_check_ot_feat:nF {#1} + { + \__fontspec_warning:nx {icu-feature-not-exist-in-font} {#1} + \bool_set_false:N \l__fontspec_proceed_bool + } } - { \__fontspec_warning:nx {icu-feature-not-exist-in-font} {#1} } - } - } -\cs_new_protected:Nn \fontspec_make_numbered_feature:nn - { - \fontspec_check_ot_feat:nTF {#1} - { - \__fontspec_update_featstr:n { #1 = #2 } - } - { \__fontspec_warning:nx {icu-feature-not-exist-in-font} {#1} } - } -\cs_generate_variant:Nn \fontspec_make_numbered_feature:nn {xn} -\cs_new:Nn \__fontspec_define_font_feature:n - { - \keys_define:nn {fontspec} { #1 .multichoice: } - } -\cs_new:Nn \__fontspec_define_feature_option:nnnnn - { - \keys_define:nn {fontspec} - { - #1/#2 .code:n = { \fontspec_make_feature:nnn{#3}{#4}{#5} } - } - } -\cs_new:Nn \fontspec_define_numbered_feat:nnnn - { - \keys_define:nn {fontspec} - { - #1/#2 .code:n = - { \fontspec_make_numbered_feature:nn {#3}{#4} } - } - } -\prg_new_conditional:Nnn \fontspec_make_AAT_feature_string:nn {TF,T,F} - { - \tl_set:Nx \l_tmpa_tl { \XeTeXfeaturename \l_fontspec_font #1 } - \tl_if_empty:NTF \l_tmpa_tl - { \prg_return_false: } - { - \int_compare:nTF { \XeTeXisexclusivefeature\l_fontspec_font #1 > 0 } - { - \tl_set:Nx \l_tmpb_tl {\XeTeXselectorname\l_fontspec_font #1\space #2} - } - { - \int_if_even:nTF {#2} - { - \tl_set:Nx \l_tmpb_tl {\XeTeXselectorname\l_fontspec_font #1\space #2} - } - { - \tl_set:Nx \l_tmpb_tl - { - \XeTeXselectorname\l_fontspec_font #1\space \numexpr#2-1\relax - } - \tl_if_empty:NF \l_tmpb_tl { \tl_put_left:Nn \l_tmpb_tl {!} } - } - } - \tl_if_empty:NTF \l_tmpb_tl - { \prg_return_false: } - { - \tl_set:Nx \l_fontspec_feature_string_tl { \l_tmpa_tl = \l_tmpb_tl } - \prg_return_true: - } - } - } -\cs_set:Nn \fontspec_iv_str_to_num:Nn - { - \fontspec_iv_str_to_num:w #1 \q_nil #2 \c_empty_tl \c_empty_tl \q_nil - } -\cs_set:Npn \fontspec_iv_str_to_num:w #1 \q_nil #2#3#4#5#6 \q_nil - { - \int_set:Nn #1 - { - `#2 * "1000000 - + `#3 * "10000 - + \ifx \c_empty_tl #4 32 \else `#4 \fi * "100 - + \ifx \c_empty_tl #5 32 \else `#5 \fi - } - } -\cs_generate_variant:Nn \fontspec_iv_str_to_num:Nn {No} -\cs_set:Nn \fontspec_v_str_to_num:Nn - { - \bool_if:nTF - { - \tl_if_head_eq_charcode_p:nN {#2} {+} || - \tl_if_head_eq_charcode_p:nN {#2} {-} - } - { \fontspec_iv_str_to_num:No #1 { \use_none:n #2 } } - { \fontspec_iv_str_to_num:Nn #1 {#2} } - } -\prg_new_conditional:Nnn \fontspec_check_script:n {TF} + + \bool_if:NT \l__fontspec_proceed_bool + { + \exp_args:Nx \__fontspec_remove_clashing_featstr:n + { #2 , \__fontspec_swap_plus_minus:n {#2} , #3 } + + \__fontspec_update_featstr:n {#2} + } + } +\cs_generate_variant:Nn \__fontspec_make_OT_feature:nnn {xxx} +\cs_new:Nn \__fontspec_swap_plus_minus:n { \__fontspec_swap_plus_minus_aux:NNNNN #1 } +\cs_new:Nn \__fontspec_swap_plus_minus_aux:NNNNN + { \str_case:nn {#1} { {+} {-#2#3#4#5} {-} {+#2#3#4#5} } } +\prg_new_conditional:Nnn \__fontspec_check_script:n {TF} + { + \bool_if:NTF \l__fontspec_never_check_bool + { \prg_return_true: } { - \fontspec_iv_str_to_num:Nn \l_fontspec_strnum_int {#1} + \__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 \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 + \ifnum \XeTeXOTscripttag\l_fontspec_font \l_tmpa_int = \l__fontspec_strnum_int \bool_set_true:N \l__fontspec_check_bool \int_set:Nn \l_tmpa_int {\l_tmpb_int} \else @@ -1445,16 +1591,20 @@ } \bool_if:NTF \l__fontspec_check_bool \prg_return_true: \prg_return_false: } -\prg_new_conditional:Nnn \fontspec_check_lang:n {TF} + } +\prg_new_conditional:Nnn \__fontspec_check_lang:n {TF} + { + \bool_if:NTF \l__fontspec_never_check_bool + { \prg_return_true: } { - \fontspec_iv_str_to_num:Nn \l_fontspec_strnum_int {#1} + \__fontspec_iv_str_to_num:Nn \l__fontspec_strnum_int {#1} \int_set:Nn \l_tmpb_int - { \XeTeXOTcountlanguages \l_fontspec_font \l_fontspec_script_int } + { \XeTeXOTcountlanguages \l_fontspec_font \l__fontspec_script_int } \int_zero:N \l_tmpa_int \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 + \ifnum\XeTeXOTlanguagetag\l_fontspec_font\l__fontspec_script_int \l_tmpa_int =\l__fontspec_strnum_int \bool_set_true:N \l__fontspec_check_bool \int_set:Nn \l_tmpa_int {\l_tmpb_int} \else @@ -1463,21 +1613,25 @@ } \bool_if:NTF \l__fontspec_check_bool \prg_return_true: \prg_return_false: } -\prg_new_conditional:Nnn \fontspec_check_ot_feat:n {TF,T} + } +\prg_new_conditional:Nnn \__fontspec_check_ot_feat:n {TF,F} + { + \bool_if:NTF \l__fontspec_never_check_bool + { \prg_return_true: } { \int_set:Nn \l_tmpb_int { \XeTeXOTcountfeatures \l_fontspec_font - \l_fontspec_script_int - \l_fontspec_language_int + \l__fontspec_script_int + \l__fontspec_language_int } - \fontspec_v_str_to_num:Nn \l_fontspec_strnum_int {#1} + \__fontspec_iv_str_to_num:Nn \l__fontspec_strnum_int {#1} \int_zero:N \l_tmpa_int \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 + \ifnum\XeTeXOTfeaturetag\l_fontspec_font\l__fontspec_script_int\l__fontspec_language_int + \l_tmpa_int =\l__fontspec_strnum_int \bool_set_true:N \l__fontspec_check_bool \int_set:Nn \l_tmpa_int {\l_tmpb_int} \else @@ -1486,35 +1640,221 @@ } \bool_if:NTF \l__fontspec_check_bool \prg_return_true: \prg_return_false: } - -\cs_new:Nn \__fontspec_keys_define_code:nnn + } +\prop_gput:Nnn \g__fontspec_all_opentype_feature_names_prop {aalt}{Access~All~Alternates} +\prop_gput:Nnn \g__fontspec_all_opentype_feature_names_prop {abvf}{Above-base~Forms} +\prop_gput:Nnn \g__fontspec_all_opentype_feature_names_prop {abvm}{Above-base~Mark~Positioning} +\prop_gput:Nnn \g__fontspec_all_opentype_feature_names_prop {abvs}{Above-base~Substitutions} +\prop_gput:Nnn \g__fontspec_all_opentype_feature_names_prop {afrc}{Alternative~Fractions} +\prop_gput:Nnn \g__fontspec_all_opentype_feature_names_prop {akhn}{Akhands} +\prop_gput:Nnn \g__fontspec_all_opentype_feature_names_prop {blwf}{Below-base~Forms} +\prop_gput:Nnn \g__fontspec_all_opentype_feature_names_prop {blwm}{Below-base~Mark~Positioning} +\prop_gput:Nnn \g__fontspec_all_opentype_feature_names_prop {blws}{Below-base~Substitutions} +\prop_gput:Nnn \g__fontspec_all_opentype_feature_names_prop {calt}{Contextual~Alternates} +\prop_gput:Nnn \g__fontspec_all_opentype_feature_names_prop {case}{Case-Sensitive~Forms} +\prop_gput:Nnn \g__fontspec_all_opentype_feature_names_prop {ccmp}{Glyph~Composition~/~Decomposition} +\prop_gput:Nnn \g__fontspec_all_opentype_feature_names_prop {cfar}{Conjunct~Form~After~Ro} +\prop_gput:Nnn \g__fontspec_all_opentype_feature_names_prop {cjct}{Conjunct~Forms} +\prop_gput:Nnn \g__fontspec_all_opentype_feature_names_prop {clig}{Contextual~Ligatures} +\prop_gput:Nnn \g__fontspec_all_opentype_feature_names_prop {cpct}{Centered~CJK~Punctuation} +\prop_gput:Nnn \g__fontspec_all_opentype_feature_names_prop {cpsp}{Capital~Spacing} +\prop_gput:Nnn \g__fontspec_all_opentype_feature_names_prop {cswh}{Contextual~Swash} +\prop_gput:Nnn \g__fontspec_all_opentype_feature_names_prop {curs}{Cursive~Positioning} +\prop_gput:Nnn \g__fontspec_all_opentype_feature_names_prop {cvNN}{Character~Variant~$N$} +\prop_gput:Nnn \g__fontspec_all_opentype_feature_names_prop {c2pc}{Petite~Capitals~From~Capitals} +\prop_gput:Nnn \g__fontspec_all_opentype_feature_names_prop {c2sc}{Small~Capitals~From~Capitals} +\prop_gput:Nnn \g__fontspec_all_opentype_feature_names_prop {dist}{Distances} +\prop_gput:Nnn \g__fontspec_all_opentype_feature_names_prop {dlig}{Discretionary~Ligatures} +\prop_gput:Nnn \g__fontspec_all_opentype_feature_names_prop {dnom}{Denominators} +\prop_gput:Nnn \g__fontspec_all_opentype_feature_names_prop {dtls}{Dotless~Forms} +\prop_gput:Nnn \g__fontspec_all_opentype_feature_names_prop {expt}{Expert~Forms} +\prop_gput:Nnn \g__fontspec_all_opentype_feature_names_prop {falt}{Final~Glyph~on~Line~Alternates} +\prop_gput:Nnn \g__fontspec_all_opentype_feature_names_prop {fin2}{Terminal~Forms~\#2} +\prop_gput:Nnn \g__fontspec_all_opentype_feature_names_prop {fin3}{Terminal~Forms~\#3} +\prop_gput:Nnn \g__fontspec_all_opentype_feature_names_prop {fina}{Terminal~Forms} +\prop_gput:Nnn \g__fontspec_all_opentype_feature_names_prop {flac}{Flattened~accent~forms} +\prop_gput:Nnn \g__fontspec_all_opentype_feature_names_prop {frac}{Fractions} +\prop_gput:Nnn \g__fontspec_all_opentype_feature_names_prop {fwid}{Full~Widths} +\prop_gput:Nnn \g__fontspec_all_opentype_feature_names_prop {half}{Half~Forms} +\prop_gput:Nnn \g__fontspec_all_opentype_feature_names_prop {haln}{Halant~Forms} +\prop_gput:Nnn \g__fontspec_all_opentype_feature_names_prop {halt}{Alternate~Half~Widths} +\prop_gput:Nnn \g__fontspec_all_opentype_feature_names_prop {hist}{Historical~Forms} +\prop_gput:Nnn \g__fontspec_all_opentype_feature_names_prop {hkna}{Horizontal~Kana~Alternates} +\prop_gput:Nnn \g__fontspec_all_opentype_feature_names_prop {hlig}{Historical~Ligatures} +\prop_gput:Nnn \g__fontspec_all_opentype_feature_names_prop {hngl}{Hangul} +\prop_gput:Nnn \g__fontspec_all_opentype_feature_names_prop {hojo}{Hojo~Kanji~Forms} +\prop_gput:Nnn \g__fontspec_all_opentype_feature_names_prop {hwid}{Half~Widths} +\prop_gput:Nnn \g__fontspec_all_opentype_feature_names_prop {init}{Initial~Forms} +\prop_gput:Nnn \g__fontspec_all_opentype_feature_names_prop {isol}{Isolated~Forms} +\prop_gput:Nnn \g__fontspec_all_opentype_feature_names_prop {ital}{Italics} +\prop_gput:Nnn \g__fontspec_all_opentype_feature_names_prop {jalt}{Justification~Alternates} +\prop_gput:Nnn \g__fontspec_all_opentype_feature_names_prop {jp78}{JIS78~Forms} +\prop_gput:Nnn \g__fontspec_all_opentype_feature_names_prop {jp83}{JIS83~Forms} +\prop_gput:Nnn \g__fontspec_all_opentype_feature_names_prop {jp90}{JIS90~Forms} +\prop_gput:Nnn \g__fontspec_all_opentype_feature_names_prop {jp04}{JIS2004~Forms} +\prop_gput:Nnn \g__fontspec_all_opentype_feature_names_prop {kern}{Kerning} +\prop_gput:Nnn \g__fontspec_all_opentype_feature_names_prop {lfbd}{Left~Bounds} +\prop_gput:Nnn \g__fontspec_all_opentype_feature_names_prop {liga}{Standard~Ligatures} +\prop_gput:Nnn \g__fontspec_all_opentype_feature_names_prop {ljmo}{Leading~Jamo~Forms} +\prop_gput:Nnn \g__fontspec_all_opentype_feature_names_prop {lnum}{Lining~Figures} +\prop_gput:Nnn \g__fontspec_all_opentype_feature_names_prop {locl}{Localized~Forms} +\prop_gput:Nnn \g__fontspec_all_opentype_feature_names_prop {ltra}{Left-to-right~alternates} +\prop_gput:Nnn \g__fontspec_all_opentype_feature_names_prop {ltrm}{Left-to-right~mirrored~forms} +\prop_gput:Nnn \g__fontspec_all_opentype_feature_names_prop {mark}{Mark~Positioning} +\prop_gput:Nnn \g__fontspec_all_opentype_feature_names_prop {med2}{Medial~Forms~\#2} +\prop_gput:Nnn \g__fontspec_all_opentype_feature_names_prop {medi}{Medial~Forms} +\prop_gput:Nnn \g__fontspec_all_opentype_feature_names_prop {mgrk}{Mathematical~Greek} +\prop_gput:Nnn \g__fontspec_all_opentype_feature_names_prop {mkmk}{Mark~to~Mark~Positioning} +\prop_gput:Nnn \g__fontspec_all_opentype_feature_names_prop {mset}{Mark~Positioning~via~Substitution} +\prop_gput:Nnn \g__fontspec_all_opentype_feature_names_prop {nalt}{Alternate~Annotation~Forms} +\prop_gput:Nnn \g__fontspec_all_opentype_feature_names_prop {nlck}{NLC~Kanji~Forms} +\prop_gput:Nnn \g__fontspec_all_opentype_feature_names_prop {nukt}{Nukta~Forms} +\prop_gput:Nnn \g__fontspec_all_opentype_feature_names_prop {numr}{Numerators} +\prop_gput:Nnn \g__fontspec_all_opentype_feature_names_prop {onum}{Oldstyle~Figures} +\prop_gput:Nnn \g__fontspec_all_opentype_feature_names_prop {opbd}{Optical~Bounds} +\prop_gput:Nnn \g__fontspec_all_opentype_feature_names_prop {ordn}{Ordinals} +\prop_gput:Nnn \g__fontspec_all_opentype_feature_names_prop {ornm}{Ornaments} +\prop_gput:Nnn \g__fontspec_all_opentype_feature_names_prop {palt}{Proportional~Alternate~Widths} +\prop_gput:Nnn \g__fontspec_all_opentype_feature_names_prop {pcap}{Petite~Capitals} +\prop_gput:Nnn \g__fontspec_all_opentype_feature_names_prop {pkna}{Proportional~Kana} +\prop_gput:Nnn \g__fontspec_all_opentype_feature_names_prop {pnum}{Proportional~Figures} +\prop_gput:Nnn \g__fontspec_all_opentype_feature_names_prop {pref}{Pre-Base~Forms} +\prop_gput:Nnn \g__fontspec_all_opentype_feature_names_prop {pres}{Pre-base~Substitutions} +\prop_gput:Nnn \g__fontspec_all_opentype_feature_names_prop {pstf}{Post-base~Forms} +\prop_gput:Nnn \g__fontspec_all_opentype_feature_names_prop {psts}{Post-base~Substitutions} +\prop_gput:Nnn \g__fontspec_all_opentype_feature_names_prop {pwid}{Proportional~Widths} +\prop_gput:Nnn \g__fontspec_all_opentype_feature_names_prop {qwid}{Quarter~Widths} +\prop_gput:Nnn \g__fontspec_all_opentype_feature_names_prop {rand}{Randomize} +\prop_gput:Nnn \g__fontspec_all_opentype_feature_names_prop {rclt}{Required~Contextual~Alternates} +\prop_gput:Nnn \g__fontspec_all_opentype_feature_names_prop {rkrf}{Rakar~Forms} +\prop_gput:Nnn \g__fontspec_all_opentype_feature_names_prop {rlig}{Required~Ligatures} +\prop_gput:Nnn \g__fontspec_all_opentype_feature_names_prop {rphf}{Reph~Forms} +\prop_gput:Nnn \g__fontspec_all_opentype_feature_names_prop {rtbd}{Right~Bounds} +\prop_gput:Nnn \g__fontspec_all_opentype_feature_names_prop {rtla}{Right-to-left~alternates} +\prop_gput:Nnn \g__fontspec_all_opentype_feature_names_prop {rtlm}{Right-to-left~mirrored~forms} +\prop_gput:Nnn \g__fontspec_all_opentype_feature_names_prop {ruby}{Ruby~Notation~Forms} +\prop_gput:Nnn \g__fontspec_all_opentype_feature_names_prop {rvrn}{Required~Variation~Alternates} +\prop_gput:Nnn \g__fontspec_all_opentype_feature_names_prop {salt}{Stylistic~Alternates} +\prop_gput:Nnn \g__fontspec_all_opentype_feature_names_prop {sinf}{Scientific~Inferiors} +\prop_gput:Nnn \g__fontspec_all_opentype_feature_names_prop {size}{Optical~size} +\prop_gput:Nnn \g__fontspec_all_opentype_feature_names_prop {smcp}{Small~Capitals} +\prop_gput:Nnn \g__fontspec_all_opentype_feature_names_prop {smpl}{Simplified~Forms} +\prop_gput:Nnn \g__fontspec_all_opentype_feature_names_prop {ssNN}{Stylistic~Set~$N$} +\prop_gput:Nnn \g__fontspec_all_opentype_feature_names_prop {ssty}{Math~script~style~alternates} +\prop_gput:Nnn \g__fontspec_all_opentype_feature_names_prop {stch}{Stretching~Glyph~Decomposition} +\prop_gput:Nnn \g__fontspec_all_opentype_feature_names_prop {subs}{Subscript} +\prop_gput:Nnn \g__fontspec_all_opentype_feature_names_prop {sups}{Superscript} +\prop_gput:Nnn \g__fontspec_all_opentype_feature_names_prop {swsh}{Swash} +\prop_gput:Nnn \g__fontspec_all_opentype_feature_names_prop {titl}{Titling} +\prop_gput:Nnn \g__fontspec_all_opentype_feature_names_prop {tjmo}{Trailing~Jamo~Forms} +\prop_gput:Nnn \g__fontspec_all_opentype_feature_names_prop {tnam}{Traditional~Name~Forms} +\prop_gput:Nnn \g__fontspec_all_opentype_feature_names_prop {tnum}{Tabular~Figures} +\prop_gput:Nnn \g__fontspec_all_opentype_feature_names_prop {trad}{Traditional~Forms} +\prop_gput:Nnn \g__fontspec_all_opentype_feature_names_prop {twid}{Third~Widths} +\prop_gput:Nnn \g__fontspec_all_opentype_feature_names_prop {unic}{Unicase} +\prop_gput:Nnn \g__fontspec_all_opentype_feature_names_prop {valt}{Alternate~Vertical~Metrics} +\prop_gput:Nnn \g__fontspec_all_opentype_feature_names_prop {vatu}{Vattu~Variants} +\prop_gput:Nnn \g__fontspec_all_opentype_feature_names_prop {vert}{Vertical~Writing} +\prop_gput:Nnn \g__fontspec_all_opentype_feature_names_prop {vhal}{Alternate~Vertical~Half~Metrics} +\prop_gput:Nnn \g__fontspec_all_opentype_feature_names_prop {vjmo}{Vowel~Jamo~Forms} +\prop_gput:Nnn \g__fontspec_all_opentype_feature_names_prop {vkna}{Vertical~Kana~Alternates} +\prop_gput:Nnn \g__fontspec_all_opentype_feature_names_prop {vkrn}{Vertical~Kerning} +\prop_gput:Nnn \g__fontspec_all_opentype_feature_names_prop {vpal}{Proportional~Alternate~Vertical~Metrics} +\prop_gput:Nnn \g__fontspec_all_opentype_feature_names_prop {vrt2}{Vertical~Alternates~and~Rotation} +\prop_gput:Nnn \g__fontspec_all_opentype_feature_names_prop {vrtr}{Vertical~Alternates~for~Rotation} +\prop_gput:Nnn \g__fontspec_all_opentype_feature_names_prop {zero}{Slashed~Zero} + + +\cs_new:Nn \__fontspec_define_aat_feature_group:n + { \keys_define:nn {fontspec-aat} { #1 .multichoice: } } +\cs_new:Nn \__fontspec_define_aat_feature:nnnn + { + \keys_define:nn {fontspec-aat} + { + #1/#2 .code:n = { \__fontspec_make_AAT_feature:nn {#3}{#4} } + } + } + +\cs_new:Nn \__fontspec_make_AAT_feature:nn { - \keys_define:nn {#1} { #2 .code:n = {#3} } + \tl_if_empty:nTF {#1} + { \__fontspec_warning:n {aat-feature-not-exist} } + { + \__fontspec_make_AAT_feature_string:nnTF {#1}{#2} + { + \__fontspec_update_featstr:n {\l_fontspec_feature_string_tl} + } + { \__fontspec_warning:nx {aat-feature-not-exist-in-font} {#1,#2} } + } } +\prg_new_conditional:Nnn \__fontspec_make_AAT_feature_string:nn {TF,T,F} + { + \tl_set:Nx \l_tmpa_tl { \XeTeXfeaturename \l_fontspec_font #1 } + \tl_if_empty:NTF \l_tmpa_tl + { \prg_return_false: } + { + \int_compare:nTF { \XeTeXisexclusivefeature\l_fontspec_font #1 > 0 } + { + \tl_set:Nx \l_tmpb_tl {\XeTeXselectorname\l_fontspec_font #1\space #2} + } + { + \int_if_even:nTF {#2} + { + \tl_set:Nx \l_tmpb_tl {\XeTeXselectorname\l_fontspec_font #1\space #2} + } + { + \tl_set:Nx \l_tmpb_tl + { + \XeTeXselectorname\l_fontspec_font #1\space \numexpr#2-1\relax + } + \tl_if_empty:NF \l_tmpb_tl { \tl_put_left:Nn \l_tmpb_tl {!} } + } + } + \tl_if_empty:NTF \l_tmpb_tl + { \prg_return_false: } + { + \tl_set:Nx \l_fontspec_feature_string_tl { \l_tmpa_tl = \l_tmpb_tl } + \prg_return_true: + } + } + } + +\clist_set:Nn \g__fontspec_all_keyval_modules_clist + { + fontspec, fontspec-opentype, fontspec-aat, + fontspec-preparse, fontspec-preparse-external, fontspec-preparse-nested, + fontspec-renderer + } +\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} +\__fontspec_keys_define_code:nnn {fontspec-preparse-external} {Path} { \bool_set_true:N \l__fontspec_nobf_bool \bool_set_true:N \l__fontspec_noit_bool \bool_set_true:N \l__fontspec_external_bool - \cs_set:Npn \__fontspec_namewrap:n ##1 { [ #1 ##1 ] } + \tl_set:Nn \l__fontspec_font_path_tl {#1} + \__fontspec_font_is_file: \keys_set:nn {fontspec-renderer} {Renderer=OpenType} } -\aliasfontfeature{ExternalLocation}{Path} +\aliasfontfeature{Path}{ExternalLocation} +\__fontspec_keys_define_code:nnn {fontspec} {Path} {} \__fontspec_keys_define_code:nnn {fontspec-preparse-external} {Extension} { \tl_set:Nn \l__fontspec_extension_tl {#1} \bool_if:NF \l__fontspec_external_bool { - \keys_set:nn {fontspec-preparse-external} {ExternalLocation} + \keys_set:nn {fontspec-preparse-external} {Path} } } \tl_clear:N \l__fontspec_extension_tl +\__fontspec_keys_define_code:nnn {fontspec} {Extension} {} \keys_define:nn {fontspec-renderer} { Renderer .choices:nn = @@ -1523,6 +1863,7 @@ \int_compare:nTF {\l_keys_choice_int <= 4} { \tl_set:Nv \l_fontspec_renderer_tl { g_fontspec_renderer_tag_ \l_keys_choice_tl } + \tl_gset:Nx \g__fontspec_single_feat_tl { \l_fontspec_renderer_tl } } { \__fontspec_warning:nx {only-luatex-feature} {Renderer=Full/Basic} @@ -1545,7 +1886,16 @@ \keys_set:nn {fontspec-renderer} {Renderer=OpenType} \tl_set:Nn \l__fontspec_lang_name_tl {#1} } -\seq_new:N \g__fontspec_bf_series_seq +\__fontspec_keys_define_code:nnn {fontspec-preparse} {FontIndex} + { + \str_if_eq_x:nnF { \str_lower_case:f {\l__fontspec_extension_tl} } {.ttc} + { \__fontspec_warning:n {font-index-needs-ttc} } + \tl_set:Nn \l__fontspec_ttc_index_tl {:#1} + } +\__fontspec_keys_define_code:nnn {fontspec} {FontIndex} + { + \tl_set:Nn \l__fontspec_ttc_index_tl {:#1} + } \__fontspec_keys_define_code:nnn {fontspec-preparse-external} {BoldSeries} { \tl_gset:Nx \g__fontspec_curr_series_tl { #1 } @@ -1553,14 +1903,12 @@ } \__fontspec_keys_define_code:nnn {fontspec-preparse-external} {UprightFont} { - \fontspec_complete_fontname:Nn \l_fontspec_fontname_up_tl {#1} + \fontspec_complete_fontname:Nn \l__fontspec_fontname_up_tl {#1} } \__fontspec_keys_define_code:nnn {fontspec-preparse-external} {FontName} { - \fontspec_complete_fontname:Nn \l_fontspec_fontname_up_tl {#1} + \fontspec_complete_fontname:Nn \l__fontspec_fontname_up_tl {#1} } -\cs_generate_variant:Nn \tl_if_eq:nnT {ox} -\cs_generate_variant:Nn \prop_put:Nnn {NxV} \__fontspec_keys_define_code:nnn {fontspec-preparse-external} {BoldFont} { \tl_if_empty:nTF {#1} @@ -1577,7 +1925,7 @@ \seq_put_right:Nx \g__fontspec_bf_series_seq {\bfdefault} } \tl_if_eq:oxT \g__fontspec_curr_series_tl {\bfdefault} - { \tl_set_eq:NN \l_fontspec_fontname_bf_tl \l__fontspec_curr_bfname_tl } + { \tl_set_eq:NN \l__fontspec_fontname_bf_tl \l__fontspec_curr_bfname_tl } \prop_put:NxV \l__fontspec_nfss_prop @@ -1585,7 +1933,6 @@ } } -\prop_new:N \l__fontspec_nfss_prop \__fontspec_keys_define_code:nnn {fontspec-preparse-external} {ItalicFont} { \tl_if_empty:nTF {#1} @@ -1594,20 +1941,20 @@ } { \bool_set_false:N \l__fontspec_noit_bool - \fontspec_complete_fontname:Nn \l_fontspec_fontname_it_tl {#1} + \fontspec_complete_fontname:Nn \l__fontspec_fontname_it_tl {#1} } } \__fontspec_keys_define_code:nnn {fontspec-preparse-external} {BoldItalicFont} { - \fontspec_complete_fontname:Nn \l_fontspec_fontname_bfit_tl {#1} + \fontspec_complete_fontname:Nn \l__fontspec_fontname_bfit_tl {#1} } \__fontspec_keys_define_code:nnn {fontspec-preparse-external} {SlantedFont} { - \fontspec_complete_fontname:Nn \l_fontspec_fontname_sl_tl {#1} + \fontspec_complete_fontname:Nn \l__fontspec_fontname_sl_tl {#1} } \__fontspec_keys_define_code:nnn {fontspec-preparse-external} {BoldSlantedFont} { - \fontspec_complete_fontname:Nn \l_fontspec_fontname_bfsl_tl {#1} + \fontspec_complete_fontname:Nn \l__fontspec_fontname_bfsl_tl {#1} } \__fontspec_keys_define_code:nnn {fontspec} {SmallCapsFont} { @@ -1617,15 +1964,9 @@ } { \bool_set_false:N \l__fontspec_nosc_bool - \fontspec_complete_fontname:Nn \l_fontspec_fontname_sc_tl {#1} + \fontspec_complete_fontname:Nn \l__fontspec_fontname_sc_tl {#1} } } -\cs_set:Nn \fontspec_complete_fontname:Nn - { - \tl_set:Nx #1 {#2} - \tl_replace_all:Nnx #1 {*} {\l__fontspec_basename_tl} - } -\cs_generate_variant:Nn \tl_replace_all:Nnn {Nnx} \__fontspec_keys_define_code:nnn {fontspec-preparse} {UprightFeatures} { \clist_set:Nn \l__fontspec_fontfeat_up_clist {#1} @@ -1700,7 +2041,6 @@ \tl_if_exist:NT \l_fontspec_family_tl { \cs_undefine:c {g__fontspec_ \l_fontspec_family_tl _prop} } } -\prop_new:N \l__fontspec_nfssfont_prop \__fontspec_keys_define_code:nnn {fontspec} {FontFace} { \tl_set:No \l__fontspec_arg_tl { \use_iii:nnn #1 } @@ -1718,20 +2058,6 @@ \__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 - { - \tl_set:Nx \l__fontspec_this_font_tl {#3} - - \tl_if_empty:xTF {#4} - { \clist_set:Nn \l__fontspec_sizefeat_clist {Size={-}} } - { \keys_set_known:noN {fontspec-preparse-nested} {#4} \l__fontspec_tmp_tl } - - \tl_if_empty:NF \l__fontspec_this_font_tl - { - \prop_put:Nxx \l__fontspec_nfssfont_prop {#1/#2} - { {#1}{#2}{\l__fontspec_this_font_tl}{#4}{\l__fontspec_sizefeat_clist} } - } - } \__fontspec_keys_define_code:nnn {fontspec} {Scale} { \str_case:nnF {#1} @@ -1764,7 +2090,7 @@ \settoheight #1 { \str_if_eq:nnTF {#3} {\font} \rmfamily #3 - \int_case:nnn #2 + \int_case:nnF #2 { {5} {x} % x-height {8} {X} % cap-height @@ -1841,7 +2167,7 @@ \tl_if_single:nTF {#1} { \tl_set:Nn \l_fontspec_hyphenchar_tl {`#1} } { \tl_set:Nn \l_fontspec_hyphenchar_tl { #1} } - \font_glyph_if_exist:NnTF \l_fontspec_font {\l_fontspec_hyphenchar_tl} + \__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: } @@ -1880,7 +2206,6 @@ \tl_set:Nn \l__fontspec_opacity_tl {#7#8} } \aliasfontfeature{Color}{Colour} -\int_new:N \l__fontspec_tmp_int \__fontspec_keys_define_code:nnn {fontspec} {Opacity} { \int_set:Nn \l__fontspec_tmp_int {255} @@ -1900,10 +2225,6 @@ { \__fontspec_update_featstr:n { mapping = #1 } } -\__fontspec_keys_define_code:nnn {fontspec} {FeatureFile} - { - \__fontspec_update_featstr:n { featurefile = #1 } - } \__fontspec_keys_define_code:nnn {fontspec} {Weight} { \__fontspec_update_featstr:n{weight=#1} @@ -1960,17 +2281,17 @@ { \bool_if:NT \l__fontspec_firsttime_bool { - \tl_set:Nn \l_fontspec_fake_slant_tl {#1} + \tl_set:Nn \l__fontspec_fake_slant_tl {#1} \clist_put_right:Nn \l__fontspec_fontfeat_it_clist {FakeSlant=#1} - \tl_set_eq:NN \l_fontspec_fontname_it_tl \l_fontspec_fontname_tl + \tl_set_eq:NN \l__fontspec_fontname_it_tl \l_fontspec_fontname_tl \bool_set_false:N \l__fontspec_noit_bool - \tl_if_empty:NF \l_fontspec_fake_embolden_tl + \tl_if_empty:NF \l__fontspec_fake_embolden_tl { \clist_put_right:Nx \l__fontspec_fontfeat_bfit_clist - {FakeBold=\l_fontspec_fake_embolden_tl} + {FakeBold=\l__fontspec_fake_embolden_tl} \clist_put_right:Nx \l__fontspec_fontfeat_bfit_clist {FakeSlant=#1} - \tl_set_eq:NN \l_fontspec_fontname_bfit_tl \l_fontspec_fontname_tl + \tl_set_eq:NN \l__fontspec_fontname_bfit_tl \l_fontspec_fontname_tl } } }, @@ -1982,154 +2303,247 @@ { \bool_if:NT \l__fontspec_firsttime_bool { - \tl_set:Nn \l_fontspec_fake_embolden_tl {#1} + \tl_set:Nn \l__fontspec_fake_embolden_tl {#1} \clist_put_right:Nn \l__fontspec_fontfeat_bf_clist {FakeBold=#1} - \tl_set_eq:NN \l_fontspec_fontname_bf_tl \l_fontspec_fontname_tl + \tl_set_eq:NN \l__fontspec_fontname_bf_tl \l_fontspec_fontname_tl \bool_set_false:N \l__fontspec_nobf_bool - \tl_if_empty:NF \l_fontspec_fake_slant_tl + \tl_if_empty:NF \l__fontspec_fake_slant_tl { \clist_put_right:Nx \l__fontspec_fontfeat_bfit_clist - {FakeSlant=\l_fontspec_fake_slant_tl} + {FakeSlant=\l__fontspec_fake_slant_tl} \clist_put_right:Nx \l__fontspec_fontfeat_bfit_clist {FakeBold=#1} - \tl_set_eq:NN \l_fontspec_fontname_bfit_tl \l_fontspec_fontname_tl + \tl_set_eq:NN \l__fontspec_fontname_bfit_tl \l_fontspec_fontname_tl } } }, AutoFakeBold .default:n = {1.5} } -\__fontspec_define_font_feature:n{Ligatures} -\__fontspec_define_feature_option:nnnnn{Ligatures}{Required} {1}{0}{+rlig} -\__fontspec_define_feature_option:nnnnn{Ligatures}{NoRequired} {1}{1}{-rlig} -\__fontspec_define_feature_option:nnnnn{Ligatures}{Common} {1}{2}{+liga} -\__fontspec_define_feature_option:nnnnn{Ligatures}{NoCommon} {1}{3}{-liga} -\__fontspec_define_feature_option:nnnnn{Ligatures}{Rare} {1}{4}{+dlig} -\__fontspec_define_feature_option:nnnnn{Ligatures}{NoRare} {1}{5}{-dlig} -\__fontspec_define_feature_option:nnnnn{Ligatures}{Discretionary} {1}{4}{+dlig} -\__fontspec_define_feature_option:nnnnn{Ligatures}{NoDiscretionary}{1}{5}{-dlig} -\__fontspec_define_feature_option:nnnnn{Ligatures}{Contextual} {}{} {+clig} -\__fontspec_define_feature_option:nnnnn{Ligatures}{NoContextual} {}{} {-clig} -\__fontspec_define_feature_option:nnnnn{Ligatures}{Historic} {}{} {+hlig} -\__fontspec_define_feature_option:nnnnn{Ligatures}{NoHistoric} {}{} {-hlig} -\__fontspec_define_feature_option:nnnnn{Ligatures}{Logos} {1}{6} {} -\__fontspec_define_feature_option:nnnnn{Ligatures}{NoLogos} {1}{7} {} -\__fontspec_define_feature_option:nnnnn{Ligatures}{Rebus} {1}{8} {} -\__fontspec_define_feature_option:nnnnn{Ligatures}{NoRebus} {1}{9} {} -\__fontspec_define_feature_option:nnnnn{Ligatures}{Diphthong} {1}{10}{} -\__fontspec_define_feature_option:nnnnn{Ligatures}{NoDiphthong} {1}{11}{} -\__fontspec_define_feature_option:nnnnn{Ligatures}{Squared} {1}{12}{} -\__fontspec_define_feature_option:nnnnn{Ligatures}{NoSquared} {1}{13}{} -\__fontspec_define_feature_option:nnnnn{Ligatures}{AbbrevSquared} {1}{14}{} -\__fontspec_define_feature_option:nnnnn{Ligatures}{NoAbbrevSquared}{1}{15}{} -\__fontspec_define_feature_option:nnnnn{Ligatures}{Icelandic} {1}{32}{} -\__fontspec_define_feature_option:nnnnn{Ligatures}{NoIcelandic} {1}{33}{} -\keys_define:nn {fontspec} +\__fontspec_keys_define_code:nnn {fontspec} {RawFeature} { - Ligatures / TeX .code:n = - { - \__fontspec_update_featstr:n { mapping = tex-text } - } + \__fontspec_update_featstr:n {#1} } -\__fontspec_define_font_feature:n{Letters} -\__fontspec_define_feature_option:nnnnn{Letters}{Normal} {3}{0}{} -\__fontspec_define_feature_option:nnnnn{Letters}{Uppercase} {3}{1}{+case} -\__fontspec_define_feature_option:nnnnn{Letters}{Lowercase} {3}{2}{} -\__fontspec_define_feature_option:nnnnn{Letters}{SmallCaps} {3}{3}{+smcp} -\__fontspec_define_feature_option:nnnnn{Letters}{PetiteCaps} {} {} {+pcap} -\__fontspec_define_feature_option:nnnnn{Letters}{UppercaseSmallCaps} {} {} {+c2sc} -\__fontspec_define_feature_option:nnnnn{Letters}{UppercasePetiteCaps}{} {} {+c2pc} -\__fontspec_define_feature_option:nnnnn{Letters}{InitialCaps} {3}{4}{} -\__fontspec_define_feature_option:nnnnn{Letters}{Unicase} {} {} {+unic} -\__fontspec_define_feature_option:nnnnn{Letters}{Random} {} {} {+rand} -\__fontspec_define_font_feature:n{Numbers} -\__fontspec_define_feature_option:nnnnn{Numbers}{Monospaced} {6} {0}{+tnum} -\__fontspec_define_feature_option:nnnnn{Numbers}{Proportional} {6} {1}{+pnum} -\__fontspec_define_feature_option:nnnnn{Numbers}{Lowercase} {21}{0}{+onum} -\__fontspec_define_feature_option:nnnnn{Numbers}{OldStyle} {21}{0}{+onum} -\__fontspec_define_feature_option:nnnnn{Numbers}{Uppercase} {21}{1}{+lnum} -\__fontspec_define_feature_option:nnnnn{Numbers}{Lining} {21}{1}{+lnum} -\__fontspec_define_feature_option:nnnnn{Numbers}{SlashedZero} {14}{5}{+zero} -\__fontspec_define_feature_option:nnnnn{Numbers}{NoSlashedZero}{14}{4}{-zero} -\luatex_if_engine:T - { - \__fontspec_define_feature_option:nnnnn{Numbers}{Arabic}{}{}{+anum} - } -\__fontspec_define_font_feature:n {Contextuals} -\__fontspec_define_feature_option:nnnnn{Contextuals}{Swash} {} {} {+cswh} -\__fontspec_define_feature_option:nnnnn{Contextuals}{NoSwash} {} {} {-cswh} -\__fontspec_define_feature_option:nnnnn{Contextuals}{Alternate} {} {} {+calt} -\__fontspec_define_feature_option:nnnnn{Contextuals}{NoAlternate} {} {} {-calt} -\__fontspec_define_feature_option:nnnnn{Contextuals}{WordInitial} {8}{0}{+init} -\__fontspec_define_feature_option:nnnnn{Contextuals}{NoWordInitial}{8}{1}{-init} -\__fontspec_define_feature_option:nnnnn{Contextuals}{WordFinal} {8}{2}{+fina} -\__fontspec_define_feature_option:nnnnn{Contextuals}{NoWordFinal} {8}{3}{-fina} -\__fontspec_define_feature_option:nnnnn{Contextuals}{LineInitial} {8}{4}{} -\__fontspec_define_feature_option:nnnnn{Contextuals}{NoLineInitial}{8}{5}{} -\__fontspec_define_feature_option:nnnnn{Contextuals}{LineFinal} {8}{6}{+falt} -\__fontspec_define_feature_option:nnnnn{Contextuals}{NoLineFinal} {8}{7}{-falt} -\__fontspec_define_feature_option:nnnnn{Contextuals}{Inner} {8}{8}{+medi} -\__fontspec_define_feature_option:nnnnn{Contextuals}{NoInner} {8}{9}{-medi} -\__fontspec_define_font_feature:n{Diacritics} -\__fontspec_define_feature_option:nnnnn{Diacritics}{Show} {9}{0}{} -\__fontspec_define_feature_option:nnnnn{Diacritics}{Hide} {9}{1}{} -\__fontspec_define_feature_option:nnnnn{Diacritics}{Decompose} {9}{2}{} -\__fontspec_define_feature_option:nnnnn{Diacritics}{MarkToBase} {}{}{+mark} -\__fontspec_define_feature_option:nnnnn{Diacritics}{NoMarkToBase}{}{}{-mark} -\__fontspec_define_feature_option:nnnnn{Diacritics}{MarkToMark} {}{}{+mkmk} -\__fontspec_define_feature_option:nnnnn{Diacritics}{NoMarkToMark}{}{}{-mkmk} -\__fontspec_define_feature_option:nnnnn{Diacritics}{AboveBase} {}{}{+abvm} -\__fontspec_define_feature_option:nnnnn{Diacritics}{NoAboveBase} {}{}{-abvm} -\__fontspec_define_feature_option:nnnnn{Diacritics}{BelowBase} {}{}{+blwm} -\__fontspec_define_feature_option:nnnnn{Diacritics}{NoBelowBase} {}{}{-blwm} -\__fontspec_define_font_feature:n{Kerning} -\__fontspec_define_feature_option:nnnnn{Kerning}{Uppercase}{}{}{+cpsp} -\__fontspec_define_feature_option:nnnnn{Kerning}{On} {}{}{+kern} -\__fontspec_define_feature_option:nnnnn{Kerning}{Off} {}{}{-kern} -\__fontspec_define_font_feature:n{VerticalPosition} -\__fontspec_define_feature_option:nnnnn{VerticalPosition}{Normal} {10}{0}{} -\__fontspec_define_feature_option:nnnnn{VerticalPosition}{Superior} {10}{1}{+sups} -\__fontspec_define_feature_option:nnnnn{VerticalPosition}{Inferior} {10}{2}{+subs} -\__fontspec_define_feature_option:nnnnn{VerticalPosition}{Ordinal} {10}{3}{+ordn} -\__fontspec_define_feature_option:nnnnn{VerticalPosition}{Numerator} {} {} {+numr} -\__fontspec_define_feature_option:nnnnn{VerticalPosition}{Denominator}{} {} {+dnom} -\__fontspec_define_feature_option:nnnnn{VerticalPosition}{ScientificInferior}{}{}{+sinf} -\__fontspec_define_font_feature:n{Fractions} -\__fontspec_define_feature_option:nnnnn{Fractions}{On} {11}{1}{+frac} -\__fontspec_define_feature_option:nnnnn{Fractions}{Off} {11}{0}{-frac} -\__fontspec_define_feature_option:nnnnn{Fractions}{Diagonal} {11}{2}{} -\__fontspec_define_feature_option:nnnnn{Fractions}{Alternate}{} {} {+afrc} -\__fontspec_define_font_feature:n { Alternate } -\keys_define:nn {fontspec} + +\__fontspec_feat_prop_add:nn {salt} { Alternate\,=\,$N$ } +\__fontspec_feat_prop_add:nn {nalt} { Annotation\,=\,$N$ } +\__fontspec_feat_prop_add:nn {ornm} { Ornament\,=\,$N$ } +\__fontspec_feat_prop_add:nn {cvNN} { CharacterVariant\,=\,$N$:$M$ } +\__fontspec_feat_prop_add:nn {ssNN} { StylisticSet\,=\,$N$ } +\__fontspec_define_opentype_feature_group:n {Ligatures} +\__fontspec_define_opentype_feature:nnnnn {Ligatures} {ResetAll} {} {} + { + +dlig,-dlig,+rlig,-rlig,+liga,-liga,+dlig,-dlig,+clig,-clig,+hlig,-hlig, + mapping = tex-text + } +\__fontspec_define_opentype_onoffreset:nnnnn {Ligatures} {Required} {rlig} {rlig} {} +\__fontspec_define_opentype_onoffreset:nnnnn {Ligatures} {Common} {liga} {liga} {} +\__fontspec_define_opentype_onoffreset:nnnnn {Ligatures} {Rare} {dlig} {dlig} {} +\__fontspec_define_opentype_onoffreset:nnnnn {Ligatures} {Discretionary} {dlig} {dlig} {} +\__fontspec_define_opentype_onoffreset:nnnnn {Ligatures} {Contextual} {clig} {clig} {} +\__fontspec_define_opentype_onoffreset:nnnnn {Ligatures} {Historic} {hlig} {hlig} {} +\__fontspec_define_opentype_onreset:nnnnn {Ligatures} {TeX} {} { mapping = tex-text } {} +\__fontspec_define_opentype_feature_group:n {Letters} +\__fontspec_define_opentype_feature:nnnnn {Letters} {ResetAll} {} {} + { + +case,+smcp,+pcap,+c2sc,+c2pc,+unic,+rand, + -case,-smcp,-pcap,-c2sc,-c2pc,-unic,-rand + } +\__fontspec_define_opentype_onoffreset:nnnnn {Letters} {Uppercase} {case} {case} {+smcp,+pcap,+c2sc,+c2pc,+unic,+rand} +\__fontspec_define_opentype_onoffreset:nnnnn {Letters} {SmallCaps} {smcp} {smcp} {+pcap,+unic,+rand} +\__fontspec_define_opentype_onoffreset:nnnnn {Letters} {PetiteCaps} {pcap} {pcap} {+smcp,+unic,+rand} +\__fontspec_define_opentype_onoffreset:nnnnn {Letters} {UppercaseSmallCaps} {c2sc} {c2sc} {+c2pc,+unic,+rand} +\__fontspec_define_opentype_onoffreset:nnnnn {Letters} {UppercasePetiteCaps} {c2pc} {c2pc} {+c2sc,+unic,+rand} +\__fontspec_define_opentype_onoffreset:nnnnn {Letters} {Unicase} {unic} {unic} {+rand} +\__fontspec_define_opentype_onoffreset:nnnnn {Letters} {Random} {rand} {rand} {+unic} +\__fontspec_define_opentype_feature_group:n {Numbers} +\__fontspec_define_opentype_feature:nnnnn {Numbers} {ResetAll} {} {} + { + +tnum,-tnum, + +pnum,-pnum, + +onum,-onum, + +lnum,-lnum, + +zero,-zero, + +anum,-anum, + } +\__fontspec_define_opentype_onoffreset:nnnnn {Numbers} {Monospaced} {tnum} {tnum} {+pnum,-pnum} +\__fontspec_define_opentype_onoffreset:nnnnn {Numbers} {Proportional} {pnum} {pnum} {+tnum,-tnum} +\__fontspec_define_opentype_onoffreset:nnnnn {Numbers} {Lowercase} {onum} {onum} {+lnum,-lnum} +\__fontspec_define_opentype_onoffreset:nnnnn {Numbers} {Uppercase} {lnum} {lnum} {+onum,-onum} +\__fontspec_define_opentype_onoffreset:nnnnn {Numbers} {SlashedZero} {zero} {zero} {} +\aliasfontfeatureoption {Numbers} {Lowercase} {OldStyle} +\aliasfontfeatureoption {Numbers} {Uppercase} {Lining} +\__fontspec_define_opentype_feature_group:n {VerticalPosition} +\__fontspec_define_opentype_feature:nnnnn {VerticalPosition} {ResetAll} {} {} + { + +sups,-sups, + +subs,-subs, + +ordn,-ordn, + +numr,-numr, + +dnom,-dnom, + +sinf,-sinf, + } +\__fontspec_define_opentype_onoffreset:nnnnn {VerticalPosition} {Superior} {sups} {sups} {+subs,+ordn,+numr,+dnom,+sinf} +\__fontspec_define_opentype_onoffreset:nnnnn {VerticalPosition} {Inferior} {subs} {subs} {+sups,+ordn,+numr,+dnom,+sinf} +\__fontspec_define_opentype_onoffreset:nnnnn {VerticalPosition} {Ordinal} {ordn} {ordn} {+sups,+subs,+numr,+dnom,+sinf} +\__fontspec_define_opentype_onoffreset:nnnnn {VerticalPosition} {Numerator} {numr} {numr} {+sups,+subs,+ordn,+dnom,+sinf} +\__fontspec_define_opentype_onoffreset:nnnnn {VerticalPosition} {Denominator} {dnom} {dnom} {+sups,+subs,+ordn,+numr,+sinf} +\__fontspec_define_opentype_onoffreset:nnnnn {VerticalPosition} {ScientificInferior} {sinf} {sinf} {+sups,+subs,+ordn,+numr,+dnom} +\__fontspec_define_opentype_feature_group:n {Contextuals} +\__fontspec_define_opentype_feature:nnnnn {Contextuals} {ResetAll} {} {} + { + +cswh,-cswh, + +calt,-calt, + +init,-init, + +fina,-fina, + +falt,-falt, + +medi,-medi, + } +\__fontspec_define_opentype_onoffreset:nnnnn {Contextuals} {Swash} {cswh} {cswh} {} +\__fontspec_define_opentype_onoffreset:nnnnn {Contextuals} {Alternate} {calt} {calt} {} +\__fontspec_define_opentype_onoffreset:nnnnn {Contextuals} {WordInitial} {init} {init} {} +\__fontspec_define_opentype_onoffreset:nnnnn {Contextuals} {WordFinal} {fina} {fina} {} +\__fontspec_define_opentype_onoffreset:nnnnn {Contextuals} {LineFinal} {falt} {falt} {} +\__fontspec_define_opentype_onoffreset:nnnnn {Contextuals} {Inner} {medi} {medi} {} +\__fontspec_define_opentype_feature_group:n {Diacritics} +\__fontspec_define_opentype_feature:nnnnn {Diacritics} {ResetAll} {} {} + { + +mark,-mark, + +mkmk,-mkmk, + +abvm,-abvm, + +blwm,-blwm, + } +\__fontspec_define_opentype_onoffreset:nnnnn {Diacritics} {MarkToBase} {mark} {mark} {} +\__fontspec_define_opentype_onoffreset:nnnnn {Diacritics} {MarkToMark} {mkmk} {mkmk} {} +\__fontspec_define_opentype_onoffreset:nnnnn {Diacritics} {AboveBase} {abvm} {abvm} {} +\__fontspec_define_opentype_onoffreset:nnnnn {Diacritics} {BelowBase} {blwm} {blwm} {} +\__fontspec_define_opentype_feature_group:n {Kerning} +\__fontspec_define_opentype_feature:nnnnn {Kerning} {ResetAll} {} {} + { + +cpsp,-cpsp, + +kern,-kern, + } +\__fontspec_define_opentype_onoffreset:nnnnn {Kerning} {Uppercase} {cpsp} {cpsp} {} +\__fontspec_define_opentype_feature:nnnnn {Kerning} {On} {kern} {+kern} {-kern} +\__fontspec_define_opentype_feature:nnnnn {Kerning} {Off} {kern} {-kern} {+kern} +\__fontspec_define_opentype_feature:nnnnn {Kerning} {Reset} {} {} {+kern,-kern} +\__fontspec_define_opentype_feature_group:n {Fractions} +\__fontspec_define_opentype_feature:nnnnn {Fractions} {ResetAll} {} {} + { + +frac,-frac, + +afrc,-afrc, + } +\__fontspec_define_opentype_feature:nnnnn {Fractions} {On} {frac} {+frac} {} +\__fontspec_define_opentype_feature:nnnnn {Fractions} {Off} {frac} {-frac} {} +\__fontspec_define_opentype_feature:nnnnn {Fractions} {Reset} {} {} {+frac,-frac} +\__fontspec_define_opentype_onoffreset:nnnnn {Fractions} {Alternate} {afrc} {afrc} {-frac} + +\__fontspec_define_opentype_feature_group:n {Style} +\__fontspec_define_opentype_feature:nnnnn {Style} {ResetAll} {} {} + { + +salt,-salt, + +ital,-ital, + +ruby,-ruby, + +swsh,-swsh, + +hist,-hist, + +titl,-titl, + +hkna,-hkna, + +vkna,-vkna, + +ssty=0,-ssty=0, + +ssty=1,-ssty=1, + } +\__fontspec_define_opentype_onoffreset:nnnnn {Style} {Alternate} {salt} {salt} {} +\__fontspec_define_opentype_onoffreset:nnnnn {Style} {Italic} {ital} {ital} {} +\__fontspec_define_opentype_onoffreset:nnnnn {Style} {Ruby} {ruby} {ruby} {} +\__fontspec_define_opentype_onoffreset:nnnnn {Style} {Swash} {swsh} {swsh} {} +\__fontspec_define_opentype_onoffreset:nnnnn {Style} {Cursive} {swsh} {curs} {} +\__fontspec_define_opentype_onoffreset:nnnnn {Style} {Historic} {hist} {hist} {} +\__fontspec_define_opentype_onoffreset:nnnnn {Style} {TitlingCaps} {titl} {titl} {} +\__fontspec_define_opentype_onoffreset:nnnnn {Style} {HorizontalKana} {hkna} {hkna} {+vkna,+pkna} +\__fontspec_define_opentype_onoffreset:nnnnn {Style} {VerticalKana} {vkna} {vkna} {+hkna,+pkna} +\__fontspec_define_opentype_onoffreset:nnnnn {Style} {ProportionalKana} {pkna} {pkna} {+vkna,+hkna} +\__fontspec_define_opentype_feature:nnnnn {Style} {MathScript} {ssty} {+ssty=0} {+ssty=1} +\__fontspec_define_opentype_feature:nnnnn {Style} {MathScriptScript} {ssty} {+ssty=1} {+ssty=0} +\__fontspec_define_opentype_feature_group:n {CJKShape} +\__fontspec_define_opentype_feature:nnnnn {CJKShape} {ResetAll} {} {} + { + +trad,-trad, + +smpl,-smpl, + +jp78,-jp78, + +jp83,-jp83, + +jp90,-jp90, + +jp04,-jp04, + +expt,-expt, + +nlck,-nlck, + } +\__fontspec_define_opentype_onoffreset:nnnnn {CJKShape} {Traditional} {trad} {trad} {+smpl,+jp78,+jp83,+jp90,+jp04,+expt,+nlck} +\__fontspec_define_opentype_onoffreset:nnnnn {CJKShape} {Simplified} {smpl} {smpl} {+trad,+jp78,+jp83,+jp90,+jp04,+expt,+nlck} +\__fontspec_define_opentype_onoffreset:nnnnn {CJKShape} {JIS1978} {jp78} {jp78} {+trad,+smpl,+jp83,+jp90,+jp04,+expt,+nlck} +\__fontspec_define_opentype_onoffreset:nnnnn {CJKShape} {JIS1983} {jp83} {jp83} {+trad,+smpl,+jp78,+jp90,+jp04,+expt,+nlck} +\__fontspec_define_opentype_onoffreset:nnnnn {CJKShape} {JIS1990} {jp90} {jp90} {+trad,+smpl,+jp78,+jp83,+jp04,+expt,+nlck} +\__fontspec_define_opentype_onoffreset:nnnnn {CJKShape} {JIS2004} {jp04} {jp04} {+trad,+smpl,+jp78,+jp83,+jp90,+expt,+nlck} +\__fontspec_define_opentype_onoffreset:nnnnn {CJKShape} {Expert} {expt} {expt} {+trad,+smpl,+jp78,+jp83,+jp90,+jp04,+nlck} +\__fontspec_define_opentype_onoffreset:nnnnn {CJKShape} {NLC} {nlck} {nlck} {+trad,+smpl,+jp78,+jp83,+jp90,+jp04,+expt} +\__fontspec_define_opentype_feature_group:n {CharacterWidth} +\__fontspec_define_opentype_feature:nnnnn {CharacterWidth} {ResetAll} {} {} + { + +pwid,-pwid, + +fwid,-fwid, + +hwid,-hwid, + +twid,-twid, + +qwid,-qwid, + +palt,-palt, + +halt,-halt, + } +\__fontspec_define_opentype_onoffreset:nnnnn {CharacterWidth} {Proportional} {pwid} {pwid} {+fwid,+hwid,+twid,+qwid,+palt,+halt} +\__fontspec_define_opentype_onoffreset:nnnnn {CharacterWidth} {Full} {fwid} {fwid} {+pwid,+hwid,+twid,+qwid,+palt,+halt} +\__fontspec_define_opentype_onoffreset:nnnnn {CharacterWidth} {Half} {hwid} {hwid} {+pwid,+fwid,+twid,+qwid,+palt,+halt} +\__fontspec_define_opentype_onoffreset:nnnnn {CharacterWidth} {Third} {twid} {twid} {+pwid,+fwid,+hwid,+qwid,+palt,+halt} +\__fontspec_define_opentype_onoffreset:nnnnn {CharacterWidth} {Quarter} {qwid} {qwid} {+pwid,+fwid,+hwid,+twid,+palt,+halt} +\__fontspec_define_opentype_onoffreset:nnnnn {CharacterWidth} {AlternateProportional} {palt} {palt} {+pwid,+fwid,+hwid,+twid,+qwid,+halt} +\__fontspec_define_opentype_onoffreset:nnnnn {CharacterWidth} {AlternateHalf} {halt} {halt} {+pwid,+fwid,+hwid,+twid,+qwid,+palt} +\__fontspec_define_opentype_feature_group:n {Vertical} +\__fontspec_define_opentype_onoffreset:nnnnn {Vertical} {RotatedGlyphs} {vrt2} {vrt2} {+vrtr,+vert} +\__fontspec_define_opentype_onoffreset:nnnnn {Vertical} {AlternatesForRotation} {vrtr} {vrtr} {+vrt2} +\__fontspec_define_opentype_onoffreset:nnnnn {Vertical} {Alternates} {vert} {vert} {+vrt2} +\__fontspec_define_opentype_onoffreset:nnnnn {Vertical} {KanaAlternates} {vkna} {vkna} {+hkna} +\__fontspec_define_opentype_onoffreset:nnnnn {Vertical} {Kerning} {vkrn} {vkrn} {} +\__fontspec_define_opentype_onoffreset:nnnnn {Vertical} {AlternateMetrics} {valt} {valt} {+vhal,+vpal,+kern} +\__fontspec_define_opentype_onoffreset:nnnnn {Vertical} {HalfMetrics} {vhal} {vhal} {+valt,+vpal,+kern} +\__fontspec_define_opentype_onoffreset:nnnnn {Vertical} {ProportionalMetrics} {vpal} {vpal} {+valt,+vhal} +\__fontspec_define_opentype_feature_group:n {Alternate} +\keys_define:nn {fontspec-opentype} { Alternate .default:n = {0} , Alternate / unknown .code:n = { \clist_map_inline:nn {#1} - { \fontspec_make_feature:nnx {17}{##1} { \fontspec_salt:n {##1} } } + { \__fontspec_make_OT_feature:nnn {salt}{ +salt = ##1 }{} } } } -\cs_set:Nn \fontspec_salt:n { +salt = #1 } -\__fontspec_define_font_feature:n {Variant} -\keys_define:nn {fontspec} +\aliasfontfeature{Alternate}{StylisticAlternates} +\__fontspec_define_opentype_feature_group:n {Variant} +\keys_define:nn {fontspec-opentype} { Variant .default:n = {0} , Variant / unknown .code:n = { \clist_map_inline:nn {#1} - { \fontspec_make_feature:nnx {18}{##1} { +ss \two@digits {##1} } } + { + \__fontspec_make_OT_feature:xxx { ss \two@digits {##1} } { +ss \two@digits {##1} } {} + } } } \aliasfontfeature{Variant}{StylisticSet} -\__fontspec_define_font_feature:n { CharacterVariant } +\__fontspec_define_opentype_feature_group:n {CharacterVariant} \use:x { \cs_new:Npn \exp_not:N \fontspec_parse_cv:w ##1 \c_colon_str ##2 \c_colon_str ##3 \exp_not:N \q_nil { - \fontspec_make_numbered_feature:xn - { +cv \exp_not:N \two@digits {##1} } {##2} + \__fontspec_make_OT_feature:xxx + { cv \exp_not:N \two@digits {##1} } { +cv \exp_not:N \two@digits {##1} = ##2 } {} } - \keys_define:nn {fontspec} + \keys_define:nn {fontspec-opentype} { CharacterVariant / unknown .code:n = { @@ -2141,90 +2555,53 @@ } } } -\__fontspec_define_font_feature:n{Style} -\__fontspec_define_feature_option:nnnnn{Style}{Alternate} {} {} {+salt} -\__fontspec_define_feature_option:nnnnn{Style}{Italic} {32}{2}{+ital} -\__fontspec_define_feature_option:nnnnn{Style}{Ruby} {28}{2}{+ruby} -\__fontspec_define_feature_option:nnnnn{Style}{Swash} {} {} {+swsh} -\__fontspec_define_feature_option:nnnnn{Style}{Historic} {} {} {+hist} -\__fontspec_define_feature_option:nnnnn{Style}{Display} {19}{1}{} -\__fontspec_define_feature_option:nnnnn{Style}{Engraved} {19}{2}{} -\__fontspec_define_feature_option:nnnnn{Style}{TitlingCaps} {19}{4}{+titl} -\__fontspec_define_feature_option:nnnnn{Style}{TallCaps} {19}{5}{} -\__fontspec_define_feature_option:nnnnn{Style}{HorizontalKana}{} {} {+hkna} -\__fontspec_define_feature_option:nnnnn{Style}{VerticalKana} {} {} {+vkna} -\fontspec_define_numbered_feat:nnnn {Style} {MathScript} {+ssty} {0} -\fontspec_define_numbered_feat:nnnn {Style} {MathScriptScript} {+ssty} {1} -\__fontspec_define_font_feature:n{CJKShape} -\__fontspec_define_feature_option:nnnnn{CJKShape}{Traditional}{20}{0} {+trad} -\__fontspec_define_feature_option:nnnnn{CJKShape}{Simplified} {20}{1} {+smpl} -\__fontspec_define_feature_option:nnnnn{CJKShape}{JIS1978} {20}{2} {+jp78} -\__fontspec_define_feature_option:nnnnn{CJKShape}{JIS1983} {20}{3} {+jp83} -\__fontspec_define_feature_option:nnnnn{CJKShape}{JIS1990} {20}{4} {+jp90} -\__fontspec_define_feature_option:nnnnn{CJKShape}{Expert} {20}{10}{+expt} -\__fontspec_define_feature_option:nnnnn{CJKShape}{NLC} {20}{13}{+nlck} -\__fontspec_define_font_feature:n{CharacterWidth} -\__fontspec_define_feature_option:nnnnn{CharacterWidth}{Proportional}{22}{0}{+pwid} -\__fontspec_define_feature_option:nnnnn{CharacterWidth}{Full}{22}{1}{+fwid} -\__fontspec_define_feature_option:nnnnn{CharacterWidth}{Half}{22}{2}{+hwid} -\__fontspec_define_feature_option:nnnnn{CharacterWidth}{Third}{22}{3}{+twid} -\__fontspec_define_feature_option:nnnnn{CharacterWidth}{Quarter}{22}{4}{+qwid} -\__fontspec_define_feature_option:nnnnn{CharacterWidth}{AlternateProportional}{22}{5}{+palt} -\__fontspec_define_feature_option:nnnnn{CharacterWidth}{AlternateHalf}{22}{6}{+halt} -\__fontspec_define_feature_option:nnnnn{CharacterWidth}{Default}{22}{7}{} -\__fontspec_define_feature_option:nnnnn{Annotation}{Off}{24}{0}{} -\__fontspec_define_feature_option:nnnnn{Annotation}{Box}{24}{1}{} -\__fontspec_define_feature_option:nnnnn{Annotation}{RoundedBox}{24}{2}{} -\__fontspec_define_feature_option:nnnnn{Annotation}{Circle}{24}{3}{} -\__fontspec_define_feature_option:nnnnn{Annotation}{BlackCircle}{24}{4}{} -\__fontspec_define_feature_option:nnnnn{Annotation}{Parenthesis}{24}{5}{} -\__fontspec_define_feature_option:nnnnn{Annotation}{Period}{24}{6}{} -\__fontspec_define_feature_option:nnnnn{Annotation}{RomanNumerals}{24}{7}{} -\__fontspec_define_feature_option:nnnnn{Annotation}{Diamond}{24}{8}{} -\__fontspec_define_feature_option:nnnnn{Annotation}{BlackSquare}{24}{9}{} -\__fontspec_define_feature_option:nnnnn{Annotation}{BlackRoundSquare}{24}{10}{} -\__fontspec_define_feature_option:nnnnn{Annotation}{DoubleCircle}{24}{11}{} -\__fontspec_define_font_feature:n { Annotation } -\keys_define:nn {fontspec} +\__fontspec_define_opentype_feature_group:n {Annotation} +\keys_define:nn {fontspec-opentype} { Annotation .default:n = {0} , Annotation / unknown .code:n = { - \fontspec_make_feature:nnx {}{}{ +nalt=#1 } + \__fontspec_make_OT_feature:nnn {nalt} {+nalt=#1} {} } } -\keys_define:nn {fontspec} +\__fontspec_define_opentype_feature_group:n {Ornament} +\keys_define:nn {fontspec-opentype} { - Vertical .choice: , - Vertical / RotatedGlyphs .code:n = + Ornament .default:n = {0} , + Ornament / unknown .code:n = { - \bool_if:NTF \l__fontspec_ot_bool - { - \fontspec_make_feature:nnn{}{}{+vrt2} - \__fontspec_update_featstr:n {vertical} - } - { - \__fontspec_update_featstr:n {vertical} - } + \__fontspec_make_OT_feature:nnn {ornm} { +ornm=#1 } {} } } -\keys_define:nn { fontspec } { Script .choice: } +\keys_define:nn { fontspec-opentype } { Script .choice: } \cs_new:Nn \fontspec_new_script:nn { - \keys_define:nn { fontspec } { Script / #1 .code:n = + \keys_define:nn { fontspec-opentype } { Script / #1 .code:n = + \bool_set_false:N \l__fontspec_script_exist_bool \clist_map_inline:nn {#2} { - \fontspec_check_script:nTF {####1} + \__fontspec_check_script:nTF {####1} { \tl_set:Nn \l_fontspec_script_tl {####1} - \int_set:Nn \l_fontspec_script_int {\l_fontspec_strnum_int} + \int_set:Nn \l__fontspec_script_int {\l__fontspec_strnum_int} + \bool_set_true:N \l__fontspec_script_exist_bool + \tl_gset:Nx \g__fontspec_single_feat_tl { script=####1 } \clist_map_break: } + { } + } + \bool_if:NF \l__fontspec_script_exist_bool + { + \str_if_eq:nnTF {#1} {Latin} { - \fontspec_check_script:nTF {latn} + \__fontspec_warning:nx {script-not-exist} {#1} + } + { + \__fontspec_check_script:nTF {latn} { \__fontspec_warning:nx {script-not-exist-latn} {#1} - \keys_set:nn {fontspec} {Script=Latin} + \tl_set:Nn \l_fontspec_script_tl {latn} + \int_set:Nn \l__fontspec_script_int {\l__fontspec_strnum_int} } { \__fontspec_warning:nx {script-not-exist} {#1} @@ -2233,296 +2610,745 @@ } } } -\newfontscript{Arabic}{arab} \newfontscript{Armenian}{armn} +\keys_define:nn { fontspec-opentype } { Language .choice: } +\cs_new:Nn \fontspec_new_lang:nn + { + \keys_define:nn { fontspec-opentype } { 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} + \tl_gset:Nx \g__fontspec_single_feat_tl { language=#2 } + } + { + \__fontspec_warning:nx {language-not-exist} {#1} + \keys_set:nn { fontspec-opentype } { Language = Default } + } + } + } +\__fontspec_keys_define_code:nnn {fontspec-opentype}{ Language / Default } + { + \tl_set:Nn \l_fontspec_lang_tl {DFLT} + \int_zero:N \l__fontspec_language_int + \tl_gset:Nn \g__fontspec_single_feat_tl { language=DFLT } + } +\keys_define:nn {fontspec-opentype} + { + Language / Turkish .code:n = + { + \__fontspec_check_lang:nTF {TRK} + { + \int_set:Nn \l__fontspec_language_int {\l__fontspec_strnum_int} + \tl_set:Nn \l_fontspec_lang_tl {TRK} + \tl_gset:Nn \g__fontspec_single_feat_tl { language=TRK } + } + { + \__fontspec_check_lang:nTF {TUR} + { + \int_set:Nn \l__fontspec_language_int {\l__fontspec_strnum_int} + \tl_set:Nn \l_fontspec_lang_tl {TUR} + \tl_gset:Nn \g__fontspec_single_feat_tl { language=TUR } + } + { + \__fontspec_warning:nx {language-not-exist} {Turkish} + \keys_set:nn {fontspec-opentype} {Language=Default} + } + } + } + } +\cs_new:Nn \__fontspec_ot_compat:nn + { + \aliasfontfeatureoption {#1} {#2Off} {No#2} + } +\__fontspec_ot_compat:nn {Ligatures} {Rare} +\__fontspec_ot_compat:nn {Ligatures} {Required} +\__fontspec_ot_compat:nn {Ligatures} {Common} +\__fontspec_ot_compat:nn {Ligatures} {Discretionary} +\__fontspec_ot_compat:nn {Ligatures} {Contextual} +\__fontspec_ot_compat:nn {Ligatures} {Historic} +\__fontspec_ot_compat:nn {Numbers} {SlashedZero} +\__fontspec_ot_compat:nn {Contextuals} {Swash} +\__fontspec_ot_compat:nn {Contextuals} {Alternate} +\__fontspec_ot_compat:nn {Contextuals} {WordInitial} +\__fontspec_ot_compat:nn {Contextuals} {WordFinal} +\__fontspec_ot_compat:nn {Contextuals} {LineFinal} +\__fontspec_ot_compat:nn {Contextuals} {Inner} +\__fontspec_ot_compat:nn {Diacritics} {MarkToBase} +\__fontspec_ot_compat:nn {Diacritics} {MarkToMark} +\__fontspec_ot_compat:nn {Diacritics} {AboveBase} +\__fontspec_ot_compat:nn {Diacritics} {BelowBase} + +\newfontscript{Arabic}{arab} +\newfontscript{Armenian}{armn} \newfontscript{Balinese}{bali} \newfontscript{Bengali}{bng2,beng} -\newfontscript{Bopomofo}{bopo} \newfontscript{Braille}{brai} -\newfontscript{Buginese}{bugi} \newfontscript{Buhid}{buhd} +\newfontscript{Bopomofo}{bopo} +\newfontscript{Braille}{brai} +\newfontscript{Buginese}{bugi} +\newfontscript{Buhid}{buhd} \newfontscript{Byzantine~Music}{byzm} \newfontscript{Canadian~Syllabics}{cans} \newfontscript{Cherokee}{cher} -\newfontscript{CJK~Ideographic}{hani} \newfontscript{Coptic}{copt} -\newfontscript{Cypriot~Syllabary}{cprt} \newfontscript{Cyrillic}{cyrl} -\newfontscript{Default}{DFLT} \newfontscript{Deseret}{dsrt} +\newfontscript{CJK~Ideographic}{hani} +\newfontscript{Coptic}{copt} +\newfontscript{Cypriot~Syllabary}{cprt} +\newfontscript{Cyrillic}{cyrl} +\newfontscript{Default}{DFLT} +\newfontscript{Deseret}{dsrt} \newfontscript{Devanagari}{dev2,deva} \newfontscript{Ethiopic}{ethi} -\newfontscript{Georgian}{geor} \newfontscript{Glagolitic}{glag} -\newfontscript{Gothic}{goth} \newfontscript{Greek}{grek} +\newfontscript{Georgian}{geor} +\newfontscript{Glagolitic}{glag} +\newfontscript{Gothic}{goth} +\newfontscript{Greek}{grek} \newfontscript{Gujarati}{gjr2,gujr} \newfontscript{Gurmukhi}{gur2,guru} -\newfontscript{Hangul~Jamo}{jamo} \newfontscript{Hangul}{hang} -\newfontscript{Hanunoo}{hano} \newfontscript{Hebrew}{hebr} +\newfontscript{Hangul~Jamo}{jamo} +\newfontscript{Hangul}{hang} +\newfontscript{Hanunoo}{hano} +\newfontscript{Hebrew}{hebr} \newfontscript{Hiragana~and~Katakana}{kana} \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{Kharosthi}{khar} +\newfontscript{Khmer}{khmr} +\newfontscript{Lao}{lao~} +\newfontscript{Latin}{latn} +\newfontscript{Limbu}{limb} +\newfontscript{Linear~B}{linb} \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{Musical~Symbols}{musc} +\newfontscript{Myanmar}{mymr} +\newfontscript{N'ko}{nko~} +\newfontscript{Ogham}{ogam} \newfontscript{Old~Italic}{ital} \newfontscript{Old~Persian~Cuneiform}{xpeo} \newfontscript{Oriya}{ory2,orya} \newfontscript{Osmanya}{osma} -\newfontscript{Phags-pa}{phag} \newfontscript{Phoenician}{phnx} -\newfontscript{Runic}{runr} \newfontscript{Shavian}{shaw} +\newfontscript{Phags-pa}{phag} +\newfontscript{Phoenician}{phnx} +\newfontscript{Runic}{runr} +\newfontscript{Shavian}{shaw} \newfontscript{Sinhala}{sinh} \newfontscript{Sumero-Akkadian~Cuneiform}{xsux} -\newfontscript{Syloti~Nagri}{sylo} \newfontscript{Syriac}{syrc} -\newfontscript{Tagalog}{tglg} \newfontscript{Tagbanwa}{tagb} -\newfontscript{Tai~Le}{tale} \newfontscript{Tai~Lu}{talu} +\newfontscript{Syloti~Nagri}{sylo} +\newfontscript{Syriac}{syrc} +\newfontscript{Tagalog}{tglg} +\newfontscript{Tagbanwa}{tagb} +\newfontscript{Tai~Le}{tale} +\newfontscript{Tai~Lu}{talu} \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{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} -\newfontlanguage{Altai}{ALT}\newfontlanguage{Amharic}{AMH} -\newfontlanguage{Arabic}{ARA}\newfontlanguage{Aari}{ARI} -\newfontlanguage{Arakanese}{ARK}\newfontlanguage{Assamese}{ASM} -\newfontlanguage{Athapaskan}{ATH}\newfontlanguage{Avar}{AVR} -\newfontlanguage{Awadhi}{AWA}\newfontlanguage{Aymara}{AYM} -\newfontlanguage{Azeri}{AZE}\newfontlanguage{Badaga}{BAD} -\newfontlanguage{Baghelkhandi}{BAG}\newfontlanguage{Balkar}{BAL} -\newfontlanguage{Baule}{BAU}\newfontlanguage{Berber}{BBR} -\newfontlanguage{Bench}{BCH}\newfontlanguage{Bible~Cree}{BCR} -\newfontlanguage{Belarussian}{BEL}\newfontlanguage{Bemba}{BEM} -\newfontlanguage{Bengali}{BEN}\newfontlanguage{Bulgarian}{BGR} -\newfontlanguage{Bhili}{BHI}\newfontlanguage{Bhojpuri}{BHO} -\newfontlanguage{Bikol}{BIK}\newfontlanguage{Bilen}{BIL} -\newfontlanguage{Blackfoot}{BKF}\newfontlanguage{Balochi}{BLI} -\newfontlanguage{Balante}{BLN}\newfontlanguage{Balti}{BLT} -\newfontlanguage{Bambara}{BMB}\newfontlanguage{Bamileke}{BML} -\newfontlanguage{Breton}{BRE}\newfontlanguage{Brahui}{BRH} -\newfontlanguage{Braj~Bhasha}{BRI}\newfontlanguage{Burmese}{BRM} -\newfontlanguage{Bashkir}{BSH}\newfontlanguage{Beti}{BTI} -\newfontlanguage{Catalan}{CAT}\newfontlanguage{Cebuano}{CEB} -\newfontlanguage{Chechen}{CHE}\newfontlanguage{Chaha~Gurage}{CHG} -\newfontlanguage{Chattisgarhi}{CHH}\newfontlanguage{Chichewa}{CHI} -\newfontlanguage{Chukchi}{CHK}\newfontlanguage{Chipewyan}{CHP} -\newfontlanguage{Cherokee}{CHR}\newfontlanguage{Chuvash}{CHU} -\newfontlanguage{Comorian}{CMR}\newfontlanguage{Coptic}{COP} -\newfontlanguage{Cree}{CRE}\newfontlanguage{Carrier}{CRR} -\newfontlanguage{Crimean~Tatar}{CRT}\newfontlanguage{Church~Slavonic}{CSL} -\newfontlanguage{Czech}{CSY}\newfontlanguage{Danish}{DAN} -\newfontlanguage{Dargwa}{DAR}\newfontlanguage{Woods~Cree}{DCR} + +\newfontlanguage{Abaza}{ABA} +\newfontlanguage{Abkhazian}{ABK} +\newfontlanguage{Adyghe}{ADY} +\newfontlanguage{Afrikaans}{AFK} +\newfontlanguage{Afar}{AFR} +\newfontlanguage{Agaw}{AGW} +\newfontlanguage{Altai}{ALT} +\newfontlanguage{Amharic}{AMH} +\newfontlanguage{Arabic}{ARA} +\newfontlanguage{Aari}{ARI} +\newfontlanguage{Arakanese}{ARK} +\newfontlanguage{Assamese}{ASM} +\newfontlanguage{Athapaskan}{ATH} +\newfontlanguage{Avar}{AVR} +\newfontlanguage{Awadhi}{AWA} +\newfontlanguage{Aymara}{AYM} +\newfontlanguage{Azeri}{AZE} +\newfontlanguage{Badaga}{BAD} +\newfontlanguage{Baghelkhandi}{BAG} +\newfontlanguage{Balkar}{BAL} +\newfontlanguage{Baule}{BAU} +\newfontlanguage{Berber}{BBR} +\newfontlanguage{Bench}{BCH} +\newfontlanguage{Bible~Cree}{BCR} +\newfontlanguage{Belarussian}{BEL} +\newfontlanguage{Bemba}{BEM} +\newfontlanguage{Bengali}{BEN} +\newfontlanguage{Bulgarian}{BGR} +\newfontlanguage{Bhili}{BHI} +\newfontlanguage{Bhojpuri}{BHO} +\newfontlanguage{Bikol}{BIK} +\newfontlanguage{Bilen}{BIL} +\newfontlanguage{Blackfoot}{BKF} +\newfontlanguage{Balochi}{BLI} +\newfontlanguage{Balante}{BLN} +\newfontlanguage{Balti}{BLT} +\newfontlanguage{Bambara}{BMB} +\newfontlanguage{Bamileke}{BML} +\newfontlanguage{Breton}{BRE} +\newfontlanguage{Brahui}{BRH} +\newfontlanguage{Braj~Bhasha}{BRI} +\newfontlanguage{Burmese}{BRM} +\newfontlanguage{Bashkir}{BSH} +\newfontlanguage{Beti}{BTI} +\newfontlanguage{Catalan}{CAT} +\newfontlanguage{Cebuano}{CEB} +\newfontlanguage{Chechen}{CHE} +\newfontlanguage{Chaha~Gurage}{CHG} +\newfontlanguage{Chattisgarhi}{CHH} +\newfontlanguage{Chichewa}{CHI} +\newfontlanguage{Chukchi}{CHK} +\newfontlanguage{Chipewyan}{CHP} +\newfontlanguage{Cherokee}{CHR} +\newfontlanguage{Chuvash}{CHU} +\newfontlanguage{Comorian}{CMR} +\newfontlanguage{Coptic}{COP} +\newfontlanguage{Cree}{CRE} +\newfontlanguage{Carrier}{CRR} +\newfontlanguage{Crimean~Tatar}{CRT} +\newfontlanguage{Church~Slavonic}{CSL} +\newfontlanguage{Czech}{CSY} +\newfontlanguage{Danish}{DAN} +\newfontlanguage{Dargwa}{DAR} +\newfontlanguage{Woods~Cree}{DCR} \newfontlanguage{German}{DEU} -\newfontlanguage{Dogri}{DGR}\newfontlanguage{Divehi}{DIV} -\newfontlanguage{Djerma}{DJR}\newfontlanguage{Dangme}{DNG} -\newfontlanguage{Dinka}{DNK}\newfontlanguage{Dungan}{DUN} -\newfontlanguage{Dzongkha}{DZN}\newfontlanguage{Ebira}{EBI} -\newfontlanguage{Eastern~Cree}{ECR}\newfontlanguage{Edo}{EDO} -\newfontlanguage{Efik}{EFI}\newfontlanguage{Greek}{ELL} -\newfontlanguage{English}{ENG}\newfontlanguage{Erzya}{ERZ} -\newfontlanguage{Spanish}{ESP}\newfontlanguage{Estonian}{ETI} -\newfontlanguage{Basque}{EUQ}\newfontlanguage{Evenki}{EVK} -\newfontlanguage{Even}{EVN}\newfontlanguage{Ewe}{EWE} +\newfontlanguage{Dogri}{DGR} +\newfontlanguage{Divehi}{DIV} +\newfontlanguage{Djerma}{DJR} +\newfontlanguage{Dangme}{DNG} +\newfontlanguage{Dinka}{DNK} +\newfontlanguage{Dungan}{DUN} +\newfontlanguage{Dzongkha}{DZN} +\newfontlanguage{Ebira}{EBI} +\newfontlanguage{Eastern~Cree}{ECR} +\newfontlanguage{Edo}{EDO} +\newfontlanguage{Efik}{EFI} +\newfontlanguage{Greek}{ELL} +\newfontlanguage{English}{ENG} +\newfontlanguage{Erzya}{ERZ} +\newfontlanguage{Spanish}{ESP} +\newfontlanguage{Estonian}{ETI} +\newfontlanguage{Basque}{EUQ} +\newfontlanguage{Evenki}{EVK} +\newfontlanguage{Even}{EVN} +\newfontlanguage{Ewe}{EWE} \newfontlanguage{French~Antillean}{FAN} \newfontlanguage{Farsi}{FAR} \newfontlanguage{Parsi}{FAR} \newfontlanguage{Persian}{FAR} -\newfontlanguage{Finnish}{FIN}\newfontlanguage{Fijian}{FJI} -\newfontlanguage{Flemish}{FLE}\newfontlanguage{Forest~Nenets}{FNE} -\newfontlanguage{Fon}{FON}\newfontlanguage{Faroese}{FOS} -\newfontlanguage{French}{FRA}\newfontlanguage{Frisian}{FRI} -\newfontlanguage{Friulian}{FRL}\newfontlanguage{Futa}{FTA} -\newfontlanguage{Fulani}{FUL}\newfontlanguage{Ga}{GAD} -\newfontlanguage{Gaelic}{GAE}\newfontlanguage{Gagauz}{GAG} -\newfontlanguage{Galician}{GAL}\newfontlanguage{Garshuni}{GAR} -\newfontlanguage{Garhwali}{GAW}\newfontlanguage{Ge'ez}{GEZ} -\newfontlanguage{Gilyak}{GIL}\newfontlanguage{Gumuz}{GMZ} -\newfontlanguage{Gondi}{GON}\newfontlanguage{Greenlandic}{GRN} -\newfontlanguage{Garo}{GRO}\newfontlanguage{Guarani}{GUA} -\newfontlanguage{Gujarati}{GUJ}\newfontlanguage{Haitian}{HAI} -\newfontlanguage{Halam}{HAL}\newfontlanguage{Harauti}{HAR} -\newfontlanguage{Hausa}{HAU}\newfontlanguage{Hawaiin}{HAW} -\newfontlanguage{Hammer-Banna}{HBN}\newfontlanguage{Hiligaynon}{HIL} -\newfontlanguage{Hindi}{HIN}\newfontlanguage{High~Mari}{HMA} -\newfontlanguage{Hindko}{HND}\newfontlanguage{Ho}{HO} -\newfontlanguage{Harari}{HRI}\newfontlanguage{Croatian}{HRV} -\newfontlanguage{Hungarian}{HUN}\newfontlanguage{Armenian}{HYE} -\newfontlanguage{Igbo}{IBO}\newfontlanguage{Ijo}{IJO} -\newfontlanguage{Ilokano}{ILO}\newfontlanguage{Indonesian}{IND} -\newfontlanguage{Ingush}{ING}\newfontlanguage{Inuktitut}{INU} -\newfontlanguage{Irish}{IRI}\newfontlanguage{Irish~Traditional}{IRT} -\newfontlanguage{Icelandic}{ISL}\newfontlanguage{Inari~Sami}{ISM} -\newfontlanguage{Italian}{ITA}\newfontlanguage{Hebrew}{IWR} -\newfontlanguage{Javanese}{JAV}\newfontlanguage{Yiddish}{JII} -\newfontlanguage{Japanese}{JAN}\newfontlanguage{Judezmo}{JUD} -\newfontlanguage{Jula}{JUL}\newfontlanguage{Kabardian}{KAB} -\newfontlanguage{Kachchi}{KAC}\newfontlanguage{Kalenjin}{KAL} -\newfontlanguage{Kannada}{KAN}\newfontlanguage{Karachay}{KAR} -\newfontlanguage{Georgian}{KAT}\newfontlanguage{Kazakh}{KAZ} -\newfontlanguage{Kebena}{KEB}\newfontlanguage{Khutsuri~Georgian}{KGE} -\newfontlanguage{Khakass}{KHA}\newfontlanguage{Khanty-Kazim}{KHK} -\newfontlanguage{Khmer}{KHM}\newfontlanguage{Khanty-Shurishkar}{KHS} -\newfontlanguage{Khanty-Vakhi}{KHV}\newfontlanguage{Khowar}{KHW} -\newfontlanguage{Kikuyu}{KIK}\newfontlanguage{Kirghiz}{KIR} -\newfontlanguage{Kisii}{KIS}\newfontlanguage{Kokni}{KKN} -\newfontlanguage{Kalmyk}{KLM}\newfontlanguage{Kamba}{KMB} -\newfontlanguage{Kumaoni}{KMN}\newfontlanguage{Komo}{KMO} -\newfontlanguage{Komso}{KMS}\newfontlanguage{Kanuri}{KNR} -\newfontlanguage{Kodagu}{KOD}\newfontlanguage{Korean~Old~Hangul}{KOH} -\newfontlanguage{Konkani}{KOK}\newfontlanguage{Kikongo}{KON} -\newfontlanguage{Komi-Permyak}{KOP}\newfontlanguage{Korean}{KOR} -\newfontlanguage{Komi-Zyrian}{KOZ}\newfontlanguage{Kpelle}{KPL} -\newfontlanguage{Krio}{KRI}\newfontlanguage{Karakalpak}{KRK} -\newfontlanguage{Karelian}{KRL}\newfontlanguage{Karaim}{KRM} -\newfontlanguage{Karen}{KRN}\newfontlanguage{Koorete}{KRT} -\newfontlanguage{Kashmiri}{KSH}\newfontlanguage{Khasi}{KSI} -\newfontlanguage{Kildin~Sami}{KSM}\newfontlanguage{Kui}{KUI} -\newfontlanguage{Kulvi}{KUL}\newfontlanguage{Kumyk}{KUM} -\newfontlanguage{Kurdish}{KUR}\newfontlanguage{Kurukh}{KUU} -\newfontlanguage{Kuy}{KUY}\newfontlanguage{Koryak}{KYK} -\newfontlanguage{Ladin}{LAD}\newfontlanguage{Lahuli}{LAH} -\newfontlanguage{Lak}{LAK}\newfontlanguage{Lambani}{LAM} -\newfontlanguage{Lao}{LAO}\newfontlanguage{Latin}{LAT} -\newfontlanguage{Laz}{LAZ}\newfontlanguage{L-Cree}{LCR} -\newfontlanguage{Ladakhi}{LDK}\newfontlanguage{Lezgi}{LEZ} -\newfontlanguage{Lingala}{LIN}\newfontlanguage{Low~Mari}{LMA} -\newfontlanguage{Limbu}{LMB}\newfontlanguage{Lomwe}{LMW} -\newfontlanguage{Lower~Sorbian}{LSB}\newfontlanguage{Lule~Sami}{LSM} -\newfontlanguage{Lithuanian}{LTH}\newfontlanguage{Luba}{LUB} -\newfontlanguage{Luganda}{LUG}\newfontlanguage{Luhya}{LUH} -\newfontlanguage{Luo}{LUO}\newfontlanguage{Latvian}{LVI} -\newfontlanguage{Majang}{MAJ}\newfontlanguage{Makua}{MAK} -\newfontlanguage{Malayalam~Traditional}{MAL}\newfontlanguage{Mansi}{MAN} -\newfontlanguage{Marathi}{MAR}\newfontlanguage{Marwari}{MAW} -\newfontlanguage{Mbundu}{MBN}\newfontlanguage{Manchu}{MCH} -\newfontlanguage{Moose~Cree}{MCR}\newfontlanguage{Mende}{MDE} -\newfontlanguage{Me'en}{MEN}\newfontlanguage{Mizo}{MIZ} -\newfontlanguage{Macedonian}{MKD}\newfontlanguage{Male}{MLE} -\newfontlanguage{Malagasy}{MLG}\newfontlanguage{Malinke}{MLN} -\newfontlanguage{Malayalam~Reformed}{MLR}\newfontlanguage{Malay}{MLY} -\newfontlanguage{Mandinka}{MND}\newfontlanguage{Mongolian}{MNG} -\newfontlanguage{Manipuri}{MNI}\newfontlanguage{Maninka}{MNK} -\newfontlanguage{Manx~Gaelic}{MNX}\newfontlanguage{Moksha}{MOK} -\newfontlanguage{Moldavian}{MOL}\newfontlanguage{Mon}{MON} -\newfontlanguage{Moroccan}{MOR}\newfontlanguage{Maori}{MRI} -\newfontlanguage{Maithili}{MTH}\newfontlanguage{Maltese}{MTS} -\newfontlanguage{Mundari}{MUN}\newfontlanguage{Naga-Assamese}{NAG} -\newfontlanguage{Nanai}{NAN}\newfontlanguage{Naskapi}{NAS} -\newfontlanguage{N-Cree}{NCR}\newfontlanguage{Ndebele}{NDB} -\newfontlanguage{Ndonga}{NDG}\newfontlanguage{Nepali}{NEP} -\newfontlanguage{Newari}{NEW}\newfontlanguage{Nagari}{NGR} -\newfontlanguage{Norway~House~Cree}{NHC}\newfontlanguage{Nisi}{NIS} -\newfontlanguage{Niuean}{NIU}\newfontlanguage{Nkole}{NKL} -\newfontlanguage{N'ko}{NKO}\newfontlanguage{Dutch}{NLD} -\newfontlanguage{Nogai}{NOG}\newfontlanguage{Norwegian}{NOR} -\newfontlanguage{Northern~Sami}{NSM}\newfontlanguage{Northern~Tai}{NTA} -\newfontlanguage{Esperanto}{NTO}\newfontlanguage{Nynorsk}{NYN} -\newfontlanguage{Oji-Cree}{OCR}\newfontlanguage{Ojibway}{OJB} -\newfontlanguage{Oriya}{ORI}\newfontlanguage{Oromo}{ORO} -\newfontlanguage{Ossetian}{OSS}\newfontlanguage{Palestinian~Aramaic}{PAA} -\newfontlanguage{Pali}{PAL}\newfontlanguage{Punjabi}{PAN} -\newfontlanguage{Palpa}{PAP}\newfontlanguage{Pashto}{PAS} -\newfontlanguage{Polytonic~Greek}{PGR}\newfontlanguage{Pilipino}{PIL} -\newfontlanguage{Palaung}{PLG}\newfontlanguage{Polish}{PLK} -\newfontlanguage{Provencal}{PRO}\newfontlanguage{Portuguese}{PTG} -\newfontlanguage{Chin}{QIN}\newfontlanguage{Rajasthani}{RAJ} -\newfontlanguage{R-Cree}{RCR}\newfontlanguage{Russian~Buriat}{RBU} -\newfontlanguage{Riang}{RIA}\newfontlanguage{Rhaeto-Romanic}{RMS} -\newfontlanguage{Romanian}{ROM}\newfontlanguage{Romany}{ROY} -\newfontlanguage{Rusyn}{RSY}\newfontlanguage{Ruanda}{RUA} -\newfontlanguage{Russian}{RUS}\newfontlanguage{Sadri}{SAD} -\newfontlanguage{Sanskrit}{SAN}\newfontlanguage{Santali}{SAT} -\newfontlanguage{Sayisi}{SAY}\newfontlanguage{Sekota}{SEK} -\newfontlanguage{Selkup}{SEL}\newfontlanguage{Sango}{SGO} -\newfontlanguage{Shan}{SHN}\newfontlanguage{Sibe}{SIB} -\newfontlanguage{Sidamo}{SID}\newfontlanguage{Silte~Gurage}{SIG} -\newfontlanguage{Skolt~Sami}{SKS}\newfontlanguage{Slovak}{SKY} -\newfontlanguage{Slavey}{SLA}\newfontlanguage{Slovenian}{SLV} -\newfontlanguage{Somali}{SML}\newfontlanguage{Samoan}{SMO} -\newfontlanguage{Sena}{SNA}\newfontlanguage{Sindhi}{SND} -\newfontlanguage{Sinhalese}{SNH}\newfontlanguage{Soninke}{SNK} -\newfontlanguage{Sodo~Gurage}{SOG}\newfontlanguage{Sotho}{SOT} -\newfontlanguage{Albanian}{SQI}\newfontlanguage{Serbian}{SRB} -\newfontlanguage{Saraiki}{SRK}\newfontlanguage{Serer}{SRR} -\newfontlanguage{South~Slavey}{SSL}\newfontlanguage{Southern~Sami}{SSM} -\newfontlanguage{Suri}{SUR}\newfontlanguage{Svan}{SVA} -\newfontlanguage{Swedish}{SVE}\newfontlanguage{Swadaya~Aramaic}{SWA} -\newfontlanguage{Swahili}{SWK}\newfontlanguage{Swazi}{SWZ} -\newfontlanguage{Sutu}{SXT}\newfontlanguage{Syriac}{SYR} -\newfontlanguage{Tabasaran}{TAB}\newfontlanguage{Tajiki}{TAJ} -\newfontlanguage{Tamil}{TAM}\newfontlanguage{Tatar}{TAT} -\newfontlanguage{TH-Cree}{TCR}\newfontlanguage{Telugu}{TEL} -\newfontlanguage{Tongan}{TGN}\newfontlanguage{Tigre}{TGR} -\newfontlanguage{Tigrinya}{TGY}\newfontlanguage{Thai}{THA} -\newfontlanguage{Tahitian}{THT}\newfontlanguage{Tibetan}{TIB} -\newfontlanguage{Turkmen}{TKM}\newfontlanguage{Temne}{TMN} -\newfontlanguage{Tswana}{TNA}\newfontlanguage{Tundra~Nenets}{TNE} -\newfontlanguage{Tonga}{TNG}\newfontlanguage{Todo}{TOD} -\newfontlanguage{Tsonga}{TSG}\newfontlanguage{Turoyo~Aramaic}{TUA} -\newfontlanguage{Tulu}{TUL}\newfontlanguage{Tuvin}{TUV} -\newfontlanguage{Twi}{TWI}\newfontlanguage{Udmurt}{UDM} -\newfontlanguage{Ukrainian}{UKR}\newfontlanguage{Urdu}{URD} -\newfontlanguage{Upper~Sorbian}{USB}\newfontlanguage{Uyghur}{UYG} -\newfontlanguage{Uzbek}{UZB}\newfontlanguage{Venda}{VEN} -\newfontlanguage{Vietnamese}{VIT}\newfontlanguage{Wa}{WA} -\newfontlanguage{Wagdi}{WAG}\newfontlanguage{West-Cree}{WCR} -\newfontlanguage{Welsh}{WEL}\newfontlanguage{Wolof}{WLF} -\newfontlanguage{Tai~Lue}{XBD}\newfontlanguage{Xhosa}{XHS} -\newfontlanguage{Yakut}{YAK}\newfontlanguage{Yoruba}{YBA} -\newfontlanguage{Y-Cree}{YCR}\newfontlanguage{Yi~Classic}{YIC} -\newfontlanguage{Yi~Modern}{YIM}\newfontlanguage{Chinese~Hong~Kong}{ZHH} +\newfontlanguage{Finnish}{FIN} +\newfontlanguage{Fijian}{FJI} +\newfontlanguage{Flemish}{FLE} +\newfontlanguage{Forest~Nenets}{FNE} +\newfontlanguage{Fon}{FON} +\newfontlanguage{Faroese}{FOS} +\newfontlanguage{French}{FRA} +\newfontlanguage{Frisian}{FRI} +\newfontlanguage{Friulian}{FRL} +\newfontlanguage{Futa}{FTA} +\newfontlanguage{Fulani}{FUL} +\newfontlanguage{Ga}{GAD} +\newfontlanguage{Gaelic}{GAE} +\newfontlanguage{Gagauz}{GAG} +\newfontlanguage{Galician}{GAL} +\newfontlanguage{Garshuni}{GAR} +\newfontlanguage{Garhwali}{GAW} +\newfontlanguage{Ge'ez}{GEZ} +\newfontlanguage{Gilyak}{GIL} +\newfontlanguage{Gumuz}{GMZ} +\newfontlanguage{Gondi}{GON} +\newfontlanguage{Greenlandic}{GRN} +\newfontlanguage{Garo}{GRO} +\newfontlanguage{Guarani}{GUA} +\newfontlanguage{Gujarati}{GUJ} +\newfontlanguage{Haitian}{HAI} +\newfontlanguage{Halam}{HAL} +\newfontlanguage{Harauti}{HAR} +\newfontlanguage{Hausa}{HAU} +\newfontlanguage{Hawaiin}{HAW} +\newfontlanguage{Hammer-Banna}{HBN} +\newfontlanguage{Hiligaynon}{HIL} +\newfontlanguage{Hindi}{HIN} +\newfontlanguage{High~Mari}{HMA} +\newfontlanguage{Hindko}{HND} +\newfontlanguage{Ho}{HO} +\newfontlanguage{Harari}{HRI} +\newfontlanguage{Croatian}{HRV} +\newfontlanguage{Hungarian}{HUN} +\newfontlanguage{Armenian}{HYE} +\newfontlanguage{Igbo}{IBO} +\newfontlanguage{Ijo}{IJO} +\newfontlanguage{Ilokano}{ILO} +\newfontlanguage{Indonesian}{IND} +\newfontlanguage{Ingush}{ING} +\newfontlanguage{Inuktitut}{INU} +\newfontlanguage{Irish}{IRI} +\newfontlanguage{Irish~Traditional}{IRT} +\newfontlanguage{Icelandic}{ISL} +\newfontlanguage{Inari~Sami}{ISM} +\newfontlanguage{Italian}{ITA} +\newfontlanguage{Hebrew}{IWR} +\newfontlanguage{Javanese}{JAV} +\newfontlanguage{Yiddish}{JII} +\newfontlanguage{Japanese}{JAN} +\newfontlanguage{Judezmo}{JUD} +\newfontlanguage{Jula}{JUL} +\newfontlanguage{Kabardian}{KAB} +\newfontlanguage{Kachchi}{KAC} +\newfontlanguage{Kalenjin}{KAL} +\newfontlanguage{Kannada}{KAN} +\newfontlanguage{Karachay}{KAR} +\newfontlanguage{Georgian}{KAT} +\newfontlanguage{Kazakh}{KAZ} +\newfontlanguage{Kebena}{KEB} +\newfontlanguage{Khutsuri~Georgian}{KGE} +\newfontlanguage{Khakass}{KHA} +\newfontlanguage{Khanty-Kazim}{KHK} +\newfontlanguage{Khmer}{KHM} +\newfontlanguage{Khanty-Shurishkar}{KHS} +\newfontlanguage{Khanty-Vakhi}{KHV} +\newfontlanguage{Khowar}{KHW} +\newfontlanguage{Kikuyu}{KIK} +\newfontlanguage{Kirghiz}{KIR} +\newfontlanguage{Kisii}{KIS} +\newfontlanguage{Kokni}{KKN} +\newfontlanguage{Kalmyk}{KLM} +\newfontlanguage{Kamba}{KMB} +\newfontlanguage{Kumaoni}{KMN} +\newfontlanguage{Komo}{KMO} +\newfontlanguage{Komso}{KMS} +\newfontlanguage{Kanuri}{KNR} +\newfontlanguage{Kodagu}{KOD} +\newfontlanguage{Korean~Old~Hangul}{KOH} +\newfontlanguage{Konkani}{KOK} +\newfontlanguage{Kikongo}{KON} +\newfontlanguage{Komi-Permyak}{KOP} +\newfontlanguage{Korean}{KOR} +\newfontlanguage{Komi-Zyrian}{KOZ} +\newfontlanguage{Kpelle}{KPL} +\newfontlanguage{Krio}{KRI} +\newfontlanguage{Karakalpak}{KRK} +\newfontlanguage{Karelian}{KRL} +\newfontlanguage{Karaim}{KRM} +\newfontlanguage{Karen}{KRN} +\newfontlanguage{Koorete}{KRT} +\newfontlanguage{Kashmiri}{KSH} +\newfontlanguage{Khasi}{KSI} +\newfontlanguage{Kildin~Sami}{KSM} +\newfontlanguage{Kui}{KUI} +\newfontlanguage{Kulvi}{KUL} +\newfontlanguage{Kumyk}{KUM} +\newfontlanguage{Kurdish}{KUR} +\newfontlanguage{Kurukh}{KUU} +\newfontlanguage{Kuy}{KUY} +\newfontlanguage{Koryak}{KYK} +\newfontlanguage{Ladin}{LAD} +\newfontlanguage{Lahuli}{LAH} +\newfontlanguage{Lak}{LAK} +\newfontlanguage{Lambani}{LAM} +\newfontlanguage{Lao}{LAO} +\newfontlanguage{Latin}{LAT} +\newfontlanguage{Laz}{LAZ} +\newfontlanguage{L-Cree}{LCR} +\newfontlanguage{Ladakhi}{LDK} +\newfontlanguage{Lezgi}{LEZ} +\newfontlanguage{Lingala}{LIN} +\newfontlanguage{Low~Mari}{LMA} +\newfontlanguage{Limbu}{LMB} +\newfontlanguage{Lomwe}{LMW} +\newfontlanguage{Lower~Sorbian}{LSB} +\newfontlanguage{Lule~Sami}{LSM} +\newfontlanguage{Lithuanian}{LTH} +\newfontlanguage{Luba}{LUB} +\newfontlanguage{Luganda}{LUG} +\newfontlanguage{Luhya}{LUH} +\newfontlanguage{Luo}{LUO} +\newfontlanguage{Latvian}{LVI} +\newfontlanguage{Majang}{MAJ} +\newfontlanguage{Makua}{MAK} +\newfontlanguage{Malayalam~Traditional}{MAL} +\newfontlanguage{Mansi}{MAN} +\newfontlanguage{Marathi}{MAR} +\newfontlanguage{Marwari}{MAW} +\newfontlanguage{Mbundu}{MBN} +\newfontlanguage{Manchu}{MCH} +\newfontlanguage{Moose~Cree}{MCR} +\newfontlanguage{Mende}{MDE} +\newfontlanguage{Me'en}{MEN} +\newfontlanguage{Mizo}{MIZ} +\newfontlanguage{Macedonian}{MKD} +\newfontlanguage{Male}{MLE} +\newfontlanguage{Malagasy}{MLG} +\newfontlanguage{Malinke}{MLN} +\newfontlanguage{Malayalam~Reformed}{MLR} +\newfontlanguage{Malay}{MLY} +\newfontlanguage{Mandinka}{MND} +\newfontlanguage{Mongolian}{MNG} +\newfontlanguage{Manipuri}{MNI} +\newfontlanguage{Maninka}{MNK} +\newfontlanguage{Manx~Gaelic}{MNX} +\newfontlanguage{Moksha}{MOK} +\newfontlanguage{Moldavian}{MOL} +\newfontlanguage{Mon}{MON} +\newfontlanguage{Moroccan}{MOR} +\newfontlanguage{Maori}{MRI} +\newfontlanguage{Maithili}{MTH} +\newfontlanguage{Maltese}{MTS} +\newfontlanguage{Mundari}{MUN} +\newfontlanguage{Naga-Assamese}{NAG} +\newfontlanguage{Nanai}{NAN} +\newfontlanguage{Naskapi}{NAS} +\newfontlanguage{N-Cree}{NCR} +\newfontlanguage{Ndebele}{NDB} +\newfontlanguage{Ndonga}{NDG} +\newfontlanguage{Nepali}{NEP} +\newfontlanguage{Newari}{NEW} +\newfontlanguage{Nagari}{NGR} +\newfontlanguage{Norway~House~Cree}{NHC} +\newfontlanguage{Nisi}{NIS} +\newfontlanguage{Niuean}{NIU} +\newfontlanguage{Nkole}{NKL} +\newfontlanguage{N'ko}{NKO} +\newfontlanguage{Dutch}{NLD} +\newfontlanguage{Nogai}{NOG} +\newfontlanguage{Norwegian}{NOR} +\newfontlanguage{Northern~Sami}{NSM} +\newfontlanguage{Northern~Tai}{NTA} +\newfontlanguage{Esperanto}{NTO} +\newfontlanguage{Nynorsk}{NYN} +\newfontlanguage{Oji-Cree}{OCR} +\newfontlanguage{Ojibway}{OJB} +\newfontlanguage{Oriya}{ORI} +\newfontlanguage{Oromo}{ORO} +\newfontlanguage{Ossetian}{OSS} +\newfontlanguage{Palestinian~Aramaic}{PAA} +\newfontlanguage{Pali}{PAL} +\newfontlanguage{Punjabi}{PAN} +\newfontlanguage{Palpa}{PAP} +\newfontlanguage{Pashto}{PAS} +\newfontlanguage{Polytonic~Greek}{PGR} +\newfontlanguage{Pilipino}{PIL} +\newfontlanguage{Palaung}{PLG} +\newfontlanguage{Polish}{PLK} +\newfontlanguage{Provencal}{PRO} +\newfontlanguage{Portuguese}{PTG} +\newfontlanguage{Chin}{QIN} +\newfontlanguage{Rajasthani}{RAJ} +\newfontlanguage{R-Cree}{RCR} +\newfontlanguage{Russian~Buriat}{RBU} +\newfontlanguage{Riang}{RIA} +\newfontlanguage{Rhaeto-Romanic}{RMS} +\newfontlanguage{Romanian}{ROM} +\newfontlanguage{Romany}{ROY} +\newfontlanguage{Rusyn}{RSY} +\newfontlanguage{Ruanda}{RUA} +\newfontlanguage{Russian}{RUS} +\newfontlanguage{Sadri}{SAD} +\newfontlanguage{Sanskrit}{SAN} +\newfontlanguage{Santali}{SAT} +\newfontlanguage{Sayisi}{SAY} +\newfontlanguage{Sekota}{SEK} +\newfontlanguage{Selkup}{SEL} +\newfontlanguage{Sango}{SGO} +\newfontlanguage{Shan}{SHN} +\newfontlanguage{Sibe}{SIB} +\newfontlanguage{Sidamo}{SID} +\newfontlanguage{Silte~Gurage}{SIG} +\newfontlanguage{Skolt~Sami}{SKS} +\newfontlanguage{Slovak}{SKY} +\newfontlanguage{Slavey}{SLA} +\newfontlanguage{Slovenian}{SLV} +\newfontlanguage{Somali}{SML} +\newfontlanguage{Samoan}{SMO} +\newfontlanguage{Sena}{SNA} +\newfontlanguage{Sindhi}{SND} +\newfontlanguage{Sinhalese}{SNH} +\newfontlanguage{Soninke}{SNK} +\newfontlanguage{Sodo~Gurage}{SOG} +\newfontlanguage{Sotho}{SOT} +\newfontlanguage{Albanian}{SQI} +\newfontlanguage{Serbian}{SRB} +\newfontlanguage{Saraiki}{SRK} +\newfontlanguage{Serer}{SRR} +\newfontlanguage{South~Slavey}{SSL} +\newfontlanguage{Southern~Sami}{SSM} +\newfontlanguage{Suri}{SUR} +\newfontlanguage{Svan}{SVA} +\newfontlanguage{Swedish}{SVE} +\newfontlanguage{Swadaya~Aramaic}{SWA} +\newfontlanguage{Swahili}{SWK} +\newfontlanguage{Swazi}{SWZ} +\newfontlanguage{Sutu}{SXT} +\newfontlanguage{Syriac}{SYR} +\newfontlanguage{Tabasaran}{TAB} +\newfontlanguage{Tajiki}{TAJ} +\newfontlanguage{Tamil}{TAM} +\newfontlanguage{Tatar}{TAT} +\newfontlanguage{TH-Cree}{TCR} +\newfontlanguage{Telugu}{TEL} +\newfontlanguage{Tongan}{TGN} +\newfontlanguage{Tigre}{TGR} +\newfontlanguage{Tigrinya}{TGY} +\newfontlanguage{Thai}{THA} +\newfontlanguage{Tahitian}{THT} +\newfontlanguage{Tibetan}{TIB} +\newfontlanguage{Turkmen}{TKM} +\newfontlanguage{Temne}{TMN} +\newfontlanguage{Tswana}{TNA} +\newfontlanguage{Tundra~Nenets}{TNE} +\newfontlanguage{Tonga}{TNG} +\newfontlanguage{Todo}{TOD} +\newfontlanguage{Tsonga}{TSG} +\newfontlanguage{Turoyo~Aramaic}{TUA} +\newfontlanguage{Tulu}{TUL} +\newfontlanguage{Tuvin}{TUV} +\newfontlanguage{Twi}{TWI} +\newfontlanguage{Udmurt}{UDM} +\newfontlanguage{Ukrainian}{UKR} +\newfontlanguage{Urdu}{URD} +\newfontlanguage{Upper~Sorbian}{USB} +\newfontlanguage{Uyghur}{UYG} +\newfontlanguage{Uzbek}{UZB} +\newfontlanguage{Venda}{VEN} +\newfontlanguage{Vietnamese}{VIT} +\newfontlanguage{Wa}{WA} +\newfontlanguage{Wagdi}{WAG} +\newfontlanguage{West-Cree}{WCR} +\newfontlanguage{Welsh}{WEL} +\newfontlanguage{Wolof}{WLF} +\newfontlanguage{Tai~Lue}{XBD} +\newfontlanguage{Xhosa}{XHS} +\newfontlanguage{Yakut}{YAK} +\newfontlanguage{Yoruba}{YBA} +\newfontlanguage{Y-Cree}{YCR} +\newfontlanguage{Yi~Classic}{YIC} +\newfontlanguage{Yi~Modern}{YIM} +\newfontlanguage{Chinese~Hong~Kong}{ZHH} \newfontlanguage{Chinese~Phonetic}{ZHP} \newfontlanguage{Chinese~Simplified}{ZHS} -\newfontlanguage{Chinese~Traditional}{ZHT}\newfontlanguage{Zande}{ZND} +\newfontlanguage{Chinese~Traditional}{ZHT} +\newfontlanguage{Zande}{ZND} \newfontlanguage{Zulu}{ZUL} -\keys_define:nn {fontspec} + + +\__fontspec_define_aat_feature_group:n {Ligatures} +\__fontspec_define_aat_feature:nnnn {Ligatures} {Required} {1} {0} +\__fontspec_define_aat_feature:nnnn {Ligatures} {NoRequired} {1} {1} +\__fontspec_define_aat_feature:nnnn {Ligatures} {Common} {1} {2} +\__fontspec_define_aat_feature:nnnn {Ligatures} {NoCommon} {1} {3} +\__fontspec_define_aat_feature:nnnn {Ligatures} {Rare} {1} {4} +\__fontspec_define_aat_feature:nnnn {Ligatures} {NoRare} {1} {5} +\__fontspec_define_aat_feature:nnnn {Ligatures} {Discretionary} {1} {4} +\__fontspec_define_aat_feature:nnnn {Ligatures} {NoDiscretionary} {1} {5} +\__fontspec_define_aat_feature:nnnn {Ligatures} {Logos} {1} {6} +\__fontspec_define_aat_feature:nnnn {Ligatures} {NoLogos} {1} {7} +\__fontspec_define_aat_feature:nnnn {Ligatures} {Rebus} {1} {8} +\__fontspec_define_aat_feature:nnnn {Ligatures} {NoRebus} {1} {9} +\__fontspec_define_aat_feature:nnnn {Ligatures} {Diphthong} {1} {10} +\__fontspec_define_aat_feature:nnnn {Ligatures} {NoDiphthong} {1} {11} +\__fontspec_define_aat_feature:nnnn {Ligatures} {Squared} {1} {12} +\__fontspec_define_aat_feature:nnnn {Ligatures} {NoSquared} {1} {13} +\__fontspec_define_aat_feature:nnnn {Ligatures} {AbbrevSquared} {1} {14} +\__fontspec_define_aat_feature:nnnn {Ligatures} {NoAbbrevSquared} {1} {15} +\__fontspec_define_aat_feature:nnnn {Ligatures} {Icelandic} {1} {32} +\__fontspec_define_aat_feature:nnnn {Ligatures} {NoIcelandic} {1} {33} +\keys_define:nn {fontspec-aat} { - Language / Turkish .code:n = + Ligatures / TeX .code:n = { - \fontspec_check_lang:nTF {TRK} - { - \int_set:Nn \l_fontspec_language_int {\l_fontspec_strnum_int} - \tl_set:Nn \l_fontspec_lang_tl {TRK} - } - { - \fontspec_check_lang:nTF {TUR} - { - \int_set:Nn \l_fontspec_language_int {\l_fontspec_strnum_int} - \tl_set:Nn \l_fontspec_lang_tl {TUR} - } - { - \__fontspec_warning:nx {language-not-exist} {Turkish} - \keys_set:nn {fontspec} {Language=Default} - } - } + \__fontspec_update_featstr:n { mapping = tex-text } } } -\__fontspec_keys_define_code:nnn {fontspec}{ Language / Default } +\__fontspec_define_aat_feature_group:n {Letters} +\__fontspec_define_aat_feature:nnnn {Letters} {Normal} {3} {0} +\__fontspec_define_aat_feature:nnnn {Letters} {Uppercase} {3} {1} +\__fontspec_define_aat_feature:nnnn {Letters} {Lowercase} {3} {2} +\__fontspec_define_aat_feature:nnnn {Letters} {SmallCaps} {3} {3} +\__fontspec_define_aat_feature:nnnn {Letters} {InitialCaps} {3} {4} +\__fontspec_define_aat_feature_group:n {Numbers} +\__fontspec_define_aat_feature:nnnn {Numbers} {Monospaced} {6} {0} +\__fontspec_define_aat_feature:nnnn {Numbers} {Proportional} {6} {1} +\__fontspec_define_aat_feature:nnnn {Numbers} {Lowercase} {21} {0} +\__fontspec_define_aat_feature:nnnn {Numbers} {OldStyle} {21} {0} +\__fontspec_define_aat_feature:nnnn {Numbers} {Uppercase} {21} {1} +\__fontspec_define_aat_feature:nnnn {Numbers} {Lining} {21} {1} +\__fontspec_define_aat_feature:nnnn {Numbers} {SlashedZero} {14} {5} +\__fontspec_define_aat_feature:nnnn {Numbers} {NoSlashedZero} {14} {4} +\__fontspec_define_aat_feature_group:n {Contextuals} +\__fontspec_define_aat_feature:nnnn {Contextuals} {WordInitial} {8} {0} +\__fontspec_define_aat_feature:nnnn {Contextuals} {NoWordInitial} {8} {1} +\__fontspec_define_aat_feature:nnnn {Contextuals} {WordFinal} {8} {2} +\__fontspec_define_aat_feature:nnnn {Contextuals} {NoWordFinal} {8} {3} +\__fontspec_define_aat_feature:nnnn {Contextuals} {LineInitial} {8} {4} +\__fontspec_define_aat_feature:nnnn {Contextuals} {NoLineInitial} {8} {5} +\__fontspec_define_aat_feature:nnnn {Contextuals} {LineFinal} {8} {6} +\__fontspec_define_aat_feature:nnnn {Contextuals} {NoLineFinal} {8} {7} +\__fontspec_define_aat_feature:nnnn {Contextuals} {Inner} {8} {8} +\__fontspec_define_aat_feature:nnnn {Contextuals} {NoInner} {8} {9} +\__fontspec_define_aat_feature_group:n {Diacritics} +\__fontspec_define_aat_feature:nnnn {Diacritics} {Show} {9} {0} +\__fontspec_define_aat_feature:nnnn {Diacritics} {Hide} {9} {1} +\__fontspec_define_aat_feature:nnnn {Diacritics} {Decompose} {9} {2} +\__fontspec_define_aat_feature_group:n {VerticalPosition} +\__fontspec_define_aat_feature:nnnn {VerticalPosition} {Normal} {10} {0} +\__fontspec_define_aat_feature:nnnn {VerticalPosition} {Superior} {10} {1} +\__fontspec_define_aat_feature:nnnn {VerticalPosition} {Inferior} {10} {2} +\__fontspec_define_aat_feature:nnnn {VerticalPosition} {Ordinal} {10} {3} +\__fontspec_define_aat_feature_group:n {Fractions} +\__fontspec_define_aat_feature:nnnn {Fractions} {On} {11} {1} +\__fontspec_define_aat_feature:nnnn {Fractions} {Off} {11} {0} +\__fontspec_define_aat_feature:nnnn {Fractions} {Diagonal} {11} {2} +\__fontspec_define_aat_feature_group:n { Alternate } +\keys_define:nn {fontspec-aat} { - \tl_set:Nn \l_fontspec_lang_tl {DFLT} - \int_zero:N \l_fontspec_language_int + Alternate .default:n = {0} , + Alternate / unknown .code:n = + { + \clist_map_inline:nn {#1} + { + \__fontspec_make_AAT_feature:nn {17}{##1} + } + } } -\__fontspec_keys_define_code:nnn {fontspec} {RawFeature} +\__fontspec_define_aat_feature_group:n {Variant} +\keys_define:nn {fontspec-aat} { - \__fontspec_update_featstr:n {#1} + Variant .default:n = {0} , + Variant / unknown .code:n = + { + \clist_map_inline:nn {#1} + { \__fontspec_make_AAT_feature:nn {18}{##1} } + } + } +\aliasfontfeature{Variant}{StylisticSet} +\__fontspec_define_aat_feature_group:n {Vertical} +\keys_define:nn {fontspec-aat} + { + Vertical .choice: , + Vertical / RotatedGlyphs .code:n = + { + \__fontspec_update_featstr:n {vertical} + } } + +\__fontspec_define_aat_feature_group:n {Style} +\__fontspec_define_aat_feature:nnnn {Style} {Italic} {32} {2} +\__fontspec_define_aat_feature:nnnn {Style} {Ruby} {28} {2} +\__fontspec_define_aat_feature:nnnn {Style} {Display} {19} {1} +\__fontspec_define_aat_feature:nnnn {Style} {Engraved} {19} {2} +\__fontspec_define_aat_feature:nnnn {Style} {TitlingCaps} {19} {4} +\__fontspec_define_aat_feature:nnnn {Style} {TallCaps} {19} {5} +\__fontspec_define_aat_feature_group:n {CJKShape} +\__fontspec_define_aat_feature:nnnn {CJKShape} {Traditional} {20} {0} +\__fontspec_define_aat_feature:nnnn {CJKShape} {Simplified} {20} {1} +\__fontspec_define_aat_feature:nnnn {CJKShape} {JIS1978} {20} {2} +\__fontspec_define_aat_feature:nnnn {CJKShape} {JIS1983} {20} {3} +\__fontspec_define_aat_feature:nnnn {CJKShape} {JIS1990} {20} {4} +\__fontspec_define_aat_feature:nnnn {CJKShape} {Expert} {20} {10} +\__fontspec_define_aat_feature:nnnn {CJKShape} {NLC} {20} {13} +\__fontspec_define_aat_feature_group:n {CharacterWidth} +\__fontspec_define_aat_feature:nnnn {CharacterWidth} {Proportional} {22} {0} +\__fontspec_define_aat_feature:nnnn {CharacterWidth} {Full} {22} {1} +\__fontspec_define_aat_feature:nnnn {CharacterWidth} {Half} {22} {2} +\__fontspec_define_aat_feature:nnnn {CharacterWidth} {Third} {22} {3} +\__fontspec_define_aat_feature:nnnn {CharacterWidth} {Quarter} {22} {4} +\__fontspec_define_aat_feature:nnnn {CharacterWidth} {AlternateProportional} {22} {5} +\__fontspec_define_aat_feature:nnnn {CharacterWidth} {AlternateHalf} {22} {6} +\__fontspec_define_aat_feature:nnnn {CharacterWidth} {Default} {22} {7} +\__fontspec_define_aat_feature_group:n {Annotation} +\__fontspec_define_aat_feature:nnnn {Annotation} {Off} {24} {0} +\__fontspec_define_aat_feature:nnnn {Annotation} {Box} {24} {1} +\__fontspec_define_aat_feature:nnnn {Annotation} {RoundedBox} {24} {2} +\__fontspec_define_aat_feature:nnnn {Annotation} {Circle} {24} {3} +\__fontspec_define_aat_feature:nnnn {Annotation} {BlackCircle} {24} {4} +\__fontspec_define_aat_feature:nnnn {Annotation} {Parenthesis} {24} {5} +\__fontspec_define_aat_feature:nnnn {Annotation} {Period} {24} {6} +\__fontspec_define_aat_feature:nnnn {Annotation} {RomanNumerals} {24} {7} +\__fontspec_define_aat_feature:nnnn {Annotation} {Diamond} {24} {8} +\__fontspec_define_aat_feature:nnnn {Annotation} {BlackSquare} {24} {9} +\__fontspec_define_aat_feature:nnnn {Annotation} {BlackRoundSquare} {24} {10} +\__fontspec_define_aat_feature:nnnn {Annotation} {DoubleCircle} {24} {11} + +\providecommand\UnicodeFontFile[2]{"[#1]:#2"} +\providecommand\UnicodeFontName[2]{"#1:#2"} +\providecommand\UnicodeFontTeXLigatures{mapping=tex-text;} +\providecommand\add@unicode@accent[2]{#2\char#1\relax} +\providecommand\DeclareUnicodeAccent[3]{% + \DeclareTextCommand{#1}{#2}{\add@unicode@accent{#3}}% +} +\DeclareDocumentCommand \EncodingCommand {mO{}m} + { + \bool_if:NF \l__fontspec_defining_encoding_bool + { \__fontspec_error:nn {only-inside-encdef} \EncodingCommand } + \DeclareTextCommand{#1}{\UnicodeEncodingName}[#2]{#3} + } +\DeclareDocumentCommand \EncodingAccent {mm} + { + \bool_if:NF \l__fontspec_defining_encoding_bool + { \__fontspec_error:nn {only-inside-encdef} \EncodingAccent } + \DeclareTextCommand{#1}{\UnicodeEncodingName}{\add@unicode@accent{#2}} + } +\DeclareDocumentCommand \EncodingSymbol {mm} + { + \bool_if:NF \l__fontspec_defining_encoding_bool + { \__fontspec_error:nn {only-inside-encdef} \EncodingSymbol } + \DeclareTextSymbol{#1}{\UnicodeEncodingName}{#2} + } +\DeclareDocumentCommand \EncodingComposite {mmm} + { + \bool_if:NF \l__fontspec_defining_encoding_bool + { \__fontspec_error:nn {only-inside-encdef} \EncodingComposite } + \DeclareTextComposite{#1}{\UnicodeEncodingName}{#2}{#3} + } +\DeclareDocumentCommand \EncodingCompositeCommand {mmm} + { + \bool_if:NF \l__fontspec_defining_encoding_bool + { \__fontspec_error:nn {only-inside-encdef} \EncodingCompositeCommand } + \DeclareTextCompositeCommand{#1}{\UnicodeEncodingName}{#2}{#3} + } +\DeclareDocumentCommand \DeclareUnicodeEncoding {mm} + { + \DeclareFontEncoding{#1}{}{} + \DeclareErrorFont{#1}{lmr}{m}{n}{10} + \DeclareFontSubstitution{#1}{lmr}{m}{n} + \DeclareFontFamily{#1}{lmr}{} + + \DeclareFontShape{#1}{lmr}{m}{n} + {<->\UnicodeFontFile{lmroman10-regular}{\UnicodeFontTeXLigatures}}{} + \DeclareFontShape{#1}{lmr}{m}{it} + {<->\UnicodeFontFile{lmroman10-italic}{\UnicodeFontTeXLigatures}}{} + \DeclareFontShape{#1}{lmr}{m}{sc} + {<->\UnicodeFontFile{lmromancaps10-regular}{\UnicodeFontTeXLigatures}}{} + \DeclareFontShape{#1}{lmr}{bx}{n} + {<->\UnicodeFontFile{lmroman10-bold}{\UnicodeFontTeXLigatures}}{} + \DeclareFontShape{#1}{lmr}{bx}{it} + {<->\UnicodeFontFile{lmroman10-bolditalic}{\UnicodeFontTeXLigatures}}{} + + \tl_set_eq:NN \l__fontspec_prev_unicode_name_tl \UnicodeEncodingName + \tl_set:Nn \UnicodeEncodingName {#1} + \bool_set_true:N \l__fontspec_defining_encoding_bool + #2 + \bool_set_false:N \l__fontspec_defining_encoding_bool + \tl_set_eq:NN \UnicodeEncodingName \l__fontspec_prev_unicode_name_tl + } +\DeclareDocumentCommand \UndeclareSymbol {m} + { + \bool_if:NF \l__fontspec_defining_encoding_bool + { \__fontspec_error:nn {only-inside-encdef} \UndeclareSymbol } + \UndeclareTextCommand {#1} {\UnicodeEncodingName} + } + +\DeclareDocumentCommand \UndeclareComposite {mm} + { + \bool_if:NF \l__fontspec_defining_encoding_bool + { \__fontspec_error:nn {only-inside-encdef} \UndeclareComposite } + \cs_undefine:c + { \c_backslash_str \UnicodeEncodingName \token_to_str:N #1 - \tl_to_str:n {#2} } + } \@ifpackageloaded{euler} { \bool_set_true:N \g__fontspec_pkg_euler_loaded_bool @@ -2661,7 +3487,7 @@ \tl_set:Nn \zf@enc { \g_fontspec_encoding_tl } \cs_set:Npn \zf@fontspec #1 #2 { - \fontspec_select:nn {#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 } } @@ -2722,27 +3548,45 @@ \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} - } + \prop_clear:N \g__fontspec_em_prop + \int_zero:N \l__fontspec_emdef_int + \group_begin: + \normalfont + \clist_map_inline:nn {\emreset,#1} + { + ##1 + \prop_gput:NxV \g__fontspec_em_prop { \f@series/\f@shape } { \l__fontspec_emdef_int } + \prop_gput:Nxn \g__fontspec_em_prop { switch-\int_use:N \l__fontspec_emdef_int } { ##1 } + \int_incr:N \l__fontspec_emdef_int + } + \group_end: } \DeclareRobustCommand \em { \@nomath\em + + \prop_get:NxNT \g__fontspec_em_prop { \f@series/\f@shape } \l__fontspec_em_tmp_tl + { \int_set:Nn \l__fontspec_em_int { \l__fontspec_em_tmp_tl } } + \int_incr:N \l__fontspec_em_int - \use:c {__fontspec_em_font_ \int_use:N \l__fontspec_em_int _switch:} + + \prop_get:NxNTF \g__fontspec_em_prop { switch-\int_use:N \l__fontspec_em_int } \l__fontspec_em_switch_tl + { \l__fontspec_em_switch_tl } + { + \int_zero:N \l__fontspec_em_int + \emreset + } + } \DeclareTextFontCommand{\emph}{\em} +\cs_set:Npn \emreset { \upshape } \cs_set:Npn \emshape { \itshape } \cs_set:Npn \eminnershape { \upshape } \emfontdeclare{ \emshape, \eminnershape } +\cs_set:Npn \reset@font { \normalfont \int_zero:N \l__fontspec_em_int } +\cs_new:Nn \fontspec_set_em_level:n { \int_set:Nn \l__fontspec_em_int {#1} } \DeclareRobustCommand{\-} { \discretionary @@ -2757,7 +3601,7 @@ \def\xlx@defaulthyphenchar{`\-} \cs_new:Nn \fontspec_visible_space: { - \font_glyph_if_exist:NnTF \font {"2423} + \__fontspec_primitive_font_glyph_if_exist:NnTF \font {"2423} { \char"2423\scan_stop: } { \fontspec_visible_space_fallback: } } @@ -2844,15 +3688,15 @@ { \addfontfeature{Numbers=Lining} #1 } } %% ------------------------------------------------ -%% Copyright 2004--2016 Will Robertson <wspr81@gmail.com> +%% Copyright 2004--2017 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. %% The latest version of this license is at: http://www.latex-project.org/lppl.txt %% %% This work is "maintained" by Will Robertson. -%% It consists of the files: fontspec*.dtx, fontspec.cfg, fontspec-example.tex. -%% And the derived files: fontspec*.sty,fontspec.lua, and fontspec.pdf. +%% It consists of the files: fontspec*.dtx, fontspec.cfg, fontspec*.tex. +%% And the derived files: fontspec*.sty,fontspec.lua, fontspec.pdf. %% ------------------------------------------------ %% %% End of file `fontspec-xetex.sty'. |