\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{tinos}
    [2022/09/24 (Bob Tennent)  Supports Tinos fonts for all LaTeX engines.]

\RequirePackage{ifxetex,ifluatex,xkeyval,textcomp}

\newif\iftinos@ttf 
\ifxetex
  \tinos@ttftrue
\else\ifluatex
  \tinos@ttftrue
\else  % [pdf]LaTeX
  \tinos@ttffalse
\fi\fi


\newcommand*{\Tinos@scale}{1}
\DeclareOptionX{scaled}{\renewcommand*{\Tinos@scale}{#1}}
\DeclareOptionX{scale}{\renewcommand*{\Tinos@scale}{#1}}


\DeclareOptionX{type1}{\tinos@ttffalse}

\ProcessOptionsX\relax

\iftinos@ttf\else % type1
    \def\tinos@figurestyle{LF}
    \def\tinos@figurealign{T}
\fi


\iftinos@ttf
  \RequirePackage{fontspec}
\else
  \RequirePackage{fontenc,fontaxes}
\fi

\iftinos@ttf
  \defaultfontfeatures{
        Ligatures = TeX ,
        Scale     = \Tinos@scale ,
        Extension = .ttf }
  \setmainfont
      [ UprightFont    = *-Regular ,
        ItalicFont     = *-Italic ,
        BoldFont       = *-Bold , 
        BoldItalicFont = *-BoldItalic ]
      {Tinos}
\else % type1
  \def\tinosfamily{Tinos-\tinos@figurealign\tinos@figurestyle}
  \newcommand*\tinos{\fontfamily{\tinos}\selectfont}
  \def\rmdefault{\tinosfamily}
\fi


\iftinos@ttf
  % turn off defaults in case other fonts are selected:
  \defaultfontfeatures{}
\fi

\endinput
