%%
%% This is file `realscripts.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% realscripts.dtx  (with options: `package')
%%   ____________________________
%%   The REALSCRIPTS package
%%   (C) 2010 Will Robertson
%%   License information appended
%% 
\ProvidesPackage{realscripts}
  [2010/09/20 v0.2 Access OpenType subscripts and superscripts]
\RequirePackage{fontspec}[2010/05/14 v2.0]
\ExplSyntaxOn
\cs_if_exist:NTF \textsubscript
{
  \cs_set_eq:NN \fakesubscript \textsubscript
  \cs_set_eq:NN \fakesuperscript \textsuperscript
}
{
  \DeclareDocumentCommand \fakesubscript {m} {
    \@textsubscript{\selectfont#1}
  }
  \DeclareDocumentCommand \fakesuperscript {m} {
    \@textsuperscript{\selectfont#1}
  }
}
\DeclareDocumentCommand \textsubscript {s} {
    \IfBooleanTF #1 \fakesubscript \realsubscript
}
\DeclareDocumentCommand \textsuperscript {s} {
    \IfBooleanTF #1 \fakesuperscript \realsuperscript
}
\DeclareDocumentCommand \realsubscript {m} {
  \fontspec_if_fontspec_font:TF {
    \fontspec_if_opentype:TF
    { \fontspec_if_feature:nTF {+subs}
        { {\addfontfeature{VerticalPosition=Inferior}#1} }
        { \fontspec_if_feature:nTF {+sinf}
            { {\addfontfeature{VerticalPosition=ScientificInferior}#1} }
            { \fakesubscript{#1} }
        }
    }
    { \fontspec_if_aat_feature:nnTF {10} {2}
        { {\addfontfeature{VerticalPosition=Inferior}#1} }
        { \fakesubscript{#1} }
    }
  }
  { \fakesubscript{#1} }
}
\DeclareDocumentCommand \realsuperscript {m} {
  \fontspec_if_fontspec_font:TF
  {
    \fontspec_if_opentype:TF
    { \fontspec_if_feature:nTF {+sups}
      { {\addfontfeature{VerticalPosition=Superior}#1} }
      { \fakesuperscript{#1} }
    }
    { \fontspec_if_aat_feature:nnTF {10} {1}
      { {\addfontfeature{VerticalPosition=Superior}#1} }
      { \fakesuperscript{#1} }
    }
  }
  { \fakesuperscript{#1} }
}
\cs_set:Npn \@makefnmark {
  \mbox{\footnotemarkfont\textsuperscript{\@thefnmark}}
}
\cs_if_exist:NTF \ftntm@font
{
  \cs_new:Npn \footnotemarkfont {\ftntm@font}
}
{
  \cs_new:Npn \footnotemarkfont {\normalfont}
}
%% 
%% Copyright (C) 2010 by Will Robertson <will.robertson@latex-project.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 "maintained" (as per LPPL maintenance status)
%% by Will Robertson.
%% 
%% This work consists of the file  realscripts.dtx
%%           and the derived files realscripts.sty,
%%                                 realscripts.ins, and
%%                                 realscripts.pdf.
%% 
%%
%% End of file `realscripts.sty'.
