2015-03-23 <Frank.Mittelbach@latex-project.org>
[latex2e.git] / required / tools / fontsmpl.dtx
blob0bf8f9455fe1bc9ee4330b6fcd7f0ba24f42cf46
1 % \iffalse meta-comment
3 % Copyright 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005
4 % 2006 2008 2009
5 % The LaTeX3 Project and any individual authors listed elsewhere
6 % in this file.
8 % This file is part of the Standard LaTeX `Tools Bundle'.
9 % -------------------------------------------------------
11 % It may be distributed and/or modified under the
12 % conditions of the LaTeX Project Public License, either version 1.3c
13 % of this license or (at your option) any later version.
14 % The latest version of this license is in
15 %    http://www.latex-project.org/lppl.txt
16 % and version 1.3c or later is part of all distributions of LaTeX
17 % version 2005/12/01 or later.
19 % The list of all files belonging to the LaTeX `Tools Bundle' is
20 % given in the file `manifest.txt'.
22 % \fi
23 % \title{A font sampler}
24 % \author{Alan Jeffrey}
25 % \date{v0.11}
27 % \maketitle
29 % \CheckSum{335}
31 %% \CharacterTable
32 %%  {Upper-case    \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
33 %%   Lower-case    \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
34 %%   Digits        \0\1\2\3\4\5\6\7\8\9
35 %%   Exclamation   \!     Double quote  \"     Hash (number) \#
36 %%   Dollar        \$     Percent       \%     Ampersand     \&
37 %%   Acute accent  \'     Left paren    \(     Right paren   \)
38 %%   Asterisk      \*     Plus          \+     Comma         \,
39 %%   Minus         \-     Point         \.     Solidus       \/
40 %%   Colon         \:     Semicolon     \;     Less than     \<
41 %%   Equals        \=     Greater than  \>     Question mark \?
42 %%   Commercial at \@     Left bracket  \[     Backslash     \\
43 %%   Right bracket \]     Circumflex    \^     Underscore    \_
44 %%   Grave accent  \`     Left brace    \{     Vertical bar  \|
45 %%   Right brace   \}     Tilde         \~}
48 % \changes{v0.01}{1994/05/01}{Created this test document as part of
49 %    accents.dtx.}
50 % \changes{v0.02}{1994/05/12}{Added the t1enc and ot1enc packages.}
51 % \changes{v0.03}{1994/05/14}{Moved fontsmpl to its own dtx file.}
52 % \changes{v0.03}{1994/05/14}{Removed the t1enc and ot1enc packages.}
53 % \changes{v0.04}{1994/05/14}{Removed some debugging code, improved
54 %    documentation.}
55 % \changes{v0.05}{1994/05/14}{Tidied up some more.  Removed the fontenc
56 %    package.}
57 % \changes{v0.06}{1994/10/27}{Added testing for all the commands in
58 %    ltoutenc.}
59 % \changes{v0.06}{1994/10/27}{Switched off error for `commands not
60 %    defined in this encoding'.}
61 % \changes{v0.07}{1994/10/29}{Added testing for \cs{dots},
62 %    \cs{copyright} and \cs{textregistered}.}
63 % \changes{v0.07}{1994/10/29}{Replaced ??? for missing characters by
64 %    \textbf{?}.}
65 % \changes{v0.08}{1994/10/30}{Added testing for \cs{k} and \cs{t}.}
66 % \changes{v0.08}{1994/10/30}{Removed testing for any glyphs not in
67 %    usrguide.}
68 % \changes{v0.08}{1994/10/30}{Allowed overfull boxes in the accent test
69 %    to extend out into the right margin.}
70 % \changes{v0.10}{1995/09/19}{Corrected placement of docstrip guard.}
71 % \changes{v0.11}{1997/05/13}{Replaced \cs{@changed@x@err} by
72 %    \cs{TextSymbolUnavailable}, according to the change in
73 %    \texttt{ltoutenc.dtx}.}
75 % \section{Introduction}
77 % This document describes the font test document |fontsmpl.tex| and the
78 % accompanying package |fontsmpl.sty|.  This produces a test of a font
79 % family, printing a sample text, a table of accents, and a sample of
80 % commands such as |\pounds|.
82 % It can be used in two ways.  The |fontsmpl| package provides the
83 % command |\fontsample|, which produces a sample of the current font.
85 % The |fontsmpl| document prompts interactively for a font family (for
86 % example `|cmr|') and produces a sample of that family.
88 % \StopEventually{}
90 % \section{Documentation}
92 % This docstrip document has three docstrip options:
93 % \begin{itemize}
94 % \item |document| the code for |fontsmpl.tex|.
95 % \item |package| the code for |fontsmpl.sty|.
96 % \item |driver| this documentation.
97 % \end{itemize}
98 % The code for the driver is:
99 %    \begin{macrocode}
100 %<*driver>
101 \NeedsTeXFormat{LaTeX2e}
102 \documentclass{ltxdoc}
103 \begin{document}
104    \DocInput{fontsmpl.dtx}
105 \end{document}
106 %</driver>
107 %    \end{macrocode}
109 % \section{Font sample document}
111 % The sample document prompts for a family, and uses the |fontsmpl|
112 % package.  If there is a file |fontsmpl.cfg|, this is loaded.
113 % \changes{v0.9}{1995/05/07}{Removed \cs{pagestyle} empty}
114 % \begin{macrocode}
115 %<*document>
116 \NeedsTeXFormat{LaTeX2e}
117 \documentclass{article}
118 \usepackage{fontsmpl}
119 \makeatletter
120 \InputIfFileExists{fontsmpl.cfg}{}{}
121 \makeatother
122 \typein[\family]{Please enter a family name (for example `cmr').}
123 \title{Test of \LaTeX{} font family `\family'}
124 \author{Font sample produced with `fontsmpl'}
125 \raggedright
126 \begin{document}
127 \maketitle
128 \fontfamily{\family}\selectfont
129 \fontencoding{T1}\selectfont\fontsample
130 \fontencoding{OT1}\selectfont\fontsample
131 \itshape
132 \fontencoding{T1}\selectfont\fontsample
133 \fontencoding{OT1}\selectfont\fontsample
134 \slshape
135 \fontencoding{T1}\selectfont\fontsample
136 \fontencoding{OT1}\selectfont\fontsample
137 \scshape
138 \fontencoding{T1}\selectfont\fontsample
139 \fontencoding{OT1}\selectfont\fontsample
140 \upshape\bfseries
141 \fontencoding{T1}\selectfont\fontsample
142 \fontencoding{OT1}\selectfont\fontsample
143 \itshape
144 \fontencoding{T1}\selectfont\fontsample
145 \fontencoding{OT1}\selectfont\fontsample
146 \slshape
147 \fontencoding{T1}\selectfont\fontsample
148 \fontencoding{OT1}\selectfont\fontsample
149 \scshape
150 \fontencoding{T1}\selectfont\fontsample
151 \fontencoding{OT1}\selectfont\fontsample
152 \end{document}
153 %</document>
154 %    \end{macrocode}
156 % \section{Font sample package}
158 % The |fontsmpl| package is a \LaTeXe{} package.
159 %    \begin{macrocode}
160 %<*package>
161 \NeedsTeXFormat{LaTeX2e}
162 \ProvidesPackage{fontsmpl}[1994/10/29 Font sample package]
163 %    \end{macrocode}
165 % \begin{macro}{\fontsample}
166 %    The |\fontsample| command prints out a sample text, a
167 %    selection of glyphs, and a table of accents.
168 %    \begin{macrocode}
169 \newcommand{\fontsample}{%
170    Test of font \f@encoding/\f@family/\f@series/\f@shape.
171    \fontsampletext
172    \fontsampleglyphs
173    \fontsampleaccents
175 %    \end{macrocode}
176 % \end{macro}
178 % \begin{macro}{\fontsampletext}
179 %    A sample text, taken from Knuth's |testfont.tex|.
180 %    \begin{macrocode}
181 \newcommand{\fontsampletext}{%
182    Some text:
183    \begin{quote}\begin{flushleft}
184       On November 14, 1885, Senator \& Mrs.~Leland Stanford called
185       together at their San Francisco mansion the 24~prominent men who
186       had been chosen as the first trustees of The Leland Stanford
187       Junior University.  They handed to the board the Founding Grant
188       of the University, which they had executed three days before.
189       This document---with various amendments, legislative acts, and
190       court decrees---remains as the University's charter.  In bold,
191       sweeping language it stipulates that the objectives of the
192       University are ``to qualify students for personal success and
193       direct usefulness in life; and to promote the publick welfare by
194       exercising an influence in behalf of humanity and civilization,
195       teaching the blessings of liberty regulated by law, and
196       inculcating love and reverence for the great principles of
197       government as derived from the inalienable rights of man to life,
198       liberty, and the pursuit of happiness.''
199    \\
200       (!`THE DAZED BROWN FOX QUICKLY GAVE 12345--67890 JUMPS!)
201    \\
202       ?`But aren't Kafka's Schlo\ss\
203       and \AE sop's \OE uvres often na\"\i ve vis-\`a-vis the
204       d\ae monic ph\oe nix's official r\^ole in fluffy s\t ouffl\'es?
205    \\
207    \end{flushleft}\end{quote}
209 %    \end{macrocode}
210 % \end{macro}
212 % \begin{macro}{\fontsampleglyphs}
213 % \begin{macro}{\fontsampleglyph}
214 %    A list of sample glyph commands.
215 %    \begin{macrocode}
216 \newcommand{\fontsampleglyphs}{%
217    Some glyphs:
218    \begin{quote}\begin{flushleft}
219       \fontsampleglyph{\#}
220       \fontsampleglyph{\$}
221       \fontsampleglyph{\%}
222       \fontsampleglyph{\&}
223       \fontsampleglyph{\AA}
224       \fontsampleglyph{\AE}
225       \fontsampleglyph{\DH}
226       \fontsampleglyph{\DJ}
227       \fontsampleglyph{\L}
228       \fontsampleglyph{\NG}
229       \fontsampleglyph{\OE}
230       \fontsampleglyph{\O}
231       \fontsampleglyph{\P}
232       \fontsampleglyph{\SS}
233       \fontsampleglyph{\S}
234       \fontsampleglyph{\TH}
235       \fontsampleglyph{\_}
236       \fontsampleglyph{\aa}
237       \fontsampleglyph{\ae}
238       \fontsampleglyph{\copyright}
239       \fontsampleglyph{\dag}
240       \fontsampleglyph{\ddag}
241       \fontsampleglyph{\dh}
242       \fontsampleglyph{\dj}
243       \fontsampleglyph{\dots}
244       \fontsampleglyph{\guillemotleft}
245       \fontsampleglyph{\guillemotright}
246       \fontsampleglyph{\guilsinglleft}
247       \fontsampleglyph{\guilsinglright}
248       \fontsampleglyph{\i}
249       \fontsampleglyph{\j}
250       \fontsampleglyph{\l}
251       \fontsampleglyph{\ng}
252       \fontsampleglyph{\oe}
253       \fontsampleglyph{\o}
254       \fontsampleglyph{\pounds}
255       \fontsampleglyph{\quotedblbase}
256       \fontsampleglyph{\quotesinglbase}
257       \fontsampleglyph{\ss}
258       \fontsampleglyph{\textasciicircum}
259       \fontsampleglyph{\textasciitilde}
260       \fontsampleglyph{\textbackslash}
261       \fontsampleglyph{\textbar}
262       \fontsampleglyph{\textbullet}
263       \fontsampleglyph{\textcompwordmark}
264       \fontsampleglyph{\textemdash}
265       \fontsampleglyph{\textendash}
266       \fontsampleglyph{\textexclamdown}
267       \fontsampleglyph{\textgreater}
268       \fontsampleglyph{\texthyphenchar}
269       \fontsampleglyph{\textless}
270       \fontsampleglyph{\textperiodcentered}
271       \fontsampleglyph{\textquestiondown}
272       \fontsampleglyph{\textquotedblleft}
273       \fontsampleglyph{\textquotedblright}
274       \fontsampleglyph{\textquotedbl}
275       \fontsampleglyph{\textquoteleft}
276       \fontsampleglyph{\textquoteright}
277       \fontsampleglyph{\textvisiblespace}
278       \fontsampleglyph{\th}
279       \fontsampleglyph{\{}
280       \fontsampleglyph{\}}
281    \end{flushleft}\end{quote}
283 \newcommand{\fontsampleglyph}[1]{%
284    \ifx#1\@undefined
285       {\typewriterfont\string#1}~is~undefined
286    \else
287       {\typewriterfont\string#1}~is~`#1'
288    \fi
290 %    \end{macrocode}
291 % \end{macro}
292 % \end{macro}
294 % \begin{macro}{\fontsampleaccents}
295 % \begin{macro}{\fontsampleaccent}
296 %    A sample of accents.
297 %    \begin{macrocode}
298 \newcommand{\fontsampleaccents}{%
299    Some accents:
300    \begin{quote}\begin{flushleft}
301          \fontsampleaccent{\"} \\
302          \fontsampleaccent{\'} \\
303          \fontsampleaccent{\.} \\
304          \fontsampleaccent{\=} \\
305          \fontsampleaccent{\H} \\
306          \fontsampleaccent{\^} \\
307          \fontsampleaccent{\`} \\
308          \fontsampleaccent{\b} \\
309          \fontsampleaccent{\c} \\
310          \fontsampleaccent{\d} \\
311          \fontsampleaccent{\k} \\
312          \fontsampleaccent{\u} \\
313          \fontsampleaccent{\v} \\
314          \fontsampleaccent{\~}
315    \end{flushleft}\end{quote}
317 \newcommand{\fontsampleaccent}[1]{%
318    \makebox[1em][r]{\typewriterfont\string#1}
319    \makebox[15em][l]{%
320       #1A#1C#1D#1E#1G#1I#1L#1N%
321       #1O#1R#1S#1T#1U#1Y#1Z%
322       #1a#1c#1d#1e#1g#1\i#1i#1l#1n%
323       #1o#1r#1s#1t#1u#1y#1z%
324    }
326 %    \end{macrocode}
327 % \end{macro}
328 % \end{macro}
330 % \begin{macro}{\typewriterfont}
331 %    Not all sites have the T1 typewriter fonts, so we set the
332 %    typewriter font to be a fixed font.
333 %    \begin{macrocode}
334 \DeclareFixedFont{\typewriterfont}
335    {\encodingdefault}{\ttdefault}{\mddefault}{\updefault}{10}
336 %    \end{macrocode}
337 % \end{macro}
339 % \begin{macro}{\TextSymbolUnavailable}
340 %    Switch off the error message from missing glyphs.
341 %    \begin{macrocode}
342 \def\TextSymbolUnavailable#1{%
343    \textbf{?}\PackageInfo{fontsmpl}{%
344       Command \protect#1 undefined in encoding \f@encoding%
345    }%
347 %</package>
348 %    \end{macrocode}
349 % \end{macro}
350 %\Finale
351 \endinput