\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{GoMono}
    [2019/10/12 (Bob Tennent and autoinst)  Style file for GoMono fonts.]

\RequirePackage{ifxetex,ifluatex,xkeyval,textcomp}

\newif\ifgomono@ttf 
\ifxetex
  \gomono@ttftrue
\else\ifluatex
  \gomono@ttftrue
\else  % [pdf]LaTeX
  \gomono@ttffalse
\fi\fi

\newif\ifgomono@ligatures \gomono@ligaturestrue

\newcommand*{\GoMono@scale}{1}
\RequirePackage{xkeyval}
\DeclareOptionX{scaled}{\renewcommand*{\GoMono@scale}{#1}}
\DeclareOptionX{scale}{\renewcommand*{\GoMono@scale}{#1}}
\DeclareOptionX{type1}{\gomono@ttffalse}
\DeclareOptionX{nomap}{\gomono@ligaturesfalse}

\ProcessOptionsX

\ifgomono@ttf

  \def\gomono@boldstyle{Bold}
  \def\gomono@regstyle{Regular}

\else % type1

  \def\bfseries@tt{b}
  \def\mdseries@tt{m}

\fi


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

\ifgomono@ttf
  \ifxetex\XeTeXtracingfonts=1\fi
  \ifgomono@ligatures
    \defaultfontfeatures{
          Ligatures = TeX ,
          HyphenChar=None,
          Scale     = \GoMono@scale ,
          Extension = .ttf }
  \else
    \defaultfontfeatures{
          Scale     = \GoMono@scale ,
          HyphenChar=None,
          Extension = .ttf }
  \fi
  \setmonofont
      [ 
        UprightFont    = *-Regular ,
        ItalicFont     = *-Regular-Italic ,
        BoldFont    = *-Bold ,
        BoldItalicFont     = *-Bold-Italic 
      ]
      {GoMono}
  % grab current family in case of subsequent change:
  \let\gomonofamily\sfdefault  

\else % type1

  \def\gomono@family{GoMono-TLF}
  \def\ttdefault{\gomono@family}

\fi

\def\gomonolgr{\fontencoding{LGR}\fontfamily{GoMono-TLF}\selectfont}

\ifgomono@ttf
  \defaultfontfeatures{}
\fi

\endinput
