% This is part of the book TeX for the Impatient.
% Copyright (C) 2003 Paul W. Abrahams, Kathryn A. Hargreaves, Karl Berry.
% Copyright (C) 2004 Marc Chaudemanche pour la traduction française.
% See file fdl.tex for copying conditions.

% Fonts for TeX for the Impatient.

% This file is being distributed with the macros because the macro file
% refers to it.  We used a combination of Bitstream and standard TeX
% fonts for the original printed book, but for the free edition, we
% stick to Computer Modern.
% -----------------------------------------------------------------------
% 
% We used Computer Modern for the main text and math, and Zapf Humanist
% (i.e., Optima) for heads.  (bs00015 is Optima Roman, 16 italic, 17
% bold, 18 bold italic.)  
% 
% First we define all of the fonts we use for any purpose, in terms of the
% font files.  Later we define fonts functionally, using \let or \def.

% Computer Modern fonts.
%
\font\fiverm = cmr5
\font\eightrm = cmr8
\font\ninerm = cmr9 % Glue pictures, small caps for ASCII.
%\font\tenrm = xcmr10 % with our kerning
\font\tenrm = cmr10 % don't have the xcmr10 source any more
\font\oldtenrm = cmr10 % straight CM
\font\twelverm = cmr12
\font\twentysixrm = cmr10 at 26pt
%
\font\eightit = cmti8
\font\nineit = cmti9
\font\tenit = cmti10
%
\font\eighttt = cmtt8
\font\eleventt = cmtt10 at 11pt
\font\twelvett = cmtt10 scaled \magstep2
%
\font\tenbt = cmtt10
%
\font\elevensf = cmss10 scaled\magstephalf
\font\fourteensf = cmss10 scaled\magstep2
%
\font\eightbf = cmbx8
\font\tenbf = cmbx10
\font\elevenbf = cmbx10 scaled \magstephalf
\font\twelvebf = cmbx12
\font\thirtysixbf = cmbx10 at 36pt
%
\font\tenbi = cmbxti10
\font\elevenbi= cmbxti10 scaled \magstephalf
\font\fourteenbi= cmbxti10 scaled \magstep2
%
\font\tensc = cmcsc10
\font\eightsl = cmsl8
\font\eighti = cmmi8
\font\eightsy = cmsy8

% % Optima fonts.
% %
% \font\eightopt = bs0015 at 8pt
% \font\nineopt = bs0015 at 9pt
% \font\twelveopt = bs0015 at 12pt
% \font\twentysixopt = bs0015 at 26pt
% \font\nineoptit = bs0016 at 9pt
% \font\tenoptit = bs0016 at 10pt
% \font\tenoptbf = bs0017 at 10pt
% \font\thirtysixoptbf = bs0017 at 36pt
% \font\tenbt = bs00175 at 10pt
% \font\tenoptbi = bs0018 at 10pt
% \font\elevenoptbi = bs0018 at 11pt
% \font\fourteenoptbi = bs0018 at 14pt
 
% Palatino fonts.
%
\font\tenpal = pplr
%\font\tenpal = bs0023
%\font\tenpalit = bs0024
%\font\tenpalbf = bs0025
%\font\tenpalbi = bs0026

% Logo and picture fonts.
% 
\font\eightlogo = logo8
\font\logosl = logosl10
\font\handfont = pzdr

% The following changes are to avoid driver overflow
\ifmsdos
   \font\cnum = cnum % 36-pt bold Optima, numbers only (just for MS-DOS)
   \let\chapternumeralfont = \cnum
   %\let\thirtysixoptbf = \twentysixopt
   %\font\sevensy = cmsy8
   %\font\seveni = cmmi8
\fi

\def\undefinedfont{\errmessage{Undefined font}}

% This should only be called when \rm et al. are going to be defined
% directly.
% 
\def\clearfonts{\let\rm = \undefinedfont \let\bf = \undefinedfont
   \let\it = \undefinedfont \let\bi = \undefinedfont
   \let\tt = \undefinedfont \let\bt = \undefinedfont
   \let\sc = \undefinedfont
   \let\ss = \undefinedfont
}

% We only need to assign to \fam if the font is going to be used in math
% mode, which isn't the case with any of these.  \rm, \it, \sl, \bf, and
% \tt are defined in plain.
% 
\def\bi{\tenbi}

