
% \iffalse
%
% This file is part of the NFSS2 (New Font Selection Scheme) package.
% ------------------------------------------------------------------
%
% This file was contributed. In case of error please inform the
% original author.
%
% \fi

\documentstyle[nft1ot1,array]{article}
\makeatletter
\def\CMRdefaults{%
 \def\default@shape{n}%
 \def\default@series{m}%
 \def\sldefault{sl}%
 \def\bfdefault{bx}%
 \def\rmdefault{cmr}%
 \def\ttdefault{cmtt}%
 \def\sfdefault{cmss}%
 \def\default@errfont{cmsy10}%
 \def\encodingdefault{OT1}%
 \fontencoding{OT1}%
 \fontfamily{cmr}%
 }%
\def\MathAsText{%
\SetSymbolFont{operators}{normal}{\encodingdefault}{\rmdefault}{m}{n}%
\SetSymbolFont{operators}{bold}{\encodingdefault}{\rmdefault}{b}{n}%
\SetMathAlphabet{\mathsf}{normal}{\encodingdefault}{\sfdefault}{m}{n}%
\SetMathAlphabet{\mathsf}{bold}{\encodingdefault}{\sfdefault}{b}{n}%
\SetMathAlphabet{\mathbf}{normal}{\encodingdefault}{\rmdefault}{b}{n}%
}
%------------------------------------------------------------

