% pdcfsel.tex -- macros for loading fonts -*-tex-*-

%%%@TeX-document-file {
%%% title      = "PDC Font Selection Scheme",
%%% filename   = "$texmf/tex/plain/pdcmac/pdcfsel.tex",
%%% version    = "3.5",
%%% Date       = "1995/03/28",
%%% creator    = "pdcfsel.dtx",
%%% package    = "pdcmac 1.0",
%%% author     = "P. Damian Cugley",
%%% email      = "damian.cugley@comlab.ox.ac.uk",
%%% address    = "Oxford University Computing Laboratory,"
%%%               Parks Road, Oxford  OX1 3QD, UK",
%%% abstract   = "A file of definitions for managing font
%%%               selection in documents based on the plain
%%%               TeX macros.
%%%                 This file was generated by running
%%%               plain TeX on pdcfsel.dtx.",
%%% dependencies = ""
%%%}

\message{3.5 <pdc 1995/03/28>}
\def\expcs#1#2{\expandafter#1\csname#2\endcsname}
\def\noexpcs{\expcs\noexpand}
\newif\ifFSELautoload
\def\autoloadfonts{
    \FSELautoloadtrue
    \csname newwrite\endcsname \FSELfile
    \immediate\openout\FSELfile=\jobname.fnt
}
\def\loadfont#1#2{%
    \ifx#1\relax
        \FSELloadfont#1{#2}%
    \else\ifx#1\UNDEFINED
        \FSELloadfont#1{#2}%
    \fi\fi
}
\def\FSELloadfont#1#2{%
    \ifFSELautoload
        \edef#1{%
            \write\FSELfile{#2}%
            \def\noexpand\subfont{\global\font\noexpand#1cmr10 }%
            \global\font\noexpand#1#2\relax
            \noexpand\everyloadfont\noexpand#1{#2}%
            \noexpand#1%
        }%
    \else
        \global\font#1#2\relax  \everyloadfont#1{#2}%
    \fi
}
\def\everyloadfont#1#2{}
\def\xfontset#1#2#3{
    \def\f##1##2{\expcs\loadfont{#1##1}{##2#3}}
    \let\m=\f \let\M=\f
    \def\@##1##2##3{\expcs\loadfont{#1##2}{##3 at #3pt }}
    #2
}
% Set up a fontset -- define \#1fonts
\def\fontset#1#2#3#4#5#6{%
    \xfontset{#1}{#2}{#3}%
    \expcs\edef{#1fonts}{%
       \ifFSELautoload \noexpcs{#1mathsfonts}\fi
       \noexpand\FSELnicknames{#1}{#5}{#6}\noexpand#2%
       \noexpand\setbaselineskip{#4}%
       \noexpand\rm
    }%
    \ifFSELautoload
       \expcs\def{#1mathsfonts}{\FSELloadmaths{#1}{#5}{#6}#2}%
    \fi
}
\def\FSELnicknames#1#2#3{%
    \let\@\relax
    \def\f##1##2{%
       \expcs\edef{##1}{\noexpcs{#1##1}}%
    }%
    \def\m##1##2{%
       \expcs\textfont{##1fam}\csname#1##1\endcsname
       \expcs\scriptfont{##1fam}\csname#2##1\endcsname
       \expcs\edef{##1}{%
           \fam\expcs\noexpand{##1fam}%
           \expcs\noexpand{#1##1}%
       }%
    }%
    \def\M##1{%
       \expcs\scriptscriptfont{##1fam}\csname#3##1\endcsname
       \m{##1}%
    }%
}
\def\setbaselineskip#1{%
    \baselineskip#1\relax \normalbaselineskip\baselineskip
    \jot0.25\baselineskip
    \smallskipamount 0.25\baselineskip plus 0.083\baselineskip
       minus 0.083\baselineskip
    \medskipamount 0.5\baselineskip plus 0.167\baselineskip
       minus 0.167\baselineskip
    \bigskipamount 1\baselineskip plus 0.333\baselineskip
       minus 0.333\baselineskip
    \abovedisplayskip\medskipamount
    \abovedisplayshortskip\abovedisplayskip
    \advance\abovedisplayshortskip-1\abovedisplayskip
    \belowdisplayskip\medskipamount
    \belowdisplayshortskip\smallskipamount
}
\def\FSELloadmaths#1#2#3{%
    \let\@\relax \def\f##1##2{}%
    \def\m##1##2{\csname#1##1\endcsname \csname#2##1\endcsname}%
    \def\M##1{\csname#3##1\endcsname \m{##1}}%
    \global\expcs\let{#1mathsfonts}\relax
}
\chardef\rmfam=0 \chardef\mifam=1 \chardef\syfam=2