\def\mapquotes{\catcode`` = \active \catcode`' = \active}
{\mapquotes
  \gdef\bt{% The font change also draws \ ` ' from a different font.
     \tenbt
     \def\\{{\tentt \char92}}%
     \def`{{\tentt \char96}}\def'{{\tentt \char39}}%
  }
}

\def\bti{\tenbi}
\def\sc{\tensc}

% Text fonts.
% 
\def\textfonts{%
  \def\rm{\fam0\tenrm}%
  \textfont0=\tenrm \scriptfont0=\sevenrm \scriptscriptfont0=\fiverm
  \textfont1=\teni \scriptfont1=\seveni \scriptscriptfont1=\fivei
  \textfont2=\tensy \scriptfont2=\sevensy \scriptscriptfont2=\fivesy
  \textfont3=\tenex \scriptfont3=\tenex \scriptscriptfont3=\tenex
  \def\it{\fam\itfam\tenit}\textfont\itfam=\tenit
  \def\sl{\fam\slfam\tensl}\textfont\slfam=\tensl
  \def\bf{\fam\bffam\tenbf}\textfont\bffam=\tenbf
  \scriptfont\bffam=\sevenbf \scriptscriptfont\bffam=\fivebf
  \def\tt{\fam\ttfam\tentt}\textfont\ttfam=\tentt
  \let\sc = \tensc
  \setbox\strutbox=\hbox{\vrule height8.5pt depth3.5pt width\z@}%
  \normalbaselineskip=12pt
  \normalbaselines \rm
}


% Footnote fonts.  We generally use eight point.
% 
\def\footnotefonts{%
  \def\rm{\fam0\eightrm}%
  \textfont0=\eightrm \scriptfont0=\sevenrm \scriptscriptfont0=\fiverm
  \textfont1=\eighti \scriptfont1=\seveni \scriptscriptfont1=\fivei
  \textfont2=\eightsy \scriptfont2=\sevensy \scriptscriptfont2=\fivesy
  \textfont3=\tenex \scriptfont3=\tenex \scriptscriptfont3=\tenex
  \def\it{\fam\itfam\eightit}\textfont\itfam=\eightit
  \def\sl{\fam\slfam\eightsl}\textfont\slfam=\eightsl
  \def\bf{\fam\bffam\eightbf}\textfont\bffam=\eightbf
  \scriptfont\bffam=\sevenbf \scriptscriptfont\bffam=\fivebf
  \def\tt{\fam\ttfam\eighttt}\textfont\ttfam=\eighttt
  \let\sc = \eightsc
  \setbox\strutbox=\hbox{\vrule height7pt depth2pt width\z@}%
  \normalbaselineskip=9pt
  \normalbaselines \rm
}

% Fonts for the example titles.  They are defined in the first example,
% also.
% 

\def\exampletitlefonts{\clearfonts 
   \let\bf = \elevenbf
   \let\bi = \elevenbi
   \baselineskip = 13pt \bf
}

% Fonts for the subsection titles.
% 
\def\subsectionfonts{\clearfonts \let\sf = \elevensf
   \baselineskip = 12pt \sf
}


% Fonts for the section titles.
% 
\def\sectionfonts{\clearfonts \let\sf = \fourteensf
   \baselineskip = 16pt \sf
}

% Fonts for the chapter titles.
% 
\let\chapternumeralfont = \thirtysixbf

\def\chapterfonts{\clearfonts \let\bf = \twentysixrm
   \baselineskip = 32pt \bf
}

% Fonts for the table of contents.
% 
\def\shorttocfonts{\clearfonts \let\rm = \twelverm
   \baselineskip = 20pt \rm
}

\def\tocfonts{\clearfonts \let\rm = \ninerm
   \let\it = \tenit \let\bf = \tenbf
   \baselineskip = 12pt \rm
}

% Fonts for the index.
% 

\def\indexfonts{\clearfonts
   \let\rm = \eightrm
   \let\it = \eightit
   \let\tt = \eighttt
   \let\sc = \tensc
   \let\sl = \eightsl
   \textfont2 = \eightsy % For \AMSTeX.
   \let\mflogo = \eightlogo % For \Metafont.
   \normalbaselineskip = 10pt \normallineskip = 1.5pt \normalbaselines
   \setbox\strutbox=\hbox{\vrule height 7.5pt depth2.5pt width0pt}%
   \rm
}

% Fonts for the inside back cover.
% 
\def\conceptpagefonts{\clearfonts
   \let\rm = \eightrm
   \let\sc = \eightrm
   \let\sl = \nineit
   \baselineskip = 12pt
   \rm
}

% We don't want any automatic hyphenation within the code font

\hyphenchar\tentt = -1
\hyphenchar\eighttt = -1



\textfonts
