%-------- Typeface Package Test Harness -- User-configurable Section ----------
%
\providecommand*\TFTESTdocumentclass{article}   % or memoir, scrartcl, etc.

\providecommand*\TFTESTfontfamily{rm}           % set to rm, sf or tt
\providecommand*\TFTESTfontsize{10pt}           % 11pt, 12pt, others if memoir
\providecommand*\TFTESTpapersize{a4paper}

\providecommand*\TFTESTfontencoding{default}
\providecommand*\TFTESTinputencoding{default}
\providecommand*\TFTESTtextcomp{default}
\providecommand*\TFTESTcmap{default}
\providecommand*\TFTESTtypeface{default}
\providecommand*\TFTESTtextfigures{default}
\providecommand*\TFTESTsanstypeface{default}
\providecommand*\TFTESTmonotypeface{default}
\providecommand*\TFTESTmathtypeface{default}
\providecommand*\TFTESTsymbolstypeface{default}
\providecommand*\TFTESTfontloadorder{default}

\providecommand*\TFTESTdebug{false}
\providecommand*\TFTESTprintmathfonts{false}
\providecommand*\TFTESTincludemicrotype{true}
%
%--------------- End User-configurable Section --------------------------------

% Note that this document attempts to typeset text in many font weights,
% widths, shapes, variants, encodings and sizes. It calls on, e.g.,
% \oldstylenums regardless of loaded font. Line lengths in tables do not take
% account of actual page line width. Thus, depending on the font families you
% load, you should expect to receive several, if not many, warnings and
% overfull boxes. Do not be concerned (unless, of course, something is
% actually wrong).

\documentclass[\TFTESTfontsize,\TFTESTpapersize]{\TFTESTdocumentclass}
\usepackage[margin=1.0cm,
           %showframe,
           ]{geometry}

\usepackage{ifthen}
\usepackage{parskip}

% Microtype is required for substitute figures letterspacing in textnums
% environments (advance usage). However, note that microtype doesn't partner
% well with bitmap fonts, especially if any scaling is involved. In these
% cases, microtype will very likely throw "auto expansion is only possible
% with scalable fonts" errors.
\ifthenelse{\equal{\TFTESTincludemicrotype}{true}}{
  \usepackage[verbose=errors]{microtype}
}{}

\usepackage[
  fontencoding=\TFTESTfontencoding,
  inputencoding=\TFTESTinputencoding,
  textcomp=\TFTESTtextcomp,
  cmap=\TFTESTcmap,
  typeface=\TFTESTtypeface,
  textfigures=\TFTESTtextfigures,
  mathtypeface=\TFTESTmathtypeface,
  symbolstypeface=\TFTESTsymbolstypeface,
  sanstypeface=\TFTESTsanstypeface,
  monotypeface=\TFTESTmonotypeface,
  fontloadorder=\TFTESTfontloadorder,
  debug=\TFTESTdebug,
  printinfo=true,
]{typeface}

% Redefine equation numbering simply for testing's sake
\DeclareRobustCommand*\theequation{%
  \ifthenelse{\equal{\TFTESTfontfamily}{rm}}{%
    \protect\begin{textnums}3.\arabic{equation}\protect\end{textnums}%
  }{%
    \ifthenelse{\equal{\TFTESTfontfamily}{sf}}{%
      4.\arabic{equation}%
    }{% \TFTESTfontfamily=tt
      5.\arabic{equation}%
    }%
  }%
}

% While we're at it, redefine our equation numbering presentation
% format, again for testing's sake
\makeatletter\def\@eqnnum{{(\theequation)}}\makeatother

\usepackage{bookmark}[2010/04/08]

\ifthenelse{\equal{\TFTESTfontfamily}{rm}}{
  \newcommand*\TFbookmark{\rmprintname}
}{
  \ifthenelse{\equal{\TFTESTfontfamily}{sf}}
    {\newcommand*\TFbookmark{\sfprintname}}
    {\newcommand*\TFbookmark{\ttprintname}}
}

\ifthenelse{\equal{\TFTESTfontfamily}{rm}}
  {\def\typeface{typeface}\def\typefacename{\textrm{\TFTESTtypeface}}}{}%
\ifthenelse{\equal{\TFTESTfontfamily}{sf}}
  {\def\typeface{sanstypeface}\def\typefacename{\textsf{\TFTESTsanstypeface}}}{}%
\ifthenelse{\equal{\TFTESTfontfamily}{tt}}
  {\def\typeface{monotypeface}\def\typefacename{\texttt{\TFTESTmonotypeface}}}{}%

\begin{document}
  \hypertarget{\TFbookmark}{}
  \bookmark[dest=\TFbookmark, level=0]{\TFbookmark}
  \pagestyle{empty}
  \raggedbottom
  \section*{Test page: \typeface\(=\)\typefacename \space{(\TFTESTfontsize)}}
  \tfprintpackageoptions%
  \tfprintinfo%
  \tfprinttext{\TFTESTfontfamily}%
  \tfprintfigures{\TFTESTfontfamily}%
  \tfprintmathsample{\TFTESTfontfamily}%
  \tfprintmathalphabets{\TFTESTfontfamily}%
  \ifthenelse{\equal{\TFTESTprintmathfonts}{true}}{\tfprintmathfonts}{}%
  \tfprinttextsample{\TFTESTfontfamily}%
  \tfprinttextalphabets%
  {\noindent\footnotesize{\rmfamily\selectfont $footnotesize$footnotesize}%
  {\sffamily\selectfont footnotesize}%
  {\ttfamily\selectfont footnotesize}%
  {\rmfamily\selectfont$0123456789$\begin{textnums}0123456789\end{textnums}}%
  {\sffamily\selectfont\begin{textnums}0123456789\end{textnums}}%
  {\ttfamily\selectfont\begin{textnums}0123456789\end{textnums}}}\\%
  {\normalsize{\rmfamily\selectfont $Normal$Normal}%
  {\sffamily\selectfont Normal}%
  {\ttfamily\selectfont Normal}%
  {\rmfamily\selectfont$0123456789$\begin{textnums}0123456789\end{textnums}}%
  {\sffamily\selectfont\begin{textnums}0123456789\end{textnums}}%
  {\ttfamily\selectfont\begin{textnums}0123456789\end{textnums}}}\\%
  {\Large{\rmfamily\selectfont $Large$Large}%
  {\sffamily\selectfont Large}%
  {\ttfamily\selectfont Large}%
  {\rmfamily\selectfont$0123456789$\begin{textnums}0123456789\end{textnums}}%
  {\sffamily\selectfont\begin{textnums}0123456789\end{textnums}}%
  {\mbox{\ttfamily\selectfont\begin{textnums}0123456789\end{textnums}}}}\\%
\end{document}
