\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{cinzel}
    [2014/05/24  (Bob Tennent)  Supports Cinzel and CinzelDecorative for all LaTeX engines.]

\RequirePackage{ifxetex,ifluatex,xkeyval,textcomp}

\newif\ifcinzel@ttf 
\ifxetex
  \cinzel@ttftrue
\else\ifluatex
  \cinzel@ttftrue
\else  % [pdf]LaTeX
  \cinzel@ttffalse
\fi\fi

\newif\ifcinzel@black \cinzel@blackfalse

\DeclareOptionX{type1}{\cinzel@ttffalse}
\DeclareOptionX{black}{\cinzel@blacktrue}
\ProcessOptionsX\relax

\ifcinzel@ttf
  \def\cinzel@boldstyle{Bold}
  \ifcinzel@black\def\cinzel@boldstyle{Black}\fi

\else % type1
  \def\bfseries@rm{b}
  \ifcinzel@black\def\bfseries@rm{k}\fi

\fi

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


\ifcinzel@ttf
  \ifxetex\XeTeXtracingfonts=1\fi
  \defaultfontfeatures{
        Ligatures = TeX ,
        Extension = .ttf }
  \setmainfont
      [ UprightFont    = *-Regular ,
        ItalicFont     = *Decorative-Regular ,
        BoldFont       = *-\cinzel@boldstyle , 
        BoldItalicFont = *Decorative-\cinzel@boldstyle ]
      {Cinzel}
  \newfontfamily\cinzel
      [ UprightFont    = *-Regular ,
        ItalicFont     = *Decorative-Regular ,
        BoldFont       = *-\cinzel@boldstyle , 
        BoldItalicFont = *Decorative-\cinzel@boldstyle ]
      {Cinzel}
  \newfontfamily\cinzelblack
      [ UprightFont    = *-Black ,
        ItalicFont     = *Decorative-Black ]
      {Cinzel}

\else % type1
  \def\cinzelfamily{Cinzel-LF}
  \newcommand*\cinzel{\fontfamily{\cinzelfamily}\def\itshape{\fontfamily{CinzelDecorative-LF}\fontshape{n}\selectfont}\selectfont}
  \def\rmdefault{\cinzelfamily}
  \def\itshape{\fontfamily{CinzelDecorative-LF}\fontshape{n}\selectfont}
  \newcommand*\cinzelblack{\fontfamily{\cinzelfamily}\fontseries{k}\def\itshape{\fontfamily{CinzelDecorative-LF}\fontshape{n}\selectfont}\selectfont}

\fi

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

\endinput
