%%
%% This is file `fontspec.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% fontspec.dtx  (with options: `fontspec')
%% 
%%   _________________________________________
%%   The fontspec package for XeLaTeX/LuaLaTeX
%%   (C) 2004--2010    Will Robertson and Khaled Hosny
%% 
%%   License information appended.
%% 
%% 
\ProvidesPackage{fontspec}
  [2010/06/08 v2.0 Advanced font selection for XeLaTeX/LuaLaTeX]


\RequirePackage{expl3,xparse}
\input binhex.tex  % before expl syntax!
\ExplSyntaxOn
\msg_new:nnn {fontspec} {not-pdftex}
{
  Requires~ XeTeX~ or~ LuaTeX~ to~ function!
}
\xetex_if_engine:F {
  \luatex_if_engine:TF {
    \RequirePackage{luatextra}[2010/05/10]
    \luatexRequireModule{fontspec}
  }{
    \msg_error:nn {fontspec} {not-pdftex}
  }
}
\xetex_if_engine:TF
  { \cs_new_eq:NN \xetex_or_luatex:nn \use_i:nn }
  { \luatex_if_engine:T
    { \cs_new_eq:NN \xetex_or_luatex:nn \use_ii:nn }
  }
\xetex_if_engine:TF
  { \cs_new:Npn \xetex_or_luatex:nnn #1#2#3 {#1{#2}} }
  {
    \luatex_if_engine:T
     { \cs_new:Npn \xetex_or_luatex:nnn #1#2#3 {#1{#3}} }
  }
\newif\ifzf@firsttime
\newif\ifzf@nobf
\newif\ifzf@noit
\newif\ifzf@nosc
\newif\ifzf@tfm
\newif\ifzf@atsui
\newif\ifzf@icu
\newif\ifzf@mm
\newif\ifzf@graphite
\newif\ifzf@math@euler
\newif\ifzf@math@lucida
\newif\ifzf@package@euler@loaded
\newif\if@zf@configfile
\newif\if@zf@math
\newcount\c@zf@newff
\newcount\c@zf@index
\newcount\c@zf@script
\newcount\c@zf@language
\int_new:N \l_fontspec_strnum_int
\cs_set:Npn \use:x #1 { \edef\@tempa{#1}\@tempa }
\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_new:Npn \fontspec_setkeys:xx #1#2
 {
  \use:x { \exp_not:N \setkeys*[zf]{#1}{#2} }
 }
\cs_new:Npn \fontspec_setkeys:xxx #1#2#3
 {
  \use:x { \exp_not:N \setkeys*[zf@#1]{#2}{#3} }
 }
\cs_new:Npn \fontspec_error:n     { \msg_error:nn     {fontspec} }
\cs_new:Npn \fontspec_error:nx    { \msg_error:nnx    {fontspec} }
\cs_new:Npn \fontspec_warning:n   { \msg_warning:nn   {fontspec} }
\cs_new:Npn \fontspec_warning:nx  { \msg_warning:nnx  {fontspec} }
\cs_new:Npn \fontspec_warning:nxx { \msg_warning:nnxx {fontspec} }
\cs_new:Npn \fontspec_info:n      { \msg_info:nn      {fontspec} }
\cs_new:Npn \fontspec_info:nx     { \msg_info:nnx     {fontspec} }
\cs_new:Npn \fontspec_info:nxx    { \msg_info:nnxx    {fontspec} }
\cs_new:Npn \fontspec_trace:n     { \msg_trace:nn     {fontspec} }
\msg_new:nnn {fontspec} {no-size-info}
{
  Size~ information~ must~ be~ supplied.\\
  For~ example,~ SizeFeatures={Size={8-12},...}.
}
\msg_new:nnnn {fontspec} {rename-feature-not-exist}
{
  The~ feature~ #1~ doesn't~ appear~ to~ be~ defined.
}
{
  It~ looks~ like~ you're~ trying~ to~ rename~ a~ feature~ that~ doesn't~ exist.
}
\msg_new:nnn {fontspec} {no-glyph}
{
  '\zf@fontname'~ doesn't~ appear~ to~ have~ the~ glyph~ corresponding~ to~ '#1'.
}
\msg_new:nnnn {fontspec} {unknown-options}
{
  The~ following~ font~ options~ are~ not~ recognised:\\
  \space\space\space\space #1
}
{
  There~ is~ probably~ a~ typo~ in~ the~ font~ feature~ selection.
}
\msg_new:nnnn {fontspec} {euler-too-late}
{
  The~ euler~ package~ must~ be~ loaded~ BEFORE~ fontspec.
}
{
  fontspec~ only~ overwrites~ euler's~ attempt~ to\\
  define~ the~ maths~ text~ fonts~ if~ fontspec~ is\\
  loaded~ after~ euler.~ Type~ <return>~ to~ proceed\\
  with~ incorrect~ \string\mathit,~ \string\mathbf,~ etc.
}
\msg_new:nnnn {fontspec} {no-xcolor}
{
  Cannot~ load~ named~ colours~ without~ the~ xcolor~ package.
}
{
  Sorry,~ I~ can't~ do~ anything~ to~ help.~ Instead~ of~ loading\\
  the~ color~ package,~ use~ xcolor~ instead.~ It's~ better.
}
\msg_new:nnnn {fontspec} {unknown-color-model}
{
  Error~ loading~ colour~ `#1';~ unknown~ colour~ model.
}
{
  Sorry,~ I~ can't~ do~ anything~ to~ help.~ Please~ report~ this~ error\\
  to~ my~ developer~ with~ a~ minimal~ example~ that~ causes~ the~ problem.
}
\msg_new:nnn {fontspec} {addfontfeatures-ignored}
{
  \string\addfontfeature (s)~ ignored;\\
  it~ cannot~ be~ used~ with~ a~ font~ that~ wasn't~ selected~ by~ fontspec.
}
\msg_new:nnn {fontspec} {feature-option-overwrite}
{
  Option~ '#2'~ of~ font~ feature~ '#1'~ overwritten.
}
\msg_new:nnn {fontspec} {script-not-exist}
{
  Font~ '\zf@fontname'~ does~ not~ contain~ script~ '#1'.
}
\msg_new:nnn {fontspec} {aat-feature-not-exist}
{
  '\XKV@tfam=\XKV@tkey'~ feature~ not~ supported\\
  for~ AAT~ font~ '\zf@fontname'.
}
\msg_new:nnn {fontspec} {aat-feature-not-exist-in-font}
{
  AAT~ feature~ '\XKV@tfam=\XKV@tkey'~ (#1)~ not~ available\\
  in~ font~ '\zf@fontname'.
}
\msg_new:nnn {fontspec} {icu-feature-not-exist}
{
  '\XKV@tfam=\XKV@tkey'~ feature~ not~ supported\\
  for~ ICU~ font~ '\zf@fontname'
}
\msg_new:nnn {fontspec} {icu-feature-not-exist-in-font}
{
  OpenType~ feature~ '\XKV@tfam=\XKV@tkey'~ (#1)~ not~ available\\
  for~ font~ '\zf@fontname', \\
  with~ script~ '\l_fontspec_script_name_tl',~ and~ language~ '\l_fontspec_lang_name_tl'.
}
\msg_new:nnn {fontspec} {no-opticals}
{
  '\zf@fontname'~ doesn't~ appear~ to~ have~ an~ Optical~ Size~ axis.
}
\msg_new:nnn {fontspec} {language-not-exist}
{
  Language~ '#1'~ not~ available\\
  for~ font~ '\zf@fontname'\\
  with~ script~ '\l_fontspec_script_name_tl'.
}
\msg_new:nnn {fontspec} {only-xetex-feature}
{
  Ignored~ XeTeX~ only~ feature:~ '#1'.
}
\msg_new:nnn {fontspec} {only-luatex-feature}
{
  Ignored~ LuaTeX~ only~ feature:~ '#1'.
}
\msg_new:nnn {fontspec} {no-mapping}
{
  Input~ mapping~ not~ (yet?)~ supported~ in~ LuaTeX.
}
\msg_new:nnn {fontspec} {no-mapping-ligtex}
{
  Input~ mapping~ not~ (yet?)~ supported~ in~ LuaTeX.\\
  Use~ "Ligatures=TeX"~ instead~ of~ "Mapping=tex-text".
}
\msg_new:nnn {fontspec} {cm-default-obsolete}
{
  The~ "cm-default"~ package~ option~ is~ obsolete.
}
\msg_new:nnn {fontspec} {defining-font}
{
  Defining~ font~ family~ for~ '#2'~ with~ options~ [\zf@default@options #1].
}
\msg_new:nnn {fontspec} {no-font-shape}
{
  Could~ not~ resolve~ font~ #1~ (it~ probably~ doesn't~ exist).
}
\msg_new:nnn {fontspec} {set-scale}
{
  \zf@fontname\space scale ~=~ \l_fontspec_scale_tl.
}
\msg_new:nnn {fontspec} {setup-math}
{
  Adjusting~ the~ maths~ setup~ (use~ [no-math]~ to~ avoid~ this).
}
\msg_new:nnn {fontspec} {no-scripts}
{
  Font~ \zf@fontname\space does~ not~ contain~ any~ OpenType~ `Script'~ information.
}
\DeclareOption{cm-default}{
  \fontspec_warning:n {cm-default-obsolete}
}
\DeclareOption{math}{\@zf@mathtrue}
\DeclareOption{no-math}{\@zf@mathfalse}
\DeclareOption{config}{\@zf@configfiletrue}
\DeclareOption{no-config}{\@zf@configfilefalse}
\DeclareOption{quiet}{
  \msg_redirect_module:nnn { fontspec } { warning } { info }
  \msg_redirect_module:nnn { fontspec } { info } { none }
}
\DeclareOption{silent}{
  \msg_redirect_module:nnn { fontspec } { warning } { none }
  \msg_redirect_module:nnn { fontspec } { info } { none }
}
\ExecuteOptions{config,math}
\ProcessOptions*
\RequirePackage{calc}
\RequirePackage{xkeyval}[2005/05/07]
\RequirePackage{fontspec-patches}
\xetex_or_luatex:nnn {\tl_set:Nn \zf@enc} {EU1} {EU2}
\tl_set:Nn \rmdefault {lmr}
\tl_set:Nn \sfdefault {lmss}
\tl_set:Nn \ttdefault {lmtt}
\RequirePackage[\zf@enc]{fontenc}
\tl_set_eq:NN \UTFencname \zf@enc % for xunicode
\tl_set_eq:NN \cyrillicencoding \zf@enc
\tl_set_eq:NN \latinencoding    \zf@enc
\g@addto@macro \document {
  \tl_set_eq:NN \cyrillicencoding \zf@enc
  \tl_set_eq:NN \latinencoding    \zf@enc
}
\DeclareDocumentCommand \fontspec { O{} m } {
  \fontspec_set_family:Nnn \f@family {#1}{#2}
  \selectfont
  \ignorespaces
}
\DeclareDocumentCommand \setmainfont { O{} m } {
  \fontspec_set_family:Nnn \rmdefault {#1}{#2}
  \normalfont
}
\DeclareDocumentCommand \setsansfont { O{} m } {
  \fontspec_set_family:Nnn \sfdefault {#1}{#2}
  \normalfont
}
\DeclareDocumentCommand \setmonofont { O{} m } {
  \fontspec_set_family:Nnn \ttdefault {#1}{#2}
  \normalfont
}
\cs_set_eq:NN \setromanfont \setmainfont
\DeclareDocumentCommand \setmathrm { O{} m } {
  \fontspec_set_family:Nnn \zf@rmmaths {#1}{#2}
}
\DeclareDocumentCommand \setboldmathrm { O{} m } {
  \fontspec_set_family:Nnn \zf@rmboldmaths {#1}{#2}
}
\DeclareDocumentCommand \setmathsf { O{} m } {
  \fontspec_set_family:Nnn \zf@sfmaths {#1}{#2}
}
\DeclareDocumentCommand \setmathtt { O{} m } {
  \fontspec_set_family:Nnn \zf@ttmaths {#1}{#2}
}
\@onlypreamble\setmathrm
\@onlypreamble\setboldmathrm
\@onlypreamble\setmathsf
\@onlypreamble\setmathtt
\def\zf@rmmaths{\rmdefault}
\def\zf@sfmaths{\sfdefault}
\def\zf@ttmaths{\ttdefault}
\DeclareDocumentCommand \newfontfamily { m O{} m } {
  \fontspec_select:nn{#2}{#3}
  \use:x {
    \exp_not:N \DeclareRobustCommand \exp_not:N #1 {
      \exp_not:N \fontfamily {\zf@family} \exp_not:N \selectfont
    }
  }
}
\DeclareDocumentCommand \newfontface { m O{} m } {
  \newfontfamily #1 [ BoldFont={},ItalicFont={},SmallCapsFont={},#2 ] {#3}
}
\DeclareDocumentCommand \defaultfontfeatures {m} {\def\zf@default@options{#1,}}
\let\zf@default@options\@empty
\DeclareDocumentCommand \addfontfeatures {m} {
  \ifcsname zf@family@fontdef\f@family\endcsname
    \begingroup
      \let\zf@default@options\@empty
      \use:x {
        \exp_not:N\fontspec_select:nn
          {\csname zf@family@options\f@family\endcsname,#1}
          {\csname zf@family@fontname\f@family\endcsname}
      }
    \endgroup
    \fontfamily\zf@family\selectfont
  \else
    \fontspec_warning:n {addfontfeatures-ignored}
  \fi
  \ignorespaces
}
\let\addfontfeature\addfontfeatures
\DeclareDocumentCommand \newfontfeature {mm} {
  \stepcounter{zf@newff}
  \cs_set:cpx{+zf-#1}{+zf-\the\c@zf@newff}
  \define@key[zf]{options}{#1}[]{
    \zf@update@family{\csname+zf-#1\endcsname}
    \zf@update@ff{#2}
  }
}
\DeclareDocumentCommand \newAATfeature {mmmm} {
  \unless\ifcsname zf@options@#1\endcsname
    \zf@define@font@feature{#1}
  \fi
  \key@ifundefined[zf]{#1}{#2}{}{
    \fontspec_warning:nxx {feature-option-overwrite}{#1}{#2}
  }
  \zf@define@feature@option{#1}{#2}{#3}{#4}{}
}
\DeclareDocumentCommand \newICUfeature {mmm} {
  \unless\ifcsname zf@options@#1\endcsname
    \zf@define@font@feature{#1}
  \fi
  \key@ifundefined[zf]{#1}{#2}{}{
    \fontspec_warning:nxx {feature-option-overwrite}{#1}{#2}
  }
  \zf@define@feature@option{#1}{#2}{}{}{#3}
}
\cs_set_eq:NN \newopentypefeature \newICUfeature
\DeclareDocumentCommand \aliasfontfeature {mm} {\multi@alias@key{#1}{#2}}
\DeclareDocumentCommand \aliasfontfeatureoption {mmm} {
  \keyval@alias@key[zf@feat]{#1}{#2}{#3}
}
\DeclareDocumentCommand \newfontscript {mm}
{
  \fontspec_new_script:nn {#1} {#2}
  \fontspec_new_script:nn {#2} {#2}
}
\cs_new:Npn \fontspec_new_script:nn #1#2
{
  \define@key[zf@feat]{Script}{#1}[]{
    \fontspec_check_script:nTF {#2} {
      \zf@update@family{+script=#1}
      \tl_set:Nn \l_fontspec_script_tl {#2}
      \c@zf@script=\l_fontspec_strnum_int\relax
    }{
      \fontspec_warning:nx {script-not-exist} {#1}
    }
  }
}
\DeclareDocumentCommand \newfontlanguage {mm}
{
  \fontspec_new_lang:nn {#1} {#2}
  \fontspec_new_lang:nn {#2} {#2}
}
\cs_new:Npn \fontspec_new_lang:nn #1#2
{
  \define@key[zf@feat]{Lang}{#1}[]{
    \fontspec_check_lang:nTF {#2} {
      \zf@update@family{+lang=#1}
      \tl_set:Nn \l_fontspec_lang_tl {#2}
      \c@zf@language=\l_fontspec_strnum_int\relax
    }{
      \fontspec_warning:nx {language-not-exist} {#1}
    }
  }
}
\DeclareDocumentCommand \DeclareFontsExtensions {m}
{
  \tl_set:Nx \l_fontspec_extensions_clist { \zap@space #1~\@empty }
}
\DeclareFontsExtensions{.otf,.ttf,.OTF,.TTF,.ttc,.TTC,.dfont}
\prg_new_conditional:Nnn \fontspec_if_fontspec_font: {TF,T,F} {
  \ifcsname zf@family@fontdef\f@family\endcsname
    \prg_return_true:
  \else
    \prg_return_false:
  \fi
}
\prg_new_conditional:Nnn \fontspec_if_aat_feature:nn {TF,T,F} {
  \ifcsname zf@family@fontdef\f@family\endcsname
    \font\zf@basefont="\use:c{zf@family@fontdef\f@family}"~at~\f@size pt
    \ifzf@atsui
      \fontspec_make_AAT_feature_string:nn{#1}{#2}
      \ifx\@tempa\@empty
        \prg_return_false:
      \else
        \prg_return_true:
      \fi
    \else
      \prg_return_false:
    \fi
  \else
    \prg_return_false:
  \fi
}
\prg_new_conditional:Nnn \fontspec_if_opentype: {TF,T,F} {
  \ifcsname zf@family@fontdef\f@family\endcsname
    \font\zf@basefont="\csname zf@family@fontdef\f@family\endcsname"~at~\f@size pt
    \fontspec_set_font_type:
    \ifzf@icu
      \prg_return_true:
    \else
      \prg_return_false:
    \fi
  \else
    \prg_return_false:
  \fi
}
\prg_new_conditional:Nnn \fontspec_if_feature:n {TF,T,F} {
  \ifcsname zf@family@fontdef\f@family\endcsname
    \font\zf@basefont="\csname zf@family@fontdef\f@family\endcsname"~at~\f@size pt
    \fontspec_set_font_type:
    \ifzf@icu
      \int_set:Nn \c@zf@script
        {\use:c {g_fontspec_script_num_(\zf@family)_tl}}
      \int_set:Nn \c@zf@language
        {\use:c {g_fontspec_lang_num_(\zf@family)_tl}}
      \tl_set:Nv \l_fontspec_script_tl {g_fontspec_script_(\zf@family)_tl}
      \tl_set:Nv \l_fontspec_lang_tl   {g_fontspec_lang_(\zf@family)_tl}
      \fontspec_check_ot_feat:nTF {#1} \prg_return_true: \prg_return_false:
    \else
      \prg_return_false:
    \fi
  \else
    \prg_return_false:
  \fi
}
\prg_new_conditional:Nnn \fontspec_if_feature:nnn {TF,T,F} {
  \ifcsname zf@family@fontdef\f@family\endcsname
    \font\zf@basefont="\csname zf@family@fontdef\f@family\endcsname"~at~\f@size pt
    \fontspec_set_font_type:
    \ifzf@icu
      \fontspec_iv_str_to_num:n{#1} \c@zf@script   = \l_fontspec_strnum_int \relax
      \fontspec_iv_str_to_num:n{#2} \c@zf@language = \l_fontspec_strnum_int \relax
      \fontspec_check_ot_feat:nTF {#3} \prg_return_true: \prg_return_false:
    \else
      \prg_return_false:
    \fi
  \else
    \prg_return_false:
  \fi
}
\prg_new_conditional:Nnn \fontspec_if_script:n {TF,T,F} {
  \ifcsname zf@family@fontdef\f@family\endcsname
    \font\zf@basefont="\csname zf@family@fontdef\f@family\endcsname"~at~\f@size pt
    \fontspec_set_font_type:
    \ifzf@icu
      \fontspec_check_script:nTF {#1} \prg_return_true: \prg_return_false:
    \else
      \prg_return_false:
    \fi
  \else
    \prg_return_false:
  \fi
}
\prg_new_conditional:Nnn \fontspec_if_language:n {TF,T,F} {
  \ifcsname zf@family@fontdef\f@family\endcsname
    \font\zf@basefont="\csname zf@family@fontdef\f@family\endcsname"~at~\f@size pt
    \fontspec_set_font_type:
    \ifzf@icu
      \tl_set:Nv \l_fontspec_script_tl {g_fontspec_script_(\zf@family)_tl}
      \int_set:Nn \c@zf@script
        {\use:c {g_fontspec_script_num_(\zf@family)_tl}}
      \fontspec_check_lang:nTF {#1} \prg_return_true: \prg_return_false:
    \else
      \prg_return_false:
    \fi
  \else
    \prg_return_false:
  \fi
}
\prg_new_conditional:Nnn \fontspec_if_language:nn {TF,T,F} {
  \ifcsname zf@family@fontdef\f@family\endcsname
    \font\zf@basefont="\csname zf@family@fontdef\f@family\endcsname"~at~\f@size pt
    \fontspec_set_font_type:
    \ifzf@icu
      \tl_set:Nn \l_fontspec_script_tl {#1}
      \fontspec_iv_str_to_num:n{#1} \c@zf@script   = \l_fontspec_strnum_int \relax
      \fontspec_check_lang:nTF {#2} \prg_return_true: \prg_return_false:
    \else
      \prg_return_false:
    \fi
  \else
    \prg_return_false:
  \fi
}
\prg_new_conditional:Nnn \fontspec_if_current_script:n {TF,T,F} {
  \ifcsname zf@family@fontdef\f@family\endcsname
    \font\zf@basefont="\csname zf@family@fontdef\f@family\endcsname"~at~\f@size pt
    \fontspec_set_font_type:
    \ifzf@icu
      \tl_if_eq:nvTF {#1} {g_fontspec_script_(\zf@family)_tl}
        {\prg_return_true:} {\prg_return_false:}
    \else
      \prg_return_false:
    \fi
  \else
    \prg_return_false:
  \fi
}
\prg_new_conditional:Nnn \fontspec_if_current_language:n {TF,T,F} {
  \ifcsname zf@family@fontdef\f@family\endcsname
    \font\zf@basefont="\csname zf@family@fontdef\f@family\endcsname"~at~\f@size pt
    \fontspec_set_font_type:
    \ifzf@icu
      \tl_if_eq:nvTF {#1} {g_fontspec_lang_(\zf@family)_tl}
        {\prg_return_true:} {\prg_return_false:}
    \else
      \prg_return_false:
    \fi
  \else
    \prg_return_false:
  \fi
}
\cs_generate_variant:Nn \tl_if_eq:nnTF {nv}
\cs_new:Npn \fontspec_set_family:Nnn #1#2#3 {
  \fontspec_select:nn {#2}{#3}
  \tl_set_eq:NN #1 \zf@family
}
\cs_set:Npn \fontspec_select:nn #1#2 {
  \begingroup
  \fontspec_init:
  \edef\zf@fontname{#2}
  \let\zf@family@long\zf@fontname
  \let\zf@up\zf@fontname
  \fontspec_preparse_features:nn {#1}{#2}
  \fontspec_set_scriptlang:
  \fontspec_get_features:n {\zf@font@feat}
  \zf@firsttimefalse
  \fontspec_save_family:nT {#2} {
    \fontspec_info:nxx {defining-font} {#1} {#2}
    \fontspec_save_fontinfo:nn {#1} {#2}
    \DeclareFontFamily{\zf@enc}{\zf@family}{}
    \fontspec_set_upright:
    \fontspec_set_bold:
    \fontspec_set_italic:
    \fontspec_set_slanted:
    \fontspec_set_bold_italic:
    \fontspec_set_bold_slanted:
  }
  \endgroup
}
\cs_set_eq:NN \zf@fontspec \fontspec_select:nn
\cs_new:Npn \fontspec_preparse_features:nn #1#2 {
  \fontspec_if_detect_external:nT {#2}
   { \setkeys[zf]{preparse-external}{ExternalLocation} }
  \fontspec_setkeys:xx {preparse-external} {\zf@default@options #1}
  \let\zf@fontname\zf@up
  \fontspec_setkeys:xx {preparse} {\XKV@rm}
  \let\zf@font@feat\XKV@rm
  \font\zf@basefont="\fontspec_fullname:n {\zf@up}"~at~\f@size pt
  \fontspec_set_font_type:
  \global\font\zf@basefont="\fontspec_fullname:n {\zf@up}"~at~\f@size pt
  \zf@basefont % this is necessary for LuaLaTeX to check the scripts properly
}
\prg_new_conditional:Nnn \fontspec_if_detect_external:n {T}
 {
  \clist_map_inline:Nn \l_fontspec_extensions_clist
   {
    \bool_set_false:N \l_tmpa_bool
    \tl_if_in:nnT {#1 <= end_of_string} {##1 <= end_of_string}
      { \bool_set_true:N \l_tmpa_bool \clist_map_break: }
   }
  \bool_if:NTF \l_tmpa_bool \prg_return_true: \prg_return_false:
 }
\cs_set:Npn \fontspec_fullname:n #1 {
  \fontspec_namewrap:n { #1 \l_fontspec_extension_tl }
  \l_fontspec_renderer_tl
  \l_fontspec_optical_size_tl
}
%% Now we have a unique (in fact, too unique!) string that contains
\prg_new_conditional:Nnn \fontspec_save_family:n {T} {
  \unless\ifcsname zf@UID@\zf@family@long\endcsname
    \ifcsname c@zf@famc@#1\endcsname
      \expandafter\global\expandafter\advance
        \csname c@zf@famc@#1\endcsname\@ne
    \else
      \expandafter\global\expandafter\newcount
        \csname c@zf@famc@#1\endcsname
    \fi
    \edef\@tempa{#1~}
    \cs_gset:cpx{zf@UID@\zf@family@long}{
      \expandafter\zap@space\@tempa\@empty
      (\expandafter\the\csname c@zf@famc@#1\endcsname)
    }
  \fi
  \xdef\zf@family{\@nameuse{zf@UID@\zf@family@long}}
  \cs_if_exist:cTF {zf@family@fontname\zf@family}
    \prg_return_false: \prg_return_true:
}
\cs_new:Npn \fontspec_set_scriptlang: {
  \ifzf@icu
    \tl_if_empty:NTF \l_fontspec_script_name_tl {
      \fontspec_check_script:nTF {latn}
      {
        \tl_set:Nn \l_fontspec_script_name_tl {Latin}
        \tl_set:Nn \l_fontspec_script_tl      {latn}
        \tl_if_empty:NT \l_fontspec_lang_tl {
          \tl_set:Nn \l_fontspec_lang_name_tl {Default}
          \tl_set:Nn \l_fontspec_lang_tl      {DFLT}
        }
        \fontspec_setkeys:xxx {feat} {Script} {\l_fontspec_script_name_tl}
        \fontspec_setkeys:xxx {feat} {Lang}   {\l_fontspec_lang_name_tl}
      }
      {
        \fontspec_info:n {no-scripts}
      }
    }
    {
      \tl_if_empty:NT \l_fontspec_lang_tl {
        \tl_set:Nn \l_fontspec_lang_name_tl {Default}
        \tl_set:Nn \l_fontspec_lang_tl      {DFLT}
      }
      \fontspec_setkeys:xxx {feat} {Script} {\l_fontspec_script_name_tl}
      \fontspec_setkeys:xxx {feat} {Lang}   {\l_fontspec_lang_name_tl}
    }
  \fi
}
\cs_new:Npn \fontspec_save_fontinfo:nn #1#2 {
    \tl_gset:cx {zf@family@fontname\zf@family} {#2}
    \tl_gset:cx {zf@family@options\zf@family} {\zf@default@options #1}
    \tl_gset:cx {zf@family@fontdef\zf@family} {
      \fontspec_fullname:n {\zf@fontname} : \l_fontspec_pre_feat_tl \l_fontspec_rawfeatures_sclist
    }
    \tl_gset:cx {g_fontspec_script_num_(\zf@family)_tl}
      { \int_use:N \c@zf@script   }
    \tl_gset:cx {g_fontspec_lang_num_(\zf@family)_tl}
      { \int_use:N \c@zf@language }
    \tl_gset_eq:cN {g_fontspec_script_(\zf@family)_tl} \l_fontspec_script_tl
    \tl_gset_eq:cN {g_fontspec_lang_(\zf@family)_tl}   \l_fontspec_lang_tl
}
\cs_new:Npn \fontspec_set_upright: {
  \zf@make@font@shapes{\zf@fontname}
    {\mddefault}{\updefault}{\zf@font@feat\zf@up@feat}
}
\cs_new:Npn \fontspec_set_bold: {
  \unless\ifzf@nobf
    \ifx\zf@bf\@empty
      \zf@make@font@shapes[\zf@fontname]{/B}
        {\bfdefault}{\updefault}{\zf@font@feat\zf@bf@feat}
    \else
      \zf@make@font@shapes{\zf@bf}
        {\bfdefault}{\updefault}{\zf@font@feat\zf@bf@feat}
    \fi
  \fi
}
\cs_new:Npn \fontspec_set_italic: {
  \unless\ifzf@noit
    \ifx\zf@it\@empty
      \zf@make@font@shapes[\zf@fontname]{/I}
        {\mddefault}{\itdefault}{\zf@font@feat\zf@it@feat}
    \else
      \zf@make@font@shapes{\zf@it}
        {\mddefault}{\itdefault}{\zf@font@feat\zf@it@feat}
    \fi
  \fi
}
\cs_new:Npn \fontspec_set_slanted: {
  \ifx\zf@sl\@empty\else
    \zf@make@font@shapes{\zf@sl}
      {\mddefault}{\sldefault}{\zf@font@feat\zf@sl@feat}
  \fi
}
\cs_new:Npn \fontspec_set_bold_italic: {
  \@tempswatrue
  \ifzf@nobf\@tempswafalse\fi
  \ifzf@noit\@tempswafalse\fi
  \bool_if:NT \l_fontspec_external_bool \@tempswafalse
  \if@tempswa
    \ifx\zf@bfit\@empty
      \ifx\zf@bf\@empty
        \ifx\zf@it\@empty
          \zf@make@font@shapes[\zf@fontname]{/BI}
            {\bfdefault}{\itdefault}{\zf@font@feat\zf@bfit@feat}
        \else
          \zf@make@font@shapes[\zf@it]{/B}
            {\bfdefault}{\itdefault}{\zf@font@feat\zf@bfit@feat}
        \fi
      \else
        \zf@make@font@shapes[\zf@bf]{/I}
          {\bfdefault}{\itdefault}{\zf@font@feat\zf@bfit@feat}
      \fi
    \else
      \zf@make@font@shapes{\zf@bfit}
        {\bfdefault}{\itdefault}{\zf@font@feat\zf@bfit@feat}
    \fi
  \fi
}
\cs_new:Npn \fontspec_set_bold_slanted: {
  \ifx\zf@bfsl\@empty
    \ifx\zf@sl\@empty\else
      \zf@make@font@shapes[\zf@sl]{/B}
        {\bfdefault}{\sldefault}{\zf@font@feat\zf@bfsl@feat}
    \fi
  \else
    \zf@make@font@shapes{\zf@bfsl}
      {\bfdefault}{\sldefault}{\zf@font@feat\zf@bfsl@feat}
  \fi
}
\xetex_or_luatex:nnn { \cs_new:Npn \fontspec_set_font_type: }
   {
    \zf@tfmfalse \zf@atsuifalse \zf@icufalse \zf@mmfalse \zf@graphitefalse
    \ifcase\XeTeXfonttype\zf@basefont
      \zf@tfmtrue
    \or
      \zf@atsuitrue
      \ifnum\XeTeXcountvariations\zf@basefont > \c_zero
        \zf@mmtrue
      \fi
    \or
      \zf@icutrue
    \fi
    \tl_if_empty:NT \l_fontspec_renderer_tl {
      \ifzf@atsui
        \tl_set:Nn \l_fontspec_renderer_tl {/AAT}
      \else\ifzf@icu
        \tl_set:Nn \l_fontspec_renderer_tl {/ICU}
      \fi\fi
    }
  }
  {
    \zf@icutrue
  }
\newcommand*\zf@make@font@shapes[5][]{
  \begingroup
    \edef\@tempa{#1}
    \unless\ifx\@tempa\@empty
      \font\@tempfonta="\fontspec_fullname:n {#1}"~at~\f@size pt
      \edef\@tempa{\fontname\@tempfonta}
    \fi
    \font\@tempfontb="\fontspec_fullname:n {#1#2}"~at~\f@size pt
    \edef\@tempb{\fontname\@tempfontb}
    \ifx\@tempa\@tempb
      \fontspec_info:nx {no-font-shape} {#1#2}
    \else
      \edef\zf@fontname{#1#2}
      \let\zf@basefont\@tempfontb
      \fontspec_declare_shape:nnnn {}{#3}{#4}{#5}
      \ifx\zf@sc\@empty
        \unless\ifzf@nosc
          \zf@make@smallcaps
          \unless\ifx\zf@smallcaps\@empty
            \fontspec_declare_shape:nnnn {\zf@smallcaps}{#3}
              {\ifx#4\itdefault\sidefault\else\scdefault\fi}{#5\zf@sc@feat}
          \fi
        \fi
      \else
        \edef\zf@fontname{\zf@sc}
        \fontspec_declare_shape:nnnn {}{#3}
          {\ifx#4\itdefault\sidefault\else\scdefault\fi}{#5\zf@sc@feat}
      \fi
    \fi
  \endgroup
}
\cs_new:Npn \fontspec_declare_shape:nnnn #1#2#3#4 {
  \clist_if_empty:NTF \l_fontspec_sizefeat_clist
  {
    \fontspec_get_features:n{#4}
    \tl_set:Nx \l_fontspec_nfss_tl {
      <-> \l_fontspec_scale_tl "
      \fontspec_fullname:n {\zf@fontname} :
        \l_fontspec_pre_feat_tl \l_fontspec_rawfeatures_sclist #1 "
    }
  }
  {
    \tl_clear:N \l_fontspec_nfss_tl
    \clist_map_inline:Nn \l_fontspec_sizefeat_clist {
      \tl_clear:N \l_fontspec_size_tl
      \tl_set_eq:NN \l_fontspec_sizedfont_tl \zf@fontname
      \fontspec_setkeys:xx {sizing} { \expandafter \@firstofone ##1 }
      \tl_if_empty:NT \l_fontspec_size_tl { \fontspec_error:n {no-size-info} }
      \fontspec_get_features:n{#4,\XKV@rm}
      \tl_put_right:Nx \l_fontspec_nfss_tl {
        <\l_fontspec_size_tl> \l_fontspec_scale_tl
        " \fontspec_fullname:n { \l_fontspec_sizedfont_tl }
          : \l_fontspec_pre_feat_tl \l_fontspec_rawfeatures_sclist #1 "
      }
    }
  }
  \PackageInfo{fontspec}{
    Defining~ shape~ #2/#3~ with~ raw~ font~ features:
    \MessageBreak \l_fontspec_rawfeatures_sclist
  \@gobble}
  \use:x{
    \exp_not:N\DeclareFontShape{\zf@enc}{\zf@family}{#2}{#3}
      {\l_fontspec_nfss_tl}{\zf@adjust}
  }
  \tl_if_eq:xxT {#3} {\itdefault}
  {
    \use:x {
      \exp_not:N \DeclareFontShape {\zf@enc}{\zf@family}{#2}{\sldefault}
        {<->ssub*\zf@family/#2/\itdefault}{\zf@adjust}
    }
  }
}
\xetex_or_luatex:nnn { \tl_set:Nn \l_fontspec_pre_feat_tl }
  {
    \ifzf@icu
      \tl_if_empty:NF \l_fontspec_script_tl
      {
        script   = \l_fontspec_script_tl ;
        language = \l_fontspec_lang_tl   ;
      }
    \fi
  }
  {
    mode     = \l_fontspec_mode_tl   ;
    \tl_if_empty:NF \l_fontspec_script_tl
    {
      script   = \l_fontspec_script_tl ;
      language = \l_fontspec_lang_tl   ;
    }
  }
\newcommand*{\zf@update@family}[1]{
  \ifzf@firsttime
    \xdef\zf@family@long{\zf@family@long#1}
  \fi
}
\cs_set:Npn \fontspec_get_features:n #1 {
  \let\l_fontspec_rawfeatures_sclist     \@empty
  \tl_clear:N \l_fontspec_scale_tl
  \let\zf@adjust \@empty
  \fontspec_setkeys:xx {options} {#1}
  \tl_if_empty:NF \XKV@rm {
    \fontspec_error:nx {unknown-options} { \exp_not:V \XKV@rm }
  }
  \cs_if_exist:NT \l_fontspec_hexcol_tl {
    \zf@update@ff{color=\l_fontspec_hexcol_tl\l_fontspec_opacity_tl}
  }
}
\tl_clear:N \zf@bf
\tl_clear:N \zf@it
\tl_clear:N \zf@fake@slant
\tl_clear:N \zf@fake@embolden
\tl_clear:N \zf@bfit
\tl_clear:N \zf@sl
\tl_clear:N \zf@bfsl
\tl_clear:N \zf@sc
\tl_clear:N \zf@up@feat
\tl_clear:N \zf@bf@feat
\tl_clear:N \zf@it@feat
\tl_clear:N \zf@bfit@feat
\tl_clear:N \zf@sl@feat
\tl_clear:N \zf@bfsl@feat
\tl_clear:N \zf@sc@feat
\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
\clist_clear:N \l_fontspec_sizefeat_clist
\tl_set:Nn \l_fontspec_opacity_tl {FF}
\newcommand*\fontspec_init:{
  \zf@icufalse
  \zf@firsttimetrue
  \xetex_or_luatex:nnn { \cs_set:Npn \fontspec_namewrap:n ##1 }
    { ##1 }
    { name:##1 }
  \tl_clear:N \l_fontspec_optical_size_tl
  \tl_clear:N \l_fontspec_renderer_tl
  \luatex_if_engine:T {
    \tl_set:Nn \l_fontspec_mode_tl {node}
    \luatexprehyphenchar   =`\-  % fixme
    \luatexposthyphenchar  = 0   % fixme
    \luatexpreexhyphenchar = 0   % fixme
    \luatexpostexhyphenchar= 0   % fixme
  }
}
\newcommand*\zf@make@smallcaps{
  \let\zf@smallcaps\@empty
  \xetex_or_luatex:nn
  {
    \ifzf@atsui
      \fontspec_make_AAT_feature_string:nn{3}{3}
      \unless\ifx\@tempa\@empty
        \edef\zf@smallcaps{\@tempa;}
      \fi
    \fi
    \ifzf@icu
      \fontspec_check_ot_feat:nT {+smcp} {\edef\zf@smallcaps{+smcp;}}
    \fi
  }
  {
    \fontspec_check_ot_feat:nT {+smcp} {\edef\zf@smallcaps{+smcp;}}
  }
}
\cs_new:Npn \sclist_put_right:Nn #1#2 {
  \tl_if_empty:NTF #1 {
    \tl_set:Nn #1 {#2}
  }{
    \tl_put_right:Nn #1 {;#2}
  }
}
\newcommand*\zf@update@ff[1]{
  \unless\ifzf@firsttime
    \xdef\l_fontspec_rawfeatures_sclist{\l_fontspec_rawfeatures_sclist #1;}
  \fi
}
\cs_new:Npn \fontspec_make_feature:nnn #1#2#3 {
  \xetex_or_luatex:nn
  {
    \ifzf@atsui
      \fontspec_make_AAT_feature:nn {#1}{#2}
    \fi
    \ifzf@icu
      \fontspec_make_ICU_feature:n {#3}
    \fi
  }
  {
    \fontspec_make_ICU_feature:n {#3}
  }
}
\cs_generate_variant:Nn \fontspec_make_feature:nnn {nnx}
\cs_new:Npn \fontspec_make_AAT_feature:nn #1#2 {
  \tl_if_empty:nTF {#1}
  {
    \fontspec_warning:n {aat-feature-not-exist}
  }
  {
    \fontspec_make_AAT_feature_string:nn {#1}{#2}
    \ifx\@tempa\@empty
      \fontspec_warning:nx {aat-feature-not-exist-in-font} {#1,#2}
    \else
      \zf@update@family{+#1,#2}
      \zf@update@ff\@tempa
    \fi
  }
}
\cs_new:Npn \fontspec_make_ICU_feature:n #1 {
  \tl_if_empty:nTF {#1}
  {
    \fontspec_warning:n {icu-feature-not-exist}
  }
  {
    \fontspec_check_ot_feat:nTF {#1} {
      \zf@update@family{#1}
      \zf@update@ff{#1}
    }{
      \fontspec_warning:nx {icu-feature-not-exist-in-font} {#1}
    }
  }
}
\newcommand*\zf@define@font@feature[1]{
  \define@key[zf]{options}{#1}{{\setkeys[zf@feat]{#1}{##1}}}
}
\newcommand*\zf@define@feature@option[5]{
  \define@key[zf@feat]{#1}{#2}[]{\fontspec_make_feature:nnn{#3}{#4}{#5}}
}
\newcommand*\keyval@alias@key[4][KV]{
  \cs_set_eq:cc{#1@#2@#4}{#1@#2@#3}
  \cs_set_eq:cc{#1@#2@#4@default}{#1@#2@#3@default}
}
\newcommand*\multi@alias@key[2]{
  \key@ifundefined[zf]{options}{#1}
    {
      \key@ifundefined[zf]{preparse}{#1}
      {
        \key@ifundefined[zf]{preparse-external}{#1}
          { \fontspec_warning:nx {rename-feature-not-exist} {#1} }
          { \keyval@alias@key[zf]{preparse-external}{#1}{#2} }
      }
      { \keyval@alias@key[zf]{preparse}{#1}{#2} }
    }
    { \keyval@alias@key[zf]{options}{#1}{#2} }
}
\cs_new:Npn \fontspec_make_AAT_feature_string:nn #1#2 {
  \edef\@tempa{\XeTeXfeaturename\zf@basefont #1}
  \unless\ifx\@tempa\@empty
    \ifnum\XeTeXisexclusivefeature\zf@basefont #1>0
      \edef\@tempb{\XeTeXselectorname\zf@basefont #1\space #2}
    \else
      \unless\ifodd #2
        \edef\@tempb{\XeTeXselectorname\zf@basefont #1\space #2}
      \else
        \edef\@tempb{
          \XeTeXselectorname\zf@basefont #1\space \numexpr#2-1\relax
        }
        \unless\ifx\@tempb\@empty
          \edef\@tempb{!\@tempb}
        \fi
      \fi
    \fi
    \unless\ifx\@tempb\@empty
      \edef\@tempa{\@tempa=\@tempb}
    \else
      \let\@tempa\@empty
    \fi
  \fi
}
\cs_set:Npn \fontspec_iv_str_to_num:n #1 {
  \fontspec_iv_str_to_num:w #1 \@empty \@empty \q_nil
}
\cs_set:Npn \fontspec_iv_str_to_num:w #1#2#3#4#5 \q_nil {
  \int_set:Nn \l_fontspec_strnum_int {
      `#1 * "1000000
    + `#2 * "10000
    + \ifx \@empty #3 32 \else `#3 \fi * "100
    + \ifx \@empty #4 32 \else `#4 \fi
  }
}
\cs_set:Npn \fontspec_v_str_to_num:n #1 {
  \bool_if:nTF
    {
      \tl_if_head_eq_charcode_p:nN {#1} {+} ||
      \tl_if_head_eq_charcode_p:nN {#1} {-}
    }
    {
      \exp_after:wN \fontspec_iv_str_to_num:n
      \exp_after:wN { \use_none:n #1 }
    }
    { \fontspec_iv_str_to_num:n {#1} }
}
\xetex_or_luatex:nnn {\prg_new_conditional:Nnn \fontspec_check_script:n {TF}}
  {
    \fontspec_iv_str_to_num:n{#1}
    \@tempcntb\XeTeXOTcountscripts\zf@basefont
    \c@zf@index\z@ \@tempswafalse
    \loop\ifnum\c@zf@index<\@tempcntb
      \ifnum\XeTeXOTscripttag\zf@basefont\c@zf@index=\l_fontspec_strnum_int
        \@tempswatrue
        \c@zf@index\@tempcntb
      \else
        \advance\c@zf@index\@ne
      \fi
    \repeat
    \if@tempswa \prg_return_true: \else: \prg_return_false: \fi:
  }
  {
    \directlua{fontspec.check_ot_script("zf@basefont", "#1")}
    \if@tempswa \prg_return_true: \else: \prg_return_false: \fi:
  }
\xetex_or_luatex:nnn {\prg_new_conditional:Nnn \fontspec_check_lang:n {TF}}
  {
    \fontspec_iv_str_to_num:n{#1}
    \@tempcntb\XeTeXOTcountlanguages\zf@basefont\c@zf@script
    \c@zf@index\z@
    \@tempswafalse
    \loop\ifnum\c@zf@index<\@tempcntb
      \ifnum\XeTeXOTlanguagetag\zf@basefont\c@zf@script\c@zf@index=\l_fontspec_strnum_int
        \@tempswatrue
        \c@zf@index\@tempcntb
      \else
        \advance\c@zf@index\@ne
      \fi
    \repeat
    \if@tempswa \prg_return_true: \else: \prg_return_false: \fi:
  }
  {
    \directlua{
      fontspec.check_ot_lang( "zf@basefont", "#1", "\l_fontspec_script_tl" )
    }
    \if@tempswa \prg_return_true: \else: \prg_return_false: \fi:
  }
\xetex_or_luatex:nnn
   { \prg_new_conditional:Nnn \fontspec_check_ot_feat:n {TF,T} }
   {
    \@tempcntb\XeTeXOTcountfeatures\zf@basefont\c@zf@script\c@zf@language
    \fontspec_v_str_to_num:n {#1}
    \c@zf@index\z@
    \@tempswafalse
    \loop\ifnum\c@zf@index<\@tempcntb
      \ifnum\XeTeXOTfeaturetag\zf@basefont\c@zf@script\c@zf@language
            \c@zf@index=\l_fontspec_strnum_int
        \@tempswatrue
        \c@zf@index\@tempcntb
      \else
        \advance\c@zf@index\@ne
      \fi
    \repeat
    \if@tempswa \prg_return_true: \else: \prg_return_false: \fi:
  }
  {
    \directlua{
      fontspec.check_ot_feat(
                              "zf@basefont", "#1",
                              "\l_fontspec_lang_tl", "\l_fontspec_script_tl"
                            )
    }
    \if@tempswa \prg_return_true: \else: \prg_return_false: \fi:
  }
\bool_new:N \l_fontspec_external_bool
\define@key[zf]{preparse-external}{ExternalLocation}[]{
  \zf@nobftrue
  \zf@noittrue
  \bool_set_true:N \l_fontspec_external_bool
  \xetex_or_luatex:nnn { \cs_gset:Npn \fontspec_namewrap:n ##1 }
    {     [ #1 ##1 ] }
    { file: #1 ##1   }
  \xetex_if_engine:T { \setkeys[zf]{preparse}{Renderer=ICU} }
}
\aliasfontfeature{ExternalLocation}{Path}
\define@key[zf]{preparse-external}{Extension}{
  \tl_set:Nn \l_fontspec_extension_tl {#1}
  \bool_if:NF \l_fontspec_external_bool {
    \setkeys*[zf]{preparse-external}{ExternalLocation}
  }
}
\tl_clear:N \l_fontspec_extension_tl
\define@choicekey[zf]{preparse}{Renderer}[\l_tmpa_tl\l_tmpa_num]
    {AAT,ICU,Graphite,Full,Basic}{
  \zf@update@family{+rend:#1}
  \intexpr_compare:nTF {\l_tmpa_num < 3} {
    \xetex_or_luatex:nn
    {
      \tl_set:Nv \l_fontspec_renderer_tl {g_fontspec_renderer_tag_\l_tmpa_tl}
    }
    {
      \fontspec_warning:nx {only-xetex-feature} {Renderer=AAT/ICU/Graphite}
    }
  }{
    \xetex_or_luatex:nn
    { \fontspec_warning:nx {only-luatex-feature} {Renderer=Full/Basic} }
    { \tl_set:Nv \l_fontspec_mode_tl {g_fontspec_mode_tag_\l_tmpa_tl}  }
  }
}
\tl_set:cn {g_fontspec_renderer_tag_AAT} {/AAT}
\tl_set:cn {g_fontspec_renderer_tag_ICU} {/ICU}
\tl_set:cn {g_fontspec_renderer_tag_Graphite} {/GR}
\tl_set:cn {g_fontspec_mode_tag_Full}  {node}
\tl_set:cn {g_fontspec_mode_tag_Basic} {base}
\define@key[zf]{preparse}{Script}{
  \xetex_if_engine:T { \setkeys[zf]{preparse}{Renderer=ICU} }
  \tl_set:Nn \l_fontspec_script_name_tl {#1}
  \zf@update@family{+script:#1}
}
\define@key[zf]{preparse}{Language}{
  \xetex_if_engine:T { \setkeys[zf]{preparse}{Renderer=ICU} }
  \tl_set:Nn \l_fontspec_lang_name_tl {#1}
  \zf@update@family{+language:#1}
}
\define@key[zf]{preparse-external}{UprightFont}{
  \fontspec_complete_fontname:Nn \zf@up {#1}
  \zf@update@family{up:#1}
}
\define@key[zf]{preparse-external}{BoldFont}{
  \edef\@tempa{#1}
  \ifx\@tempa\@empty
    \zf@nobftrue
    \zf@update@family{nobf}
  \else
    \zf@nobffalse
    \fontspec_complete_fontname:Nn \zf@bf {#1}
    \zf@update@family{bf:#1}
  \fi
}
\define@key[zf]{preparse-external}{ItalicFont}{
  \edef\@tempa{#1}
  \ifx\@tempa\@empty
    \zf@noittrue
    \zf@update@family{noit}
  \else
    \zf@noitfalse
    \fontspec_complete_fontname:Nn \zf@it {#1}
    \zf@update@family{it:#1}
  \fi
}
\define@key[zf]{preparse-external}{BoldItalicFont}{
  \fontspec_complete_fontname:Nn \zf@bfit {#1}
  \zf@update@family{bfit:#1}
}
\define@key[zf]{preparse-external}{SlantedFont}{
  \fontspec_complete_fontname:Nn \zf@sl {#1}
  \zf@update@family{sl:#1}
}
\define@key[zf]{preparse-external}{BoldSlantedFont}{
  \fontspec_complete_fontname:Nn \zf@bfsl {#1}
  \zf@update@family{bfsl:#1}
}
\define@key[zf]{options}{SmallCapsFont}{
  \edef\@tempa{#1}
  \ifx\@tempa\@empty
    \zf@nosctrue
    \zf@update@family{nosc}
  \else
    \zf@noscfalse
    \fontspec_complete_fontname:Nn \zf@sc {#1}
    \zf@update@family{sc:\zap@space #1~\@empty}
  \fi
}
\cs_set:Npn \fontspec_complete_fontname:Nn #1#2 {
  \tl_set:Nn #1 {#2}
  \tl_replace_all_in:Nnx #1 {*} {\zf@fontname}
}
\cs_generate_variant:Nn \tl_replace_all_in:Nnn {Nnx}
\define@key[zf]{preparse}{UprightFeatures}{
  \def\zf@up@feat{, #1}
  \zf@update@family{rmfeat:#1}
}
\define@key[zf]{preparse}{BoldFeatures}{
  \def\zf@bf@feat{, #1}
  \zf@update@family{bffeat:#1}
}
\define@key[zf]{preparse}{ItalicFeatures}{
  \def\zf@it@feat{, #1}
  \zf@update@family{itfeat:#1}
}
\define@key[zf]{preparse}{BoldItalicFeatures}{
  \def\zf@bfit@feat{, #1}
  \zf@update@family{bfitfeat:#1}
}
\define@key[zf]{preparse}{SlantedFeatures}{
  \def\zf@sl@feat{, #1}
  \zf@update@family{slfeat:#1}
}
\define@key[zf]{preparse}{BoldSlantedFeatures}{
  \def\zf@bfsl@feat{, #1}
  \zf@update@family{bfslfeat:#1}
}
\define@key[zf]{options}{SmallCapsFeatures}{
  \unless\ifzf@firsttime\def\zf@sc@feat{, #1}\fi
  \zf@update@family{scfeat:\zap@space #1~\@empty}
}
\define@key[zf]{preparse}{SizeFeatures}{
  \tl_set:Nn \l_fontspec_sizefeat_clist {#1}
  \zf@update@family{sizefeat:\zap@space #1~\@empty}
}
\define@key[zf]{sizing}{Size}{ \tl_set:Nn \l_fontspec_size_tl {#1} }
\define@key[zf]{sizing}{Font}{
  \fontspec_complete_fontname:Nn \l_fontspec_sizedfont_tl {#1}
}
\define@key[zf]{options}{Scale}{
  \prg_case_str:nnn {#1}
  {
    {MatchLowercase} { \fontspec_calc_scale:n {5} }
    {MatchUppercase} { \fontspec_calc_scale:n {8} }
  }
  { \tl_set:Nx \l_fontspec_scale_tl {#1} }
  \zf@update@family{+scale:\l_fontspec_scale_tl}
  \tl_set:Nx \l_fontspec_scale_tl { s*[\l_fontspec_scale_tl] }
}
\cs_new:Npn \fontspec_calc_scale:n #1 {
  \group_begin:
    \rmfamily
    \fontspec_set_font_dimen:NnN \@tempdima {#1} \font
    \fontspec_set_font_dimen:NnN \@tempdimb {#1} \zf@basefont
    \dim_set:Nn \@tempdimc { 1pt*\@tempdima/\@tempdimb }
    \tl_gset:Nx \l_fontspec_scale_tl {\strip@pt\@tempdimc}
    \fontspec_info:n {set-scale}
  \group_end:
}
\cs_new:Npn \fontspec_set_font_dimen:NnN #1#2#3
{
  \dim_set:Nn #1 { \fontdimen #2 #3 }
  \dim_compare:nNnT #1 = {0pt} {
    \settoheight #1 {
      \tl_if_eq:nnTF {#3} {\font} \rmfamily #3
      \prg_case_int:nnn #2 {
        {5} {x} % x-height
        {8} {X} % cap-height
      } {?} % "else" clause; never reached.
    }
  }
}
\define@key[zf]{options}{WordSpace}{
  \zf@update@family{+wordspace:#1}
  \unless\ifzf@firsttime
    \zf@wordspace@parse#1,\zf@@ii,\zf@@iii,\zf@@
  \fi
}
\def\zf@wordspace@parse#1,#2,#3,#4\zf@@{
  \def\@tempa{#4}
  \ifx\@tempa\@empty
    \setlength\@tempdima{#1\fontdimen2\zf@basefont}
    \@tempdimb\@tempdima
    \@tempdimc\@tempdima
  \else
    \setlength\@tempdima{#1\fontdimen2\zf@basefont}
    \setlength\@tempdimb{#2\fontdimen3\zf@basefont}
    \setlength\@tempdimc{#3\fontdimen4\zf@basefont}
  \fi
  \edef\zf@adjust{
    \zf@adjust
    \fontdimen2\font\the\@tempdima
    \fontdimen3\font\the\@tempdimb
    \fontdimen4\font\the\@tempdimc
  }
}
\define@key[zf]{options}{PunctuationSpace}{
  \zf@update@family{+punctspace:#1}
  \setlength\@tempdima{#1\fontdimen7\zf@basefont}
  \edef\zf@adjust{\zf@adjust\fontdimen7\font\the\@tempdima}
}
\define@key[zf]{options}{LetterSpace}{
  \zf@update@family{+tracking:#1}
  \zf@update@ff{letterspace=#1}
}
\define@key[zf]{options}{HyphenChar}{
  \zf@update@family{+hyphenchar:#1}
  \edef\@tempa{#1}
  \edef\@tempb{None}
  \ifx\@tempa\@tempb
    \xetex_or_luatex:nnn { \g@addto@macro\zf@adjust }
      { \hyphenchar\font-1\relax }
      { \luatexprehyphenchar=-1\relax }
  \else
    \zf@check@one@char#1\zf@@
    \ifx\@tempb\@empty
      \xetex_or_luatex:nn {
        {\zf@basefont\expandafter\ifnum\expandafter\XeTeXcharglyph
              \expandafter`#1 > \z@
           \g@addto@macro\zf@adjust{%
             {\expandafter\hyphenchar\expandafter
              \font\expandafter`#1}}%
        \else
          \fontspec_error:nx {no-glyph}{#1}
        \fi}%
      }{
        \ifnum\directlua{
            fontspec.sprint(fontspec.charglyph('#1', 'zf@basefont'))
        } > \z@
          \g@addto@macro\zf@adjust{\luatexprehyphenchar=`#1\relax}
        \else
          \fontspec_error:nx {no-glyph}{#1}
        \fi
      }
    \else
      \xetex_or_luatex:nn {
        {\zf@basefont\ifnum\XeTeXcharglyph#1 > \z@
          \g@addto@macro\zf@adjust{\hyphenchar\font#1\relax}%
        \else
          \fontspec_error:nx {no-glyph}{#1}
        \fi}%
      }{
        \ifnum\directlua{
            fontspec.sprint(fontspec.charglyph('#1', 'zf@basefont'))
        } > \z@
          \g@addto@macro\zf@adjust{\luatexprehyphenchar=#1\relax}
        \else
          \fontspec_error:nx {no-glyph}{#1}
        \fi
      }
    \fi
  \fi
}
\def\zf@check@one@char#1#2\zf@@{\def\@tempb{#2}}
\define@key[zf]{options}{Color}{
  \zf@update@family{+col:#1}
  \cs_if_exist:cTF {\token_to_str:N\color@#1}
  {
    \convertcolorspec{named}{#1}{HTML}\l_fontspec_hexcol_tl
  }
  {
    \tl_set:Nn \l_fontspec_hexcol_tl {#1}
  }
}
\keyval@alias@key[zf]{options}{Color}{Colour}
\newcounter{fontspec_tmp_int}
\define@key[zf]{options}{Opacity}{
  \zf@update@family{+opac:#1}
  \setcounter {fontspec_tmp_int} { 255*\real{#1} }
  \tl_set:Nx \l_fontspec_opacity_tl {
    \nhex2 { \value{fontspec_tmp_int} }
  }
}
\xetex_or_luatex:nnn {
  \define@key[zf]{options}{Mapping}
}{
  \zf@update@family{+map:#1}
  \zf@update@ff{mapping=#1}
}{
  \tl_if_eq:nnTF {#1} {tex-text} {
    \fontspec_warning:n {no-mapping-ligtex}
    \msg_redirect_name:nnn {fontspec} {no-mapping-ligtex} {none}
    \setkeys[zf]{options}{ Ligatures=TeX }
  }{
    \fontspec_warning:n {no-mapping}
  }
}
\define@key[zf]{options}{FeatureFile}{
  \zf@update@family{+fea:#1}
  \zf@update@ff{featurefile=#1}
}
\define@key[zf]{options}{Weight}{
  \zf@update@family{+weight:#1}
  \zf@update@ff{weight=#1}
}
\define@key[zf]{options}{Width}{
  \zf@update@family{+width:#1}
  \zf@update@ff{width=#1}
}
\define@key[zf]{options}{OpticalSize}{
  \xetex_or_luatex:nn {
    \ifzf@icu
      \tl_set:Nn \l_fontspec_optical_size_tl {/ S = #1}
      \zf@update@family{+size:#1}
    \fi
    \ifzf@mm
      \zf@update@family{+size:#1}
      \zf@update@ff{optical size=#1}
    \fi
    \ifzf@icu\else
      \ifzf@mm\else
        \ifzf@firsttime
          \fontspec_warning:n {no-opticals}
        \fi
      \fi
    \fi
  }{
    \tl_set:Nn \l_fontspec_optical_size_tl {/ S = #1}
    \zf@update@family{+size:#1}
  }
}
\define@key[zf]{options}{FakeSlant}[0.2]{
  \zf@update@family{+slant:#1}
  \zf@update@ff{slant=#1}
}
\define@key[zf]{options}{FakeStretch}[1.2]{
  \zf@update@family{+extend:#1}
  \zf@update@ff{extend=#1}
}
\define@key[zf]{options}{FakeBold}[1.5]{
  \zf@update@family{+embolden:#1}
  \zf@update@ff{embolden=#1}
}
\define@key[zf]{options}{AutoFakeSlant}[0.2]{
  \ifzf@firsttime
    \tl_set:Nn \zf@fake@slant {#1}
    \tl_put_right:Nn \zf@it@feat {,FakeSlant=#1}
    \tl_set_eq:NN \zf@it \zf@fontname
    \zf@update@family{fakeit:#1}
    \tl_if_empty:NF \zf@fake@embolden {
      \tl_put_right:Nx \zf@bfit@feat
        {,FakeBold=\zf@fake@embolden,FakeSlant=#1}
      \tl_set_eq:NN \zf@bfit \zf@fontname
    }
  \fi
}
\define@key[zf]{options}{AutoFakeBold}[1.5]{
  \ifzf@firsttime
    \tl_set:Nn \zf@fake@embolden {#1}
    \tl_put_right:Nn \zf@bf@feat {,FakeBold=#1}
    \tl_set_eq:NN \zf@bf \zf@fontname
    \zf@update@family{fakebf:#1}
    \tl_if_empty:NF \zf@fake@slant {
      \tl_put_right:Nx \zf@bfit@feat
        {,FakeSlant=\zf@fake@slant,FakeBold=#1}
      \tl_set_eq:NN \zf@bfit \zf@fontname
    }
  \fi
}
\zf@define@font@feature{Ligatures}
\zf@define@feature@option{Ligatures}{Required}       {1}{0}{+rlig}
\zf@define@feature@option{Ligatures}{NoRequired}     {1}{1}{-rlig}
\zf@define@feature@option{Ligatures}{Common}         {1}{2}{+liga}
\zf@define@feature@option{Ligatures}{NoCommon}       {1}{3}{-liga}
\zf@define@feature@option{Ligatures}{Rare}           {1}{4}{+dlig}
\zf@define@feature@option{Ligatures}{NoRare}         {1}{5}{-dlig}
\zf@define@feature@option{Ligatures}{Discretionary}  {1}{4}{+dlig}
\zf@define@feature@option{Ligatures}{NoDiscretionary}{1}{5}{-dlig}
\zf@define@feature@option{Ligatures}{Contextual}     {}{}  {+clig}
\zf@define@feature@option{Ligatures}{NoContextual}   {}{}  {-clig}
\zf@define@feature@option{Ligatures}{Historical}     {}{}  {+hlig}
\zf@define@feature@option{Ligatures}{NoHistorical}   {}{}  {-hlig}
\zf@define@feature@option{Ligatures}{Logos}          {1}{6} {}
\zf@define@feature@option{Ligatures}{NoLogos}        {1}{7} {}
\zf@define@feature@option{Ligatures}{Rebus}          {1}{8} {}
\zf@define@feature@option{Ligatures}{NoRebus}        {1}{9} {}
\zf@define@feature@option{Ligatures}{Diphthong}      {1}{10}{}
\zf@define@feature@option{Ligatures}{NoDiphthong}    {1}{11}{}
\zf@define@feature@option{Ligatures}{Squared}        {1}{12}{}
\zf@define@feature@option{Ligatures}{NoSquared}      {1}{13}{}
\zf@define@feature@option{Ligatures}{AbbrevSquared}  {1}{14}{}
\zf@define@feature@option{Ligatures}{NoAbbrevSquared}{1}{15}{}
\zf@define@feature@option{Ligatures}{Icelandic}      {1}{32}{}
\zf@define@feature@option{Ligatures}{NoIcelandic}    {1}{33}{}
\define@key[zf@feat]{Ligatures}{TeX}[]{
  \xetex_or_luatex:nn {
    \zf@update@family{+map:tex-text}
    \zf@update@ff{mapping=tex-text}
  }{
    \zf@update@family{+tlig+trep}
    \zf@update@ff{+tlig;+trep}
  }
}
\zf@define@font@feature{Letters}
\zf@define@feature@option{Letters}{Normal}             {3}{0}{}
\zf@define@feature@option{Letters}{Uppercase}          {3}{1}{+case}
\zf@define@feature@option{Letters}{Lowercase}          {3}{2}{}
\zf@define@feature@option{Letters}{SmallCaps}          {3}{3}{+smcp}
\zf@define@feature@option{Letters}{PetiteCaps}         {} {} {+pcap}
\zf@define@feature@option{Letters}{UppercaseSmallCaps} {} {} {+c2sc}
\zf@define@feature@option{Letters}{UppercasePetiteCaps}{} {} {+c2pc}
\zf@define@feature@option{Letters}{InitialCaps}        {3}{4}{}
\zf@define@feature@option{Letters}{Unicase}            {} {} {+unic}
\zf@define@font@feature{Numbers}
\zf@define@feature@option{Numbers}{Monospaced}   {6} {0}{+tnum}
\zf@define@feature@option{Numbers}{Proportional} {6} {1}{+pnum}
\zf@define@feature@option{Numbers}{Lowercase}    {21}{0}{+onum}
\zf@define@feature@option{Numbers}{OldStyle}     {21}{0}{+onum}
\zf@define@feature@option{Numbers}{Uppercase}    {21}{1}{+lnum}
\zf@define@feature@option{Numbers}{Lining}       {21}{1}{+lnum}
\zf@define@feature@option{Numbers}{SlashedZero}  {14}{5}{+zero}
\zf@define@feature@option{Numbers}{NoSlashedZero}{14}{4}{-zero}
\luatex_if_engine:T {
  \zf@define@feature@option{Numbers}{Arabic}{}{}{+anum}
  \zf@define@feature@option{Numbers}{Farsi} {}{}{+anum}
}
\zf@define@font@feature  {Contextuals}
\zf@define@feature@option{Contextuals}{Swash}        {} {} {+cswh}
\zf@define@feature@option{Contextuals}{NoSwash}      {} {} {-cswh}
\zf@define@feature@option{Contextuals}{Alternate}    {} {} {+calt}
\zf@define@feature@option{Contextuals}{NoAlternate}  {} {} {-calt}
\zf@define@feature@option{Contextuals}{WordInitial}  {8}{0}{+init}
\zf@define@feature@option{Contextuals}{NoWordInitial}{8}{1}{-init}
\zf@define@feature@option{Contextuals}{WordFinal}    {8}{2}{+fina}
\zf@define@feature@option{Contextuals}{NoWordFinal}  {8}{3}{-fina}
\zf@define@feature@option{Contextuals}{LineInitial}  {8}{4}{}
\zf@define@feature@option{Contextuals}{NoLineInitial}{8}{5}{}
\zf@define@feature@option{Contextuals}{LineFinal}    {8}{6}{+falt}
\zf@define@feature@option{Contextuals}{NoLineFinal}  {8}{7}{-falt}
\zf@define@feature@option{Contextuals}{Inner}        {8}{8}{+medi}
\zf@define@feature@option{Contextuals}{NoInner}      {8}{9}{-medi}
\zf@define@font@feature{Diacritics}
\zf@define@feature@option{Diacritics}{Show}        {9}{0}{}
\zf@define@feature@option{Diacritics}{Hide}        {9}{1}{}
\zf@define@feature@option{Diacritics}{Decompose}   {9}{2}{}
\zf@define@feature@option{Diacritics}{MarkToBase}  {}{}{+mark}
\zf@define@feature@option{Diacritics}{NoMarkToBase}{}{}{-mark}
\zf@define@feature@option{Diacritics}{MarkToMark}  {}{}{+mkmk}
\zf@define@feature@option{Diacritics}{NoMarkToMark}{}{}{-mkmk}
\zf@define@feature@option{Diacritics}{AboveBase}   {}{}{+abvm}
\zf@define@feature@option{Diacritics}{NoAboveBase} {}{}{-abvm}
\zf@define@feature@option{Diacritics}{BelowBase}   {}{}{+blwm}
\zf@define@feature@option{Diacritics}{NoBelowBase} {}{}{-blwm}
\zf@define@font@feature{Kerning}
\zf@define@feature@option{Kerning}{Uppercase}{}{}{+cpsp}
\zf@define@feature@option{Kerning}{On}       {}{}{+kern}
\zf@define@feature@option{Kerning}{Off}      {}{}{-kern}
\zf@define@font@feature{VerticalPosition}
\zf@define@feature@option{VerticalPosition}{Normal}     {10}{0}{}
\zf@define@feature@option{VerticalPosition}{Superior}   {10}{1}{+sups}
\zf@define@feature@option{VerticalPosition}{Inferior}   {10}{2}{+subs}
\zf@define@feature@option{VerticalPosition}{Ordinal}    {10}{3}{+ordn}
\zf@define@feature@option{VerticalPosition}{Numerator}  {}  {} {+numr}
\zf@define@feature@option{VerticalPosition}{Denominator}{}  {} {+dnom}
\zf@define@feature@option{VerticalPosition}{ScientificInferior}{}{}{+sinf}
\zf@define@font@feature{Fractions}
\zf@define@feature@option{Fractions}{On}       {11}{1}{+frac}
\zf@define@feature@option{Fractions}{Off}      {11}{0}{-frac}
\zf@define@feature@option{Fractions}{Diagonal} {11}{2}{}
\zf@define@feature@option{Fractions}{Alternate}{}  {} {+afrc}
\define@key[zf]{options}{Alternate}[0]{
  \clist_set_eq:NN \l_fontspec_tmpa_clist \XKV@rm
  \setkeys*[zf@feat]{Alternate}{#1}
  \unless\ifx\XKV@rm\@empty
    \def\XKV@tfam{Alternate}
    \fontspec_make_feature:nnn{17}{#1}{+salt=#1}
  \fi
  \clist_set_eq:NN \XKV@rm \l_fontspec_tmpa_clist
}
\define@key[zf]{options}{Variant}{
  \clist_set_eq:NN \l_fontspec_tmpa_clist \XKV@rm
  \setkeys*[zf@feat]{Variant}{#1}
  \unless\ifx\XKV@rm\@empty
    \def\XKV@tfam{Variant}
    \fontspec_make_feature:nnx{18}{#1}{+ss\two@digits{#1}}
  \fi
  \clist_set_eq:NN \XKV@rm \l_fontspec_tmpa_clist
}
\aliasfontfeature{Variant}{StylisticSet}
\zf@define@font@feature{Style}
\zf@define@feature@option{Style}{Alternate}     {}  {} {+salt}
\zf@define@feature@option{Style}{Italic}        {32}{2}{+ital}
\zf@define@feature@option{Style}{Ruby}          {28}{2}{+ruby}
\zf@define@feature@option{Style}{Swash}         {}  {} {+swsh}
\zf@define@feature@option{Style}{Historic}      {}  {} {+hist}
\zf@define@feature@option{Style}{Display}       {19}{1}{}
\zf@define@feature@option{Style}{Engraved}      {19}{2}{}
\zf@define@feature@option{Style}{TitlingCaps}   {19}{4}{+titl}
\zf@define@feature@option{Style}{TallCaps}      {19}{5}{}
\zf@define@feature@option{Style}{HorizontalKana}{}  {} {+hkna}
\zf@define@feature@option{Style}{VerticalKana}  {}  {} {+vkna}
\zf@define@font@feature{CJKShape}
\zf@define@feature@option{CJKShape}{Traditional}{20}{0} {+trad}
\zf@define@feature@option{CJKShape}{Simplified} {20}{1} {+smpl}
\zf@define@feature@option{CJKShape}{JIS1978}    {20}{2} {+jp78}
\zf@define@feature@option{CJKShape}{JIS1983}    {20}{3} {+jp83}
\zf@define@feature@option{CJKShape}{JIS1990}    {20}{4} {+jp90}
\zf@define@feature@option{CJKShape}{Expert}     {20}{10}{+expt}
\zf@define@feature@option{CJKShape}{NLC}        {20}{13}{+nlck}
\zf@define@font@feature{CharacterWidth}
\zf@define@feature@option{CharacterWidth}{Proportional}{22}{0}{+pwid}
\zf@define@feature@option{CharacterWidth}{Full}{22}{1}{+fwid}
\zf@define@feature@option{CharacterWidth}{Half}{22}{2}{+hwid}
\zf@define@feature@option{CharacterWidth}{Third}{22}{3}{+twid}
\zf@define@feature@option{CharacterWidth}{Quarter}{22}{4}{+qwid}
\zf@define@feature@option{CharacterWidth}{AlternateProportional}{22}{5}{+palt}
\zf@define@feature@option{CharacterWidth}{AlternateHalf}{22}{6}{+halt}
\zf@define@feature@option{CharacterWidth}{Default}{22}{7}{}
\zf@define@feature@option{Annotation}{Off}{24}{0}{}
\zf@define@feature@option{Annotation}{Box}{24}{1}{}
\zf@define@feature@option{Annotation}{RoundedBox}{24}{2}{}
\zf@define@feature@option{Annotation}{Circle}{24}{3}{}
\zf@define@feature@option{Annotation}{BlackCircle}{24}{4}{}
\zf@define@feature@option{Annotation}{Parenthesis}{24}{5}{}
\zf@define@feature@option{Annotation}{Period}{24}{6}{}
\zf@define@feature@option{Annotation}{RomanNumerals}{24}{7}{}
\zf@define@feature@option{Annotation}{Diamond}{24}{8}{}
\zf@define@feature@option{Annotation}{BlackSquare}{24}{9}{}
\zf@define@feature@option{Annotation}{BlackRoundSquare}{24}{10}{}
\zf@define@feature@option{Annotation}{DoubleCircle}{24}{11}{}
\define@key[zf]{options}{Annotation}[0]{
  \clist_set_eq:NN \l_fontspec_tmpa_clist \XKV@rm
  \setkeys*[zf@feat]{Annotation}{#1}
  \unless\ifx\XKV@rm\@empty
    \def\XKV@tfam{Alternate}
    \fontspec_make_feature:nnn{}{}{+nalt=#1}
  \fi
  \clist_set_eq:NN \XKV@rm \l_fontspec_tmpa_clist
}
\zf@define@font@feature{Vertical}
\define@key[zf@feat]{Vertical}{RotatedGlyphs}[]{
  \ifzf@icu
    \fontspec_make_feature:nnn{}{}{+vrt2}
    \zf@update@family{+vert}
    \zf@update@ff{vertical}
  \else
    \zf@update@family{+vert}
    \zf@update@ff{vertical}
  \fi
}
\newfontscript{Arabic}{arab}            \newfontscript{Armenian}{armn}
\newfontscript{Balinese}{bali}          \newfontscript{Bengali}{beng}
\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{Devanagari}{deva}        \newfontscript{Ethiopic}{ethi}
\newfontscript{Georgian}{geor}          \newfontscript{Glagolitic}{glag}
\newfontscript{Gothic}{goth}            \newfontscript{Greek}{grek}
\newfontscript{Gujarati}{gujr}          \newfontscript{Gurmukhi}{guru}
\newfontscript{Hangul~Jamo}{jamo}       \newfontscript{Hangul}{hang}
\newfontscript{Hanunoo}{hano}           \newfontscript{Hebrew}{hebr}
\newfontscript{Hiragana~and~Katakana}{kana}
\newfontscript{Javanese}{java}          \newfontscript{Kannada}{knda}
\newfontscript{Kharosthi}{khar}         \newfontscript{Khmer}{khmr}
\newfontscript{Lao}{lao~}               \newfontscript{Latin}{latn}
\newfontscript{Limbu}{limb}             \newfontscript{Linear~B}{linb}
\newfontscript{Malayalam}{mlym}         \newfontscript{Math}{math}
\newfontscript{Mongolian}{mong}
\newfontscript{Musical~Symbols}{musc}   \newfontscript{Myanmar}{mymr}
\newfontscript{N'ko}{nko~}              \newfontscript{Ogham}{ogam}
\newfontscript{Old~Italic}{ital}
\newfontscript{Old~Persian~Cuneiform}{xpeo}
\newfontscript{Oriya}{orya}             \newfontscript{Osmanya}{osma}
\newfontscript{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{Tamil}{taml}             \newfontscript{Telugu}{telu}
\newfontscript{Thaana}{thaa}            \newfontscript{Thai}{thai}
\newfontscript{Tibetan}{tibt}           \newfontscript{Tifinagh}{tfng}
\newfontscript{Ugaritic~Cuneiform}{ugar}\newfontscript{Yi}{yi~~}
\newfontscript{Kana}{kana}
\newfontscript{Maths}{math}
\newfontscript{CJK}{hani}
\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{French~Antillean}{FAN}\newfontlanguage{Farsi}{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{Chinese~Phonetic}{ZHP}\newfontlanguage{Chinese~Simplified}{ZHS}
\newfontlanguage{Chinese~Traditional}{ZHT}\newfontlanguage{Zande}{ZND}
\newfontlanguage{Zulu}{ZUL}
\define@key[zf@feat]{Lang}{Turkish}[]{
  \fontspec_check_lang:nTF {TRK} {
    \c@zf@language\l_fontspec_strnum_int\relax
    \zf@update@family{+lang=Turkish}
    \tl_set:Nn \l_fontspec_lang_tl {TRK}
  }{
    \fontspec_check_lang:nTF {TUR} {
      \c@zf@language\l_fontspec_strnum_int\relax
      \zf@update@family{+lang=Turkish}
      \tl_set:Nn \l_fontspec_lang_tl {TUR}
    }{
      \fontspec_warning:nx {language-not-exist} {#1}
    }
  }
}
\define@key[zf@feat]{Lang}{Default}[]{
  \zf@update@family{+lang=dflt}
  \tl_set:Nn \l_fontspec_lang_tl {DFLT}
  \c@zf@language=0\relax
}
\define@key[zf]{options}{RawFeature}{
  \zf@update@family{+Raw:#1}
  \zf@update@ff{#1}
}
\providecommand*{\sidefault}{si}
\DeclareRobustCommand{\sishape}{
  \not@math@alphabet\sishape\relax
  \fontshape\sidefault\selectfont
}
\DeclareTextFontCommand{\textsi}{\sishape}
\newcommand*{\zf@merge@shape}[3]{
  \edef\@tempa{#1}
  \edef\@tempb{#2}
  \ifx\f@shape\@tempb
    \ifcsname\f@encoding/\f@family/\f@series/#3\endcsname
      \edef\@tempa{#3}
    \fi
  \fi
  \fontshape{\@tempa}\selectfont
}
\DeclareRobustCommand \itshape {
  \not@math@alphabet\itshape\mathit
  \zf@merge@shape\itdefault\scdefault\sidefault
}
\DeclareRobustCommand \slshape {
  \not@math@alphabet\slshape\relax
  \zf@merge@shape\sldefault\scdefault\sidefault
}
\DeclareRobustCommand \scshape {
  \not@math@alphabet\scshape\relax
  \zf@merge@shape\scdefault\itdefault\sidefault
}
\DeclareRobustCommand \upshape {
  \not@math@alphabet\upshape\relax
  \zf@merge@shape\updefault\sidefault\scdefault
}
\@ifpackageloaded{euler}{\zf@package@euler@loadedtrue}
                        {\zf@package@euler@loadedfalse}
\def\zf@math{
  \let\zf@font@warning\@font@warning
  \let\@font@warning\@font@info
  \@ifpackageloaded{euler}{
    \ifzf@package@euler@loaded
      \zf@math@eulertrue
    \else
      \fontspec_error:n {euler-too-late}
    \fi
  }{}
  \@ifpackageloaded{lucbmath}{\zf@math@lucidatrue}{}
  \@ifpackageloaded{lucidabr}{\zf@math@lucidatrue}{}
  \@ifpackageloaded{lucimatx}{\zf@math@lucidatrue}{}
  \DeclareSymbolFont{legacymaths}{OT1}{cmr}{m}{n}
  \SetSymbolFont{legacymaths}{bold}{OT1}{cmr}{bx}{n}
  \DeclareMathAccent{\acute}   {\mathalpha}{legacymaths}{19}
  \DeclareMathAccent{\grave}   {\mathalpha}{legacymaths}{18}
  \DeclareMathAccent{\ddot}    {\mathalpha}{legacymaths}{127}
  \DeclareMathAccent{\tilde}   {\mathalpha}{legacymaths}{126}
  \DeclareMathAccent{\bar}     {\mathalpha}{legacymaths}{22}
  \DeclareMathAccent{\breve}   {\mathalpha}{legacymaths}{21}
  \DeclareMathAccent{\check}   {\mathalpha}{legacymaths}{20}
  \DeclareMathAccent{\hat}     {\mathalpha}{legacymaths}{94} % too bad, euler
  \DeclareMathAccent{\dot}     {\mathalpha}{legacymaths}{95}
  \DeclareMathAccent{\mathring}{\mathalpha}{legacymaths}{23}
  \begingroup
    \mathchardef\@tempa="603A \relax
    \let\next\egroup
    \ifx\colon\@tempa
      \DeclareMathSymbol{\colon}{\mathpunct}{legacymaths}{58}
    \fi
  \endgroup
  \ifzf@math@euler\else
    \DeclareMathSymbol{!}{\mathclose}{legacymaths}{33}
    \DeclareMathSymbol{:}{\mathrel}  {legacymaths}{58}
    \DeclareMathSymbol{;}{\mathpunct}{legacymaths}{59}
    \DeclareMathSymbol{?}{\mathclose}{legacymaths}{63}
    \ifzf@math@lucida\else
      \DeclareMathSymbol{0}{\mathalpha}{legacymaths}{`0}
      \DeclareMathSymbol{1}{\mathalpha}{legacymaths}{`1}
      \DeclareMathSymbol{2}{\mathalpha}{legacymaths}{`2}
      \DeclareMathSymbol{3}{\mathalpha}{legacymaths}{`3}
      \DeclareMathSymbol{4}{\mathalpha}{legacymaths}{`4}
      \DeclareMathSymbol{5}{\mathalpha}{legacymaths}{`5}
      \DeclareMathSymbol{6}{\mathalpha}{legacymaths}{`6}
      \DeclareMathSymbol{7}{\mathalpha}{legacymaths}{`7}
      \DeclareMathSymbol{8}{\mathalpha}{legacymaths}{`8}
      \DeclareMathSymbol{9}{\mathalpha}{legacymaths}{`9}
      \DeclareMathSymbol{\Gamma}{\mathalpha}{legacymaths}{0}
      \DeclareMathSymbol{\Delta}{\mathalpha}{legacymaths}{1}
      \DeclareMathSymbol{\Theta}{\mathalpha}{legacymaths}{2}
      \DeclareMathSymbol{\Lambda}{\mathalpha}{legacymaths}{3}
      \DeclareMathSymbol{\Xi}{\mathalpha}{legacymaths}{4}
      \DeclareMathSymbol{\Pi}{\mathalpha}{legacymaths}{5}
      \DeclareMathSymbol{\Sigma}{\mathalpha}{legacymaths}{6}
      \DeclareMathSymbol{\Upsilon}{\mathalpha}{legacymaths}{7}
      \DeclareMathSymbol{\Phi}{\mathalpha}{legacymaths}{8}
      \DeclareMathSymbol{\Psi}{\mathalpha}{legacymaths}{9}
      \DeclareMathSymbol{\Omega}{\mathalpha}{legacymaths}{10}
      \DeclareMathSymbol{+}{\mathbin}{legacymaths}{43}
      \DeclareMathSymbol{=}{\mathrel}{legacymaths}{61}
      \DeclareMathDelimiter{(}{\mathopen} {legacymaths}{40}{largesymbols}{0}
      \DeclareMathDelimiter{)}{\mathclose}{legacymaths}{41}{largesymbols}{1}
      \DeclareMathDelimiter{[}{\mathopen} {legacymaths}{91}{largesymbols}{2}
      \DeclareMathDelimiter{]}{\mathclose}{legacymaths}{93}{largesymbols}{3}
      \DeclareMathDelimiter{/}{\mathord}{legacymaths}{47}{largesymbols}{14}
      \DeclareMathSymbol{\mathdollar}{\mathord}{legacymaths}{36}
    \fi
  \fi
  \DeclareSymbolFont{operators}\zf@enc\zf@rmmaths\mddefault\updefault
  \SetSymbolFont{operators}{normal}\zf@enc\zf@rmmaths\mddefault\updefault
  \SetMathAlphabet\mathrm{normal}\zf@enc\zf@rmmaths\mddefault\updefault
  \SetMathAlphabet\mathit{normal}\zf@enc\zf@rmmaths\mddefault\itdefault
  \SetMathAlphabet\mathbf{normal}\zf@enc\zf@rmmaths\bfdefault\updefault
  \SetMathAlphabet\mathsf{normal}\zf@enc\zf@sfmaths\mddefault\updefault
  \SetMathAlphabet\mathtt{normal}\zf@enc\zf@ttmaths\mddefault\updefault
  \SetSymbolFont{operators}{bold}\zf@enc\zf@rmmaths\bfdefault\updefault
  \ifdefined\zf@rmboldmaths
    \SetMathAlphabet\mathrm{bold}\zf@enc\zf@rmboldmaths\mddefault\updefault
    \SetMathAlphabet\mathbf{bold}\zf@enc\zf@rmboldmaths\bfdefault\updefault
    \SetMathAlphabet\mathit{bold}\zf@enc\zf@rmboldmaths\mddefault\itdefault
  \else
    \SetMathAlphabet\mathrm{bold}\zf@enc\zf@rmmaths\bfdefault\updefault
    \SetMathAlphabet\mathit{bold}\zf@enc\zf@rmmaths\bfdefault\itdefault
  \fi
  \SetMathAlphabet\mathsf{bold}\zf@enc\zf@sfmaths\bfdefault\updefault
  \SetMathAlphabet\mathtt{bold}\zf@enc\zf@ttmaths\bfdefault\updefault
  \let\font@warning\zf@font@warning}
\def\zf@math@maybe{
  \@ifpackageloaded{anttor}{
    \ifx\define@antt@mathversions a\@zf@mathfalse\fi}{}
  \@ifpackageloaded{arev}{\@zf@mathfalse}{}
  \@ifpackageloaded{eulervm}{\@zf@mathfalse}{}
  \@ifpackageloaded{mathdesign}{\@zf@mathfalse}{}
  \@ifpackageloaded{concmath}{\@zf@mathfalse}{}
  \@ifpackageloaded{cmbright}{\@zf@mathfalse}{}
  \@ifpackageloaded{mathesf}{\@zf@mathfalse}{}
  \@ifpackageloaded{gfsartemisia}{\@zf@mathfalse}{}
  \@ifpackageloaded{gfsneohellenic}{\@zf@mathfalse}{}
  \@ifpackageloaded{iwona}{
    \ifx\define@iwona@mathversions a\@zf@mathfalse\fi}{}
  \@ifpackageloaded{kpfonts}{\@zf@mathfalse}{}
  \@ifpackageloaded{kmath}{\@zf@mathfalse}{}
  \@ifpackageloaded{kurier}{
    \ifx\define@kurier@mathversions a\@zf@mathfalse\fi}{}
  \@ifpackageloaded{fouriernc}{\@zf@mathfalse}{}
  \@ifpackageloaded{fourier}{\@zf@mathfalse}{}
  \@ifpackageloaded{mathpazo}{\@zf@mathfalse}{}
  \@ifpackageloaded{mathptmx}{\@zf@mathfalse}{}
  \@ifpackageloaded{MinionPro}{\@zf@mathfalse}{}
  \@ifpackageloaded{unicode-math}{\@zf@mathfalse}{}
  \@ifpackageloaded{breqn}{\@zf@mathfalse}{}
  \if@zf@math
    \fontspec_info:n {setup-math}
    \zf@math
  \fi
}
\AtBeginDocument{\zf@math@maybe}
\if@zf@configfile
  \InputIfFileExists{fontspec.cfg}
    {\typeout{fontspec.cfg~ loaded.}}
    {\typeout{No~ fontspec.cfg~ file~ found;~ no~ configuration~ loaded.}}
\fi
%% 
%% Copyright 2004--2010 Will Robertson <wspr81@gmail.com>
%% Copyright 2009--2010 Khaled Hosny <khaledhosny@eglug.org>
%% 
%% Distributable under the LaTeX Project Public License,
%% version 1.3c or higher (your choice). The latest version of
%% this license is at: http://www.latex-project.org/lppl.txt
%% 
%% This work is "author-maintained" by Will Robertson.
%% 
%% This work consists of this file fontspec.dtx
%%           and the derived files fontspec.sty,
%%                                 fontspec.lua,
%%                                 fontspec.cfg,
%%                                 fontspec-xetex.tex,
%%                                 fontspec-luatex.tex,
%%                             and fontspec.pdf.
%% 
%%
%% End of file `fontspec.sty'.
