summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/addfont/addfont.tex
blob: ac8c916ab9b568f239e29fdc0de8297b3208c688 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
% 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}