\ProvidesPackage{almendra}[%
   2020/07/23 (Bob Tennent)  Supports Almendra fonts for XeLaTeX or LuaLaTeX. ] 

\RequirePackage{iftex}

\ifpdftex
\PackageError{almendra}{%
 *****************************************\MessageBreak
  Please process using XeLaTeX or luaLaTeX\MessageBreak
 *****************************************}
\fi  

\newcommand*{\Almendra@scale}{1}  
\RequirePackage{xkeyval}
\DeclareOptionX{scaled}{\renewcommand*{\Almendra@scale}{#1}}
\DeclareOptionX{scale}{\renewcommand*{\Almendra@scale}{#1}}

\ProcessOptionsX\relax

\RequirePackage{fontspec}

  \ifxetex\XeTeXtracingfonts=1\fi
  \defaultfontfeatures{
     Ligatures = TeX ,
     Extension = .ttf ,
  }
  \setmainfont
      [ UprightFont    = *-Regular ,
        ItalicFont     = *-Italic ,
        BoldFont       = *-Bold , 
        BoldItalicFont = *-BoldItalic ,
        SmallCapsFont = {AlmendraSmallCaps}
      ]
      {Almendra}
  \newfontfamily\almendra
      [ UprightFont    = *-Regular ,
        ItalicFont     = *-Italic ,
        BoldFont       = *-Bold , 
        BoldItalicFont = *-BoldItalic ,
        SmallCapsFont = {AlmendraSmallCaps}
      ]
      {Almendra}

% turn off defaults in case other fonts are selected:
\defaultfontfeatures{}

\endinput

