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