\def\Encoding#1{%
   \def\encodingdefault{#1}%
   \fontencoding{#1}%
}
\def\HUGE{\fontsize{30}{35pt}\selectfont}
%------------------------------------------------------------

\let\old@rm\rm
\let\old@tt\tt
\let\old@sf\sf

\def\@empty{}%

\def\Romanfont{\@ifnextchar [{\roman@font}{\roman@font[]}}%
\def\Typewriterfont{\@ifnextchar [{\typewriter@font}{\typewriter@font[]}}%
\def\Sansfont{\@ifnextchar [{\sans@font}{\sans@font[]}}%

\def\roman@font[#1]#2{%
\renewcommand{\rmdefault}{#2}%
\wlog{Default roman typeface now #2}%
\fontfamily{#2}%
\def\this@one{#1}\ifx\this@one\@empty
\else
  \wlog{coding #1 for roman font}%
  \def\rm{\fontencoding{#1}\old@rm}%
\fi
}%

\def\sans@font[#1]#2{%
\renewcommand{\sfdefault}{#2}%
\wlog{Default sans-serif typeface now #2}%
\def\this@one{#1}\ifx\this@one\@empty
\else
  \wlog{coding #1 for sans font}%
  \def\sf{\fontencoding{#1}\old@sf}%
\fi
}%

\def\typewriter@font[#1]#2{%
\renewcommand{\ttdefault}{#2}%
 \wlog{Default typewriter typeface now #2}%
\def\this@one{#1}\ifx\this@one\@empty
\else
  \wlog{coding #1 for typewriter font}%
  \def\tt{\fontencoding{#1}\old@tt}%
\fi
}
\def\bfdefault{b}
\def\sldefault{sl} % you could make this `it' to abandon `\sl' completely
\def\bfdefault{bx}
\makeatother
\begin{document}
\parskip=4pt
\parindent 0pt
\title{PSNFSS: checking font-encoding system}
\author{Sebastian Rahtz}
\date{March 13th 1993}
\maketitle
%--------------------------------------------------------------
\def\WW#1#2{#1{#2} &\tt\string#1\string{#2\string}}
\def\W#1{#1 &\tt\string#1}
\def\BS{$\backslash$}

% various tests for NFSS font changes
% Shapes, Accents, Specialchars, Sample
%
\def\Shapes{
\begin{quote}\begin{tabular}{|*{4}{>{\BS\tt}ll|}}\hline
rm   & \rm Roman  & it   & \it Italic & sc   & \sc Small Caps   &
em   & \em Emphatic      \\
sl & \sl Slanted   & tt   & \tt Typewriter     &
bf   & \bf Boldface      & sf & \sf Sans Serif \\
\hline
\end{tabular}\end{quote}
In \LaTeX, this costs 
`\pounds' 45 to do; {\sf this costs \pounds 45 to do in sans;}
{\sc this costs ``\pounds'' 45 to do in Small Caps;}
{\em this costs \pounds 45 to do in italic, and
\bf this costs \pounds 45 to do in bold italics}. And so  on\ldots
}

\def\Accents{
\begin{quote}\begin{tabular}{|ll|ll|ll|}
\hline
\WW\`{o}&\WW\~{o}&\WW\v{o}\\
\WW\c{o}&\WW\'{o}&\WW\={o}\\
\WW\H{o}&\WW\d{o}&\WW\^{o}\\
\WW\.{o}&\WW\t{oo}&\WW\b{o}\\
\WW\"{o}&\WW\u{o}&&\\
\hline
\end{tabular}\end{quote}
}

\def\Specialchars{%
\batchmode
\begin{quote}\begin{tabular}{|*{4}{ll|}}\hline
\W{\dag}      & \W{\S}        & \W{\copyright}& \W{\i}                    \\
\W{\ddag}     & \W{\P}        & \W{\pounds}   & \W{\j}                    \\
\W{\oe}       & \W{\OE}       & \W{\ae}       & \W{\guilsinglright}       \\
\W{\AE}       & \W{\aa}       & \W{\AA}       & \W{\guillemotleft}        \\
\W{\o}        & \W{\O}        & \W{\l}        & \W{\guilsinglleft}        \\
\W{\L}        & \W{\ss}       & ?` & \tt{?}{`}& \W{\guillemotright}       \\
!`&\tt{!}{`}  & \W{\ldots}    & \W{\LaTeX}    & \W{\quotedblbase}         \\
\hline
\end{tabular}\end{quote}
\errorstopmode
}

\long\def\Sample{%
The s\=un has got his h\=at on, hip hip hip hooray! !`THE DAZED BROWN
FOX QUICKLY GAVE 12345--67890 JUMPS! --- ?`But aren't Kafka's
Schlo{\ss} and {\AE}sop's {\OE}uvres often na{\"\i}ve vis-\`{a}-vis
the d{\ae}monic ph{\oe}nix's official r\^{o}le in fluffy souffl\'{e}s?
Only if $\sum_{i=1}^{n} x_{i} = \int_{0}^{1} f $ or (expressed more
clearly)

$$\sum_{i=1}^{n} x_{i} = \int_{0}^{1} f $$
}
\def\All{\Shapes \Accents \Specialchars \Sample}
%----------------------------------------------
%--------------------------------------------------------
\section{Default}
This section gives various tables which are in the default font and
encoding.

\All

\section{Times}
Now we change the encoding, and should start setting the
same tests in Times Roman, Helvetica and Courier.

\makeatletter
\Sansfont{phv}
\Romanfont{ptm}
\Typewriterfont{pcr}
\Encoding{T1}
\selectfont
\All

\section{Switch back to CMR and OT1}
Now we switch back to the original CM font and encoding, and check
to see if the tests still give the same result.

\fontencoding{OT1}\CMRdefaults\selectfont
\All

\section{Bits from all types of encoding}
In this section, we switch from Roman to Sans to Typewriter, each one
of which is a font with a different encoding.

\subsection{Roman font cmr, encoding OT1}
\Romanfont[OT1]{cmr}\rm\Accents\Specialchars

\subsection{Sans font cmss, encoding T1}
\Sansfont[T1]{cmss}\sf\Accents\Specialchars

\subsection{TT font pcr, encoding OT1}
\Typewriterfont[OT1]{pcr}\tt\Accents\Specialchars

\subsection{Combined}
Finally, we present some running text in three different roman fonts,
each with a different encoding.

\Romanfont[OT1]{cmr}\rm This is CMR and OT1 encoding. \Sample
\Romanfont[OT1]{ptm}\rm This is Times Roman and OT1 encoding. \Sample
\Romanfont[T1]{cmr}\rm This is CMR and T1 encoding. \Sample

\end{document}
