\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{oldstandardt1}
    [2016/06/28 (Bob Tennent and autoinst)  Style file for Old Standard fonts.]

\RequirePackage{ifxetex,ifluatex,xkeyval,textcomp}

\newif\ifoldstandard@otf 
\ifxetex
  \oldstandard@otftrue
\else\ifluatex
  \oldstandard@otftrue
\else  % [pdf]LaTeX
  \oldstandard@otffalse
\fi\fi

\newcommand*{\OldStandardTT@scale}{1}
\RequirePackage{xkeyval}
\DeclareOptionX{scaled}{\renewcommand*{\OldStandardTT@scale}{#1}}
\DeclareOptionX{scale}{\renewcommand*{\OldStandardTT@scale}{#1}}
\DeclareOptionX{type1}{\oldstandard@otffalse}

\ProcessOptionsX\relax

\ifoldstandard@otf
  \RequirePackage{fontspec}
\else
  \RequirePackage{fontenc,fontaxes}
\fi

\ifoldstandard@otf
  \ifxetex\XeTeXtracingfonts=1\fi
  \defaultfontfeatures{
        Ligatures = TeX ,
        Scale     = \OldStandardTT@scale ,
        Extension = .otf }
  \setmainfont
      [ UprightFont    = *-Regular ,
        ItalicFont     = *-Italic ,
        BoldFont    = *-Bold ,
      ]
      {OldStandard}
  \newfontfamily\oldstandard
      [ UprightFont    = *-Regular ,
        ItalicFont     = *-Italic ,
        BoldFont    = *-Bold ,
      ]
      {OldStandard}

\else % type1

  \def\oldstandard@family{OldStandardTT-TLF}
  \renewcommand*\rmdefault{\oldstandard@family}
  \newcommand*\oldstandard{\fontfamily{\oldstandard@family}\selectfont}

\fi

\ifoldstandard@otf
  \defaultfontfeatures{}
\fi

\endinput
