% Copyright 2016-21 (c) Palle Joergensen
%
% This file is part of addfont.

% addfont is free software: you can redistribute it and/or modify it
% under the terms of the GNU General Public License as published by
% the Free Software Foundation, either version 3 of the License, or
% (at your option) any later version

% addfont is distributed in the hope that it will be useful, but
% WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
% General Public License for more details.

% You should have received a copy of the GNU General Public License
% along with addfont. If not, see <http://www.gnu.org/licenses/>.
\documentclass[12pt,british,parskip=half]{scrartcl}
\usepackage[utf8]{inputenc} %
\usepackage{babel} %
\usepackage{kpfonts} %
\usepackage{listings} %
\usepackage[T1]{fontenc} %
\usepackage{addfont} %
\title{\texttt{addfont.sty} -- easier use of fonts without \LaTeX\
  support.} \author{Palle Jørgensen}
\lstset{language={[latex]tex},frame=single,morekeywords={addfont,addshape,*}}
\addfont[1.2][\hyphenchar\font-1]{OT1}{cmtt5}{\cmtt}
\addfont{OT1}{cmr5}{\cmr} \addshape{m}{it}{cmti5}
\date{Version 1.1, \today}

\begin{document}
\maketitle

\section{Introduction}
\label{sec:introduction}

This package is intended for use by users who know about fonts. It is
a quick-fix for fonts which does not have genuine \LaTeX\ support. It
is \emph{not} meant as a replacement of the \LaTeX\ font definition
files.

It is meant as something more useable for \LaTeX\ users than the
\lstinline+\newfont+ command. With addfont the loaded font scales
along with the usual \LaTeX\ size selection.

Using this package still requires some knowledge on how to use fonts
with \LaTeX.

\section{Usage}
\label{sec:usage}

To load the package type
\begin{lstlisting}
\usepackage{addfont}
\end{lstlisting}
into your preamble.

\subsection{Loading a font}
\label{sec:loading-font}

To load a font you must know the encoding and the filename of the font.

Typing
\begin{lstlisting}
\addfont{OT1}{cmr5}{\cmr}
\end{lstlisting}
makes a command `\lstinline|\cmr|' which loads the font
`\lstinline|cmr5|'. The font is in the encoding `\lstinline|OT1|'.

\lstinline|\addfont| now defines a font family for the font and creates
a command that loads the font.

Typing
\begin{lstlisting}[morekeywords=cmr]
\cmr The quick brown fox jumps over the lazy dog
\end{lstlisting}
in your document yields

{\cmr The quick brown fox jumps over the lazy dog}

\subsection{Other shapes}
\label{sec:other-shapes}

To define another shape of the font type
\begin{lstlisting}
\addshape{m}{it}{cmti5}
\end{lstlisting}
where `\lstinline|m|' is the font series and `\lstinline|it|' is the
font shape. `\lstinline|cmti5|' is the filename of the font.

as \lstinline|addshape| remembers the encoding and family of the last
added font this is not typed.

The new shape is now ready for use. Typing 
\begin{lstlisting}[morekeywords=cmr]
\cmr\itshape The quick brown fox jumps over the lazy dog
\end{lstlisting}
into your document now yields

{\cmr\itshape The quick brown fox jumps over the lazy dog}

\subsection{Fine tuning the font}
\label{sec:fine-tuning-font}

There are some optional arguments to \lstinline|\addfont| to fine
tunig the font:
\begin{lstlisting}
\addfont[1.2][\hyphenchar\font-1]{OT1}{cmtt5}{\cmtt}
\end{lstlisting}
The font is now scaled by a factor of 1.2 and the hyphenchar is set to
$-1$ (hyphenation not allowed).

{\cmtt\itshape The quick brown fox jumps over the lazy dog}

Scaling is mostly for using a mix fonts of fonts not originalle
designed to be used together.

\subsection{Generic description}
\label{sec:generic-description}

The general scheme is
\begin{lstlisting}
\addfont[scale][cmds]{encoding}{font name}{\macro}
\end{lstlisting}

where 
\begin{description}
\item[scale] is the factor to scale the font. This is normally not
  necesary.
\item[cmds] are commands to be executed at font selection. Typically
  setting the hyphen char of a monospaced font and nothing for other
  types of fonts.
\item[encoding] is the encoding scheme of the font.
\item[font name] is the file name of the \texttt{tfm}-file of the font
  without the \texttt{tfm} extension.
\item[\textbackslash macro] is the macro to use the font.
\end{description}

The general font shape scheme is
\begin{lstlisting}
\addshape[cmds]{series}{shape}{font name}
\end{lstlisting}

where 
\begin{description}
\item[cmds] are commands to be executed at font selection. Typically
  nothing.
\item[series] is the font series.
\item[shape] is the font shape.
\item[font name] is the file name of the \texttt{tfm}-file of the font.
\end{description}

\subsection{Font size selection}
\label{sec:font-size-selection}

The \lstinline|addfont| by default sets up to font to be used with a
fixed set of sizes. The sizes are the sizes normally used for the
Computer Modern fonts, 5pt, 6pt, 7pt, 8pt, 9pt, 10pt, 10.95pt, 12pt,
14.4pt, 17.28pt, 20.74pt, and 24.88pt respectively.

To use a font at \emph{any} size replace \lstinline|addfont| with
\lstinline|addfont*|.

\section{Limitations}
\label{sec:limitations}

As written in the introduction this package is not meant as a
replacement of writing customized \LaTeX\ font definition files. Thus
it does not provide all the features of \LaTeX\ font selection.

\section{License}
\label{sec:license}

\texttt{addfont} i copyright \textcopyright\ Palle Jørgensen,
2016-21

\texttt{addfont} is free software: you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.

\texttt{addfont} is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.

\end{document}
