From e0c6872cf40896c7be36b11dcc744620f10adf1d Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Mon, 2 Sep 2019 13:46:59 +0900 Subject: Initial commit --- macros/generic/fntproof/README | 44 +++ macros/generic/fntproof/fntproof-doc.pdf | Bin 0 -> 201650 bytes macros/generic/fntproof/fntproof-doc.tex | 578 +++++++++++++++++++++++++++++++ macros/generic/fntproof/fntproof.tex | 377 ++++++++++++++++++++ 4 files changed, 999 insertions(+) create mode 100644 macros/generic/fntproof/README create mode 100644 macros/generic/fntproof/fntproof-doc.pdf create mode 100644 macros/generic/fntproof/fntproof-doc.tex create mode 100644 macros/generic/fntproof/fntproof.tex (limited to 'macros/generic/fntproof') diff --git a/macros/generic/fntproof/README b/macros/generic/fntproof/README new file mode 100644 index 0000000000..5da89f9df1 --- /dev/null +++ b/macros/generic/fntproof/README @@ -0,0 +1,44 @@ +Files: fntproof.tex, fntproof-doc.tex fntproof-doc.pdf + +Purpose: + + The file fntproof.tex is essentiallly Knuth's testfont.tex, modified + to make all tests noninteractive (no prompting for data). + +License: + + All files are public domain. + +Usage: + + You can input fntproof in a file, and then use the commands in that + file, or you can type the commands on the command line. By default, + the first "word" after the fntproof.tex has been read in is taken to + be the TFM name of a font to test. Use \noinit to delay the reading of + the font name. + +Examples: + + Command line: + tex fntproof cmti10 + tex fntproof \noinit Normal text. \init cmti10 + + In a file: + \input fntproof cmr10 + \input fntproof \noinit Normal text. \init cmti10 + + include \table, \text, \sample which produce, respectively, + - a table of characters in the font, + - some text using the font, and + - both of the above. + + All commands available in testfont.tex are included (in noninteractive + versions). + +Documentation: + See fntproof-doc.pdf for complete documentation. It may be regenerated + by running pdflatex (twice) on fntproof-doc.tex. + +-- +Daniel Luecking +luecking AT-SIGN uark DOT edu diff --git a/macros/generic/fntproof/fntproof-doc.pdf b/macros/generic/fntproof/fntproof-doc.pdf new file mode 100644 index 0000000000..0a2745e88e Binary files /dev/null and b/macros/generic/fntproof/fntproof-doc.pdf differ diff --git a/macros/generic/fntproof/fntproof-doc.tex b/macros/generic/fntproof/fntproof-doc.tex new file mode 100644 index 0000000000..5937314c07 --- /dev/null +++ b/macros/generic/fntproof/fntproof-doc.tex @@ -0,0 +1,578 @@ +\documentclass[draft]{article} +\usepackage{mflogo} +\addtolength\textwidth{.5in} +\addtolength\oddsidemargin{-.25in} +\usepackage{verbatim} +\newcommand\prog[1]{\texttt{#1}} +\newcommand\file[1]{\texttt{#1}} +\newcommand\env[1]{\texttt{#1}} +\renewcommand\"{\verb"} + +\newcommand\meta[1]{$\langle$\textit{#1}$\rangle$} +\title{How to use \file{fntproof.tex}\\ and \file{testfont.tex}} +\author{Dan Luecking\thanks{\copyright 2010 + by Daniel H. Luecking. This software is public domain. If you make any + changes to this document, please remove or modify this copyright notice + before distributing your version, preferably with a different name. + This documents version 1.0 of \file{fntproof}}} + +\begin{document} + +\maketitle + +\begin{abstract} + The macro file \file{fntproof.tex} is a noninteractive version of + D.~E.~Knuth's \file{testfont.tex}. Instead of prompting for font names + and commands, the user supplies them on the command line, or in a file. +\end{abstract} + + +\section{Introduction} + +I used to often run \prog{tex} on \file{testfont.tex}, which prompts for +a font name and prompts for a command. Often, after ending the session, +I would want to run almost the same command on almost the same font and +would have to type almost everything over again, or else deal with my +\prog{tex} program's rather primitive line recall/editing mechanism. + +Since I run \prog{tex} in a command shell which has better command line +recall and rather better line editing capabilities than my \prog{tex} +has, I wrote \file{fntproof.tex} to give me the same capabilities as +\file{testfont.tex}, but allow me to specify the font and the commands +on the command line. + +This is the documentation of \file{fntproof}. Since \file{testfont.tex} +has no documentation outside of ``The \MF book'', I am also also +documenting it. The reader is assumed to have some minimal knowledge of +plain \TeX{}, especially the ``\"\font"'' command. + +Apart from the fact that \file{fntproof} can read the fontname from the +command line, there are few differences between \file{testfont.tex} and +\file{fntproof.tex}: + +\begin{itemize} + \item In \file{testfont}, the \"\init" command prompts for a fontname, + while \file{fntproof} arranges to read one typed on the command + line or in a file. + + \item In \file{testfont}, \"\mixture", \"\alternation" and \"\series" + issue three prompts, while in \file{fntproof} they read three + arguments. + + \item In \file{testfont}, \"\alphabet" and \"\ALPHABET" issue a + prompt, while in \file{fntproof} they read an argument. + + \item In a \LaTeX{} document, \file{testfont} redefines the \"\table" + command, destroying the \env{table} environment, while + \file{fntproof} tries to detect \LaTeX{} and leave \"\table" + alone. The command \"\fonttable" then takes the place of + \file{testfont}'s \"\table" command. + + \item In \file{testfont}, the primitive \TeX{} command \"\fontname" is + also overwritten, while \file{fntproof} uses a different + internal name for the same purpose. This require a couple of + other minor differences to be discussed later. + + \item There are a few useful commands added. +\end{itemize} + +Like \file{testfont}, \file{fntproof} can print a table of the font's +characters and a bit of sample text and run other tests. It has +noninteractive versions of all the interactive commands allowed by +\file{testfont}. + + +\section{Example command lines}\label{examples} + +\begin{itemize} + \item Produce sample text of cmr10: +\begin{verbatim} + tex fntproof cmr10 \text\bye +\end{verbatim} + + \item Produce a table of cmr10 and sample text of cmti10 (pdf output). + Note the use of ``\"\init"'' to change to the new font: +\begin{verbatim} + pdftex fntproof cmr10 \table \init cmti10 \text\bye +\end{verbatim} + + \item Produce a table and a test of digits for cmr10, only a table for + cmti10 at 12pt: +\begin{verbatim} + tex fntproof cmr10 \table\digits\init{cmti10 at 12pt}\table\bye +\end{verbatim} + + \item Obtain a list of available commands and their meanings +\begin{verbatim} + pdftex fntproof \help \end +\end{verbatim} +\end{itemize} + +Your command line interpreter may require you to quote or escape +backslashes or other of its special characters in these examples. I am +able to run all of these as-is in a command window under Windows XP +using TeX Live 2008--2010. Of course the output appears in +\file{fntproof.dvi} or \file{fntproof.pdf}. + + +\section{The commands} + +A font can be specified by its TFM filename followed by a space (or a +line end). Font filenames are allowed to contain most of \TeX{}'s +special characters when \file{fntproof} is used. However, they cannot +contain spaces or other whitespace characters, and they cannot begin +with a left brace~(\"{"). There are even more limitations on the TFM +filename typed at \file{textfont}'s prompt, as most special +\TeX{} characters cause some problem or other. + +A command applies to the font most recently specified. The following +commands are available. They are the same as those provided by the +interactive version, \file{testfont.tex}, except they do not prompt for +input, but require any arguments to follow the command. + +\begin{itemize} + \item \"\sample" \"\table" \"\text"\\ + \"\sample" produces a table and some sample text; \"\table" produces + only the table, \"\text" only the text. + + \item \"\mixture"\\ + This takes three characters as arguments. The first character + (the ``background'') is mixed among all the characters from the + second argument to the third. For example, ``\"\mixture Xaz"'' produces +\begin{verbatim} + XaXXaaXXXaaaXa + XbXXbbXXXbbbXb + ... +\end{verbatim} + and so on, until z. + + \item \"\alternation"\\ + This is like \"\mixture", except ``\"\alternation Xaz"'' + produces lines like +\begin{verbatim} + XaXaXaXaXaXaXaXaX + XbXbXbXbXbXbXbXbX + ... +\end{verbatim} + and so on. + + \item \"\series"\\ + Like the previous two it takes 3 arguments, but produces a + single line containing all the characters in the sequence. Thus, + ``\"\series Xaz"'' produces +\begin{verbatim} + XaXbXcXdXeXfXgXhXiXjXkXlXmXnXoXpXqXrXsXtXuXvXwXxXyXzX +\end{verbatim} + + \item \"\alphabet" \"\ALPHABET"\\ + These take one character as argument. It is the ``background'' + and is mixed among all the lowercase, respectively uppercase + letters. So ``\"\ALPHABET x"'' is almost like + ``\"\series xAZ"'', but also includes the characters \AE, \OE, + and \O, while ``\"\alphabet X"'' is like ``\"\series Xaz"'', but + also includes \ae, \oe, \o, and \ss. + + \item \"\lowers" \"\uppers" \"\digits" \"\names" + \"\punct"\\ + These perform comprehensive tests of lowercase, uppercase, + digits, names and punctuation. For example, \"\lowers" is + like +\begin{verbatim} + \alphabet a \alphabet b ... +\end{verbatim} + + and \"\digits" is like +\begin{verbatim} + \series 009 \series 109 \series 209 ... +\end{verbatim} + + \item \"\bigtest" \"\math"\\ + \"\bigtest" includes (more or less) all the previous + commands. \"\math" produces a large set of tests of math + (the font should be a math alphabetic font like cmmi10). + + \item \"\help" \"\init" \"\noinit"\\ + \"\help" produces a summary of available commands on the screen. + + \"\init" prepares for the next font. In \file{testfont}, it + issues a prompt for a fontname and need not be invoke for the + first font, which is prompted for immediately after input. + In \file{fntproof}, it reads the following fontname, and it need + not be used before the first font (see the examples in + section~\ref{examples}), unless the filename begins with a + \TeX{} special character. + + \"\noinit" turns off this automatic initialization. Use it when + you want some text before the first font test, or if you want + the current font to be used. Its syntax differs between + \file{fntproof} and \file{testfont}, see below. +\end{itemize} + +Note: In \file{fntproof}, \"\init" examines the first following +nonspace character. If that is a left brace (i.e., ``\"{"'') +\"\init" assumes the font name is contained between that left brace +and the first matching right brace~(``\"}"''). +Multi-part font specifications (such as ``\"cmr10 at 12pt"'') must be +enclosed in braces, and this \emph{must} be preceded by \"\init". + +For the commands that take character arguments, the actual characters +might not be printed, especially in symbol fonts. Instead, the glyphs in +the corresponding positions will appear. Most printable ASCII characters +can be used in the argument, but not ``\"{"'', ``\"}"'', ``\"\"'' or space. In +place of a literal character one can supply a numerical position in the +font. This command: +\begin{verbatim} + \mixture X{#97}{#122} +\end{verbatim} +has the same effect as this one: +\begin{verbatim} + \mixture Xaz +\end{verbatim} +The numeric part of the argument (everything after after the \"#") can +be (probably) any valid \TeX{} number. Your command line interpreter may +require you to escape or ``quote'' the double quote marks which are used +in \TeX{} for hexadecimal, the single quote marks used for octal or the +back quote used in character code notation. + +A numerical argument must be enclosed in braces: a ``\"#"'' not in braces +(or alone in braces) will be taken literally. For example, +\begin{verbatim} + \mixture #120az +\end{verbatim} +would read ``\"#"'', ``\"1"'' and ``\"2"'' as the arguments and the rest, +``\"0az"'', as plain \TeX{} code (i.e., characters to be printed). + +It should be noted that the implementation of \"\series" does not +allow any ligatures or kerns between adjacent characters. This is also +true of the commands based on \"\series": \"\alphabet", \"\ALPHABET", +\"\lowers", \"\uppers", and \"\digits". It is true for both +\file{testfont} and \file{fntproof}, which use the same internal +implementation. If one wants to test these properties of a font, one +must type in ones own text (see the following section). + +Another limitation: in the ``\"\alphabet"'' and ``\"ALPHABET"'' +commands, if the font has an encoding other than OT1, then the +characters \ae, \oe, \o, \ss, \AE, \OE, and \O{} may not appear as +advertised, since the implementation accesses them by position +number. For PostScript fonts, a black box may appear where these +characters should be. + +In addition to the commands listed, which are common to \file{fntproof} +and \file{testfont}, \file{fntproof} supplies the following extra +commands, not available in \file{testfont}. + +\begin{itemize} +\item \"\initcurrentfont"\\ + Use this to perform the functions of \"\init" on the current font. + This would normally be preceded by commands selecting the desired + font. See section~\ref{latex} for a \LaTeX{} example. + +\item \"\noinit"\\ + In \file{testfont}, the only way to use this is to say + \"\let\noinit=!" \emph{before} inputting \file{testfont.tex}. This + cancels the immediate prompt for a font filename. But in + \file{fntproof}, ``\"\noinit"'' can also be used immediately + \emph{after} inputting \file{fntproof}. Either use cancels + \file{fntproof}'s assumption that the first following word is the + name of the font to be selected. This allows ordinary text to be + inserted before selecting a font. After this, the command \"\init" + allows a font to be specified. + +\item \"\headersfalse" \"\headerstrue" \"\theheader"\\ + A side effect of the \"\init" command (including one implicitly + invoked by a font name following the input of \file{fntproof}) is + the printing of a single header line similar to the following: +\begin{verbatim} + Test of cmti10 on July 31 at 1244 +\end{verbatim} + Use ``\"\headersfalse"'' to force the omission of all such headers + for any subsequent font. Use ``\"\headerstrue"'' to resume the + default behavior. In any circumstance, the header text can be + printed using ``\"\theheader"''. + +\item \"\thisfont" \"\getthisfont"\\ + The macro ``\"\thisfont"'' produces the name of the font most + recently specified by an explicit or implicit \"\init" or by + \"\initcurrentfont". If no such initialization was done, + ``\"\getthisfont"'' will cause \"\thisfont" to be defined to the + text produced by the command sequence \"\fontname\font" (i.e., the + tfm filename of the current font---plus any ``\texttt{scaled}'' or + ``\texttt{at}'' clause). + +\item \"\fonttable"\\ + As already mentioned, this is the alternative to \"\table" that must + be used in \LaTeX{}. It can also be used in plain \TeX{}. + +\end{itemize} + + +\section{Other \TeX{} commands} + +\TeX{} commands besides the above can be inserted at any point except +between \"\init" and the next fontname. No guarantee is given that they +they will have the expected effect. Text will be printed in the whatever +font is current. No text should be typed between ``\file{fntproof}'' and +the first fontname or else it will be mistaken for a font (but see +\"\noinit" above and examples of its use below). + +If the command line does not end in \"\end" or \"\bye", \TeX{} will wait +for more input in its usual way, with a ``\texttt{*}'' prompt. If additional +commands from the above list are entered (except \"\init"), they will be +applied to the previously named font. Moreover, a new font name can be +entered (after \"\init"). Of course, any plain \TeX{} commands can be +entered. The session can be ended by entering \"\end" or \"\bye". + + +\section{Use as a macro file} + +Like \file{testfont.tex}, \file{fntproof.tex} allows the commands to be +used in a file rather than interactively, or on the command line. One +can do this by writing ``\"\let\noinit=!"'' before inputting +\file{testfont} or \file{fntproof}. This is somewhat more useful for +\file{fntproof} than for \file{testfont} as \emph{all} the \file{fntproof} +commands are noninteractive. + +Unlike \file{testfont}, \file{fntproof} also allows you to simply type +``\"\noinit"'' \emph{immediately after} inputting it, for the same +effect. For example, with \file{testfont} one would initialize the font +oneself and then issue commands: +\begin{verbatim} + \let\noinit=! \input testfont + Ordinary text in default font. + \def\fontname{cmti10}\startfont \table \text \bye +\end{verbatim} +Note that ``initializing a font'' after \file{testfont} is loaded +amounts to defining \"\fontname" and then using the \"\startfont" +command. The above example will produce a table and sample text of +cmti10. Note that \"\startfont" alone will not work. If both steps are +omitted, the \"\table" command will build a table of the current font, +but certain preparatory steps will not be taken and some commands (but +not \"\table") will produce errors. + +The corresponding \file{fntproof} method would be the following. Note +that this could also be typed on the command line (all on one line) +after the tex command (in that case the ``\"\input"'' would be omitted): +\begin{verbatim} + \input fntproof \noinit + Ordinary text in default font. + \init cmti10 \table \text \bye +\end{verbatim} +Note that \file{testfont.tex} causes the \TeX{} primitive command +\"\fontname" to be redefined. The macros in \file{fntproof} do not do +this, but instead use \"\thisfont" for the same internal purposes as +\file{testfont} uses \"\fontname". + +If one wanted to initialize a font immediately (with no intervening +text in some other font), even this \"\noinit" hack is unnecessary: +\begin{verbatim} + \input fntproof cmr10 \table \text \bye +\end{verbatim} +This would perform the auto-\"\init" on cmr10. In this case, any +\"\headersfalse" command would have to be put just before the font name. +Otherwise, it need only come before the next \"\init" command. + +In \file{testfont}, a command like \"\mixture" would produce three +prompts to get the character or numeric arguments. For the corresponding +\file{fntproof} commands, these arguments must be supplied and no +interactive prompt occurs. One can get around these interactive prompts +in \file{testfont}, but it is rather inconvenient: + +\begin{itemize} +\item with \file{testfont}: +\begin{verbatim} +\let\noinit! \input testfont +Some text in default font. Here is a mixture in cmti: +\chardef\background`X +\chardef\starting`a +\chardef\ending`z +\def\fontname{cmti10}\startfont +\domix\mixpattern% \altpattern for the effect of \alternation +\bye +\end{verbatim} + +\item with \file{fntproof}: +\begin{verbatim} +\input fntproof \noinit +Some text in default font. Here is a mixture in cmti: +\init cmti10 \mixture Xaz \bye +\end{verbatim} +\end{itemize} + +For completeness, here are the other ways to avoid the interactive +prompt when using \file{testfont} (right), compared to each of the +\file{fntproof} commands (left). + +\begin{itemize} + \item \"\series Xaz" $\Rightarrow$ \"\chardef\background`X\!\doseries{`a}{`z}\par" + \item \"\alphabet X" $\Rightarrow$ \"\chardef\background`X\complower" + \item \"\ALPHABET X" $\Rightarrow$ \"\chardef\background`X\compupper" +\end{itemize} + +In the \"\doseries" command, the arguments can be numbers: +\"\doseries{97}{122}" is the same as \"\doseries{`a}{`z}". You can use +numbers in the \"\chardef" commands. For example +``\"\chardef\background88 "'' is the same as ``\"\chardef\background `X"''. +Note: a space (or end-of-line) after explicit digits is almost +mandatory to terminate the number before any following macros are +expanded. + +Instead of ``\"\init" \meta{tfmname}'', one can use normal font +selection commands, followed by ``\"\initcurrentfont"'', and then the +testing commands (e.g., \"\fonttable", \"\text"). For example, +\begin{verbatim} + \input fntproof + \font\x=cmdunh10 at 12pt \x + \initcurrentfont \table \text \bye +\end{verbatim} +See the next section for an example in \LaTeX{}. To do this with +\file{testfont} would require the following incantations: +\begin{verbatim} + \let\originalfontname\fontname + \let \noinit=! + \input testfont + \font\x=cmdunh10 at 12pt \x + \edef\fontname{\originalfontname\font}% + \startfont \table \text \bye +\end{verbatim} + +Note that \"\init", \"\initcurrentfont" and some of the testing commands +change some \TeX{} parameters. This could affect the typesetting of the +rest of the document, so it might be wise to enclose a session of font +testing in a group, if your document contains other material. + +Note also that the mere loading of \file{fntproof} or \file{testfont} +invokes the following settings: +\begin{verbatim} + \tracinglostchars=0 + \tolerance=1000 + \raggedbottom + \parindent=0pt + \hyphenpenalty=200 + \doublehyphendemerits=30000 +\end{verbatim} +These are suitable for the running of tests on fonts. If the rest of +your document needs different parameters, it is your responsibility to +reset these afterward. There are also numerous internal macros used by +both \file{testfont} and \file{fntproof} that are not protected by +having \texttt{@} in there name. This is another reason to input the +macro file and use the testing macros inside a group. + +Finally, \file{testfont} turns off page numbering (in plain \TeX) when loaded. + + +\section{Use with \LaTeX{}}\label{latex} + +In \LaTeX{}, printable text has to come after \"\begin{document}" so a +minimal command line could be (typed without pressing [Enter] or [Return]): +\begin{verbatim} + latex fntproof \noinit \documentclass{article}\begin{document} + \init cmr10 \fonttable \end{document} +\end{verbatim} + +Thus with \LaTeX{}, \file{fntproof} might better be used in a file. Note +also that \"\fonttable" is used instead of \"\table" to avoid destroying +\LaTeX{}'s table environment. For example, +\begin{verbatim} + \documentclass[12pt]{article} + \begin{document} + \input fntproof + \fontencoding{T1}\fontfamily{bch}\selectfont + \initcurrentfont + \fonttable + \end{document} +\end{verbatim} +This would produce a table of the Bitstream Charter font.. + +The above font selection commands ultimately load the TFM file +\texttt{bchr8t} magnified to \texttt{12pt}. Thus, the header +text actually looks something like this: +\begin{verbatim} + Test of bchr8t at 12.0pt on October 7, 2010 at 1649 +\end{verbatim} +Moreover, ``\"\thisfont"'' will acquire the definition ``\texttt{bchr8t +at 12.0pt}''. + +I have not tested \file{testfont.tex} much in \LaTeX{}. After the +\"\let\noinit=!" hack, inputting \file{testfont} causes an +error because \"\nopagenumbers" is undefined. Then the command +\"\table", \"\text", or \"\sample" cause an error because \"\sevenrm" is +undefined, but otherwise proceed correctly. + + +\section{History} + + 2009/05/05 -- first version\\ + 2009/07/31 -- add \"\noinit", \"\ifheaders", \"\theheader"\\ + 2009/11/12 -- revised documentation (comments)\\ + 2010/01/03 -- further documentation revisions\\ + 2010/10/11 -- documentation moved to separate file, added + \"\initcurrentfont" and \"\getthisfont". + +\bigskip + +\section{Appendix} + +The output of \file{fntproof}'s \"\help" command: +\begin{verbatim} +=== Main commands ============== +\init switches to another font; +\end or \bye finishes the run; +\table prints the font layout in tabular format; +\fonttable must be used instead of \table in LaTeX; + \text prints a sample text, assuming TeX text font conventions; +\sample combines \table and \text; +\mixture mixes a background character with a series of others; +\alternation interleaves a background character with a series; +\alphabet prints all lowercase letters within a given background +\ALPHABET prints all uppercase letters within a given background +\series prints a series of letters within a given background; +\lowers prints a comprehensive test of lowercase; +\uppers prints a comprehensive test of uppercase; +\digits prints a comprehensive test of numerals; +\math prints a comprehensive test of TeX math italic; +\names prints a text that mixes upper and lower case; +\punct prints a punctuation test; +\bigtest combines many of the above routines; +\help repeats this message; +and you can use ordinary TeX commands (e.g., to \input a file). +=== More commands ============== +\noinit turns off automatic initialization of the first word as a font; +\headersfalse \headerstrue turn off/resume printing of header text; +\theheader print the header text; +\thisfont print the name of font specified by \init; +\getthisfont define \thisfont to be the current font; +================================== +\end{verbatim} + +\bigskip +\filbreak +\noindent The output of \file{testfont}'s \"\help" command: +\begin{verbatim} +\init switches to another font; +\end or \bye finishes the run; +\table prints the font layout in tabular format; +\text prints a sample text, assuming TeX text font conventions; +\sample combines \table and \text; +\mixture mixes a background character with a series of others; +\alternation interleaves a background character with a series; +\alphabet prints all lowercase letters within a given backgroun +\ALPHABET prints all uppercase letters within a given backgroun +\series prints a series of letters within a given background; +\lowers prints a comprehensive test of lowercase; +\uppers prints a comprehensive test of uppercase; +\digits prints a comprehensive test of numerals; +\math prints a comprehensive test of TeX math italic; +\names prints a text that mixes upper and lower case; +\punct prints a punctuation test; +\bigtest combines many of the above routines; +\help repeats this message; +and you can use ordinary TeX commands (e.g., to \input a file). +\end{verbatim} + +\bigskip +\filbreak +\noindent Knuth's original \file{testfont.tex} comment:\\ +\texttt{\% A testbed for font evaluation (see The METAFONTbook, Appendix H)} + +\end{document} + diff --git a/macros/generic/fntproof/fntproof.tex b/macros/generic/fntproof/fntproof.tex new file mode 100644 index 0000000000..70578bc26f --- /dev/null +++ b/macros/generic/fntproof/fntproof.tex @@ -0,0 +1,377 @@ +% fntproof.tex +% +% Copyright 2010 by Daniel H. Luecking. Placed in the public domain. +% If you make any changes, please remove or modify this copyright notice +% before distributing your version, preferably with a different name. +% +% This is a noninteractive version of testfont.tex. Instead of prompting +% for font names and commands, the user supplies them on the command +% line, or in a file. +% +% +% Original testfont.tex comment: +% A testbed for font evaluation (see The METAFONTbook, Appendix H) +% +% (Most code changes from testfont.tex are explained in comments preceded +% by "%DHL:") +% +\def\fntproofversion{1.0} +\immediate\write16{This is fntproof.tex, version \fntproofversion.} +\tracinglostchars=0 +\tolerance=1000 +\raggedbottom +\parindent=0pt +\hyphenpenalty=200 +\doublehyphendemerits=30000 +\hyphenation{prom-i-nent}% +% +\newcount\m \newcount\n \newcount\p \newdimen\dim +\chardef\other=12 +% +\def\today{\ifcase\month\or + January\or February\or March\or April\or May\or June\or + July\or August\or September\or October\or November\or December\fi + \space\number\day, \number\year}% +\def\hours{\n=\time \divide\n 60 + \m=-\n \multiply\m 60 \advance\m \time + \twodigits\n\twodigits\m}% +\def\twodigits#1{\ifnum #1<10 0\fi \number#1}% +% +%DHL: These are used to sanitize the fontname. +% Odd capitals to avoid overwriting other's macros (Knuth's own +% overwriting notwithstanding :) +\def\sTripprefix#1>{}% +\def\sAnitize#1{\edef#1{\expandafter\sTripprefix\meaning#1}} +\def\gobble#1{}% +\def\firstofone#1{#1}% +% +% Modified from ifmtarg.sty, works around certain errors. +\begingroup + \catcode`\Q=3 + \long\gdef\xifmtarg#1#2Q#3#4#5\relax{#4}% + \long\gdef\ifnotempty#1{\xifmtarg#1QQ\firstofone\gobble\relax}% +\endgroup +% +%DHL: For debug purposes: a command to read and show the file name. +% This to test whether TeX special characters in the font name are +% properly handled. +%\def\showfont{% +% \begingroup +% \def\do##1{\catcode`##1=\other}\dospecials +% \catcode`\ =10\relax\xshowfont +%}% +%\def\xshowfont#1 {% +% \newlinechar`\^^J% +% \message{^^J --> Font name #1 read from command line. <--^^J}% +% \endgroup +%}% +% +%DHL: \init will not prompt, but just read up to the next space. +% We allow anything but whitespace in a filename. The filename argument +% (of \xinit) is delimited by the next space. Alternatively, an +% initial left brace is assumed to be grouping around the full font +% name. In that case, \yinit reads the whole group +\def\init{\futurelet\next\doinit}% to see if a brace follows +\def\doinit{% + \begingroup + \def\do##1{\catcode`##1=\other}\dospecials\catcode`\ =10\relax + \ifx\next\bgroup + \catcode`\{=1 \catcode`\}=2 + \expandafter\yinit + \else + \expandafter\xinit + \fi} +\def\yinit #1{\fininit{#1}}% +\def\xinit#1 {\fininit{#1}}% +\def\fininit#1{% + \def\thisfont{#1}\sAnitize\thisfont\global\let\thisfont\thisfont + \endgroup + \par\everypar{}% + \startfont +}% +% +%DHL: +% This defines \everypar so that the first fontname triggers \init, +% a lot like mproof.tex. +\def\Init{\par\everypar{{\setbox0\lastbox}\everypar{}\init}}% +% +%DHL: \startfont is identical to the one in testfont.tex, except I've +% added a \filbreak between fonts and a conditional to turn off the +% header. +\def\startfont{\font\testfont=\thisfont \spaceskip=0pt + \filbreak + \ifheaders \par + \leftline{\sevenrm Test of \thisfont\unskip\ on \today\ at \hours}% + \fi + \medskip + \testfont \setbaselineskip + \ifdim\fontdimen6\testfont<10pt \rightskip=0pt plus 20pt + \else\rightskip=0pt plus 2em \fi + \spaceskip=\fontdimen2\testfont % space between words (\raggedright) + \xspaceskip=\fontdimen2\testfont \advance\xspaceskip by\fontdimen7\testfont}% +% +\newif\ifheaders \headerstrue +%DHL: +% \getthisfont defines \thisfont to be the \fontname of the current +% font. Unlike \init it does not sanitize \thisfont as \fontname returns +% category 12 characters. +% +% \initcurrentfont performs the functions of \init on the current font, +% including defining \thisfont. +% +% \theheader prints the header even when \headersfalse was issued. It +% requires a definition for \thisfont. +\def\getthisfont{\edef\thisfont{\fontname\font}}% +\def\initcurrentfont{\noinit\getthisfont\startfont}% +\def\theheader{% + \leftline{\sevenrm Test of \thisfont\ on \today\ at \hours}}% +% +%DHL: +% One change to \help is use of "^^J" instead of "@" as \newlinechar. +% Since no other command needs this, I have made it a local assignment. +% I've added some delimiting lines as well. +\begingroup +\catcode`\|=0 \catcode`\\=\other +|gdef|help{{|newlinechar`^^J|message{^^J% +=== Main commands ==============^^J% +\init switches to another font;^^J% +\end or \bye finishes the run;^^J% +\table prints the font layout in tabular format;^^J% +\fonttable must be used instead of \table in LaTeX;^^J +\text prints a sample text, assuming TeX text font conventions;^^J% +\sample combines \table and \text;^^J% +\mixture mixes a background character with a series of others;^^J% +\alternation interleaves a background character with a series;^^J% +\alphabet prints all lowercase letters within a given background;^^J% +\ALPHABET prints all uppercase letters within a given background;^^J% +\series prints a series of letters within a given background;^^J% +\lowers prints a comprehensive test of lowercase;^^J% +\uppers prints a comprehensive test of uppercase;^^J% +\digits prints a comprehensive test of numerals;^^J% +\math prints a comprehensive test of TeX math italic;^^J% +\names prints a text that mixes upper and lower case;^^J% +\punct prints a punctuation test;^^J% +\bigtest combines many of the above routines;^^J% +\help repeats this message;^^J% +and you can use ordinary TeX commands (e.g., to \input a file).^^J% +=== More commands ==============^^J% +\noinit turns off automatic initialization of the first word as a font;^^J% +\headersfalse \headerstrue turn off/resume printing of header text;^^J% +\theheader print the header text;^^J% +\thisfont print the name of font specified by \init;^^J% +\getthisfont define \thisfont to be the current font;^^J% +==================================^^J^^J}}}% +|endgroup +% +\def\setbaselineskip{\setbox0=\hbox{\n=0 +\loop\char\n \ifnum \n<255 \advance\n 1 \repeat} +\baselineskip=6pt \advance\baselineskip\ht0 \advance\baselineskip\dp0 }% +% +%DHL: This is used just before reading character arguments. +\def\beginspecial{% + \begingroup + \def\do##1{\catcode`##1=\other}\dospecials + \catcode`\{=1\catcode`\}=2\catcode`\\=0\catcode`\ =10 +}% +\let\endspecial\endgroup +% +%DHL: +% We delay reading anything until the \catcode changes in \beginspecial. +\long\def\setchar{\beginspecial\Xsetchar}% +% +%DHL: +% #1 is the character name (\background, \starting or \ending) +% #2 is the command to be run after the characters are "set". +% #3 is the actual character. +% Calls \dosetchar, then ends group and issues saved command +\long\def\Xsetchar#1#2#3{\dosetchar#1{#3}\endspecial#2}% +% +%DHL: +% #1 as in \Xsetchar +% #2 actual character +% Inserts character as a delimited parameter for \finsetchar +% We could do all this in \Xsetchar, but I needed to isolate +% this part for use in \getthree. +\def\dosetchar#1#2{% + \def\next{#2}\expandafter\finsetchar\next\next#1}% +% +%DHL: +% #1 is first token of character, #2 is the rest, possibly empty +% #3 is the character command (same as #1 in \setchar). +% If the first part is #, and the rest is not empty, assume the rest is +% a number. +\def\finsetchar#1#2\next#3{\global\chardef#3=`#1 + \ifnum #3=`\#\relax \ifnotempty{#2}{\global\chardef#3=#2\relax}\fi}% +% +%DHL: +% As \setchar no longer prompts for input, \promptthree is +% changed to \getthree. +\def\getthree{% + \beginspecial + \dogetthree +}% +\long\def\dogetthree#1#2#3#4{% + \dosetchar\background{#2}% + \dosetchar\starting{#3}% + \dosetchar\ending{#4}% + \endspecial#1% +}% +%DHL: The commands themselves. Very few changes at from here +% to the end. +% +%DHL: +% Extra braces in \mixture and \alternation because \getthree takes +% the code to run as an argument. This is so it can get at the character +% arguments that follow. +\def\mixture{\getthree{\domix\mixpattern}}% +\def\alternation{\getthree{\domix\altpattern}}% +\def\mixpattern{\0\1\0\0\1\1\0\0\0\1\1\1\0\1}% +\def\altpattern{\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0}% +\def\domix#1{\par\chardef\0=\background \n=\starting + \loop \chardef\1=\n #1\endgraf + \ifnum \n<\ending \advance\n 1 \repeat}% +% +\def\!{\discretionary{\background}{\background}{\background}}% +%DHL: Extra braces in \series also. Same reason as above. +\def\series{\getthree{\!\doseries\starting\ending\par}}% +\def\doseries#1#2{\n=#1\loop\char\n\!\ifnum\n<#2\advance\n 1 \repeat}% +\def\complower{\!\doseries{`a}{`z}\doseries{'31}{'34}\par}% +\def\compupper{\!\doseries{`A}{`Z}\doseries{'35}{'37}\par}% +\def\compdigs{\!\doseries{`0}{`9}\par}% +\def\alphabet{\setchar\background\complower}% +\def\ALPHABET{\setchar\background\compupper}% +% +\def\lowers{\docomprehensive\complower{`a}{`z}{'31}{'34}}% +\def\uppers{\docomprehensive\compupper{`A}{`Z}{'35}{'37}}% +\def\digits{\docomprehensive\compdigs{`0}{`4}{`5}{`9}}% +\def\docomprehensive#1#2#3#4#5{\par\chardef\background=#2 + \loop{#1} \ifnum\background<#3\m=\background\advance\m 1 + \chardef\background=\m \repeat \chardef\background=#4 + \loop{#1} \ifnum\background<#5\m=\background\advance\m 1 + \chardef\background=\m \repeat}% +% +\def\names{ {\AA}ngel\aa\ Beatrice Claire + Diana \'Erica Fran\c{c}oise Ginette H\'el\`ene Iris + Jackie K\=aren {\L}au\.ra Mar{\'\i}a N\H{a}ta{\l}{\u\i}e {\O}ctave + Pauline Qu\^eneau Roxanne Sabine T\~a{\'\j}a Ur\v{s}ula + Vivian Wendy Xanthippe Yv{\o}nne Z\"azilie\par}% +\def\punct{\par\dopunct{min}\dopunct{pig}\dopunct{hid}% + \dopunct{HIE}\dopunct{TIP}\dopunct{fluff}% + \$1,234.56 + 7/8 = 9\% @ \#0\par}% +\def\dopunct#1{#1,\ #1:\ #1;\ `#1'\ ?`#1?\ !`#1!\ (#1)\ [#1]\ #1*\ #1.\par}% +% +\def\bigtest{\sample + hamburgefonstiv HAMBURGEFONSTIV\par + \names \punct \lowers \uppers \digits}% +% +\def\math{\textfont1=\testfont \skewchar\testfont=\skewtrial + \mathchardef\Gamma="100 \mathchardef\Delta="101 + \mathchardef\Theta="102 \mathchardef\Lambda="103 \mathchardef\Xi="104 + \mathchardef\Pi="105 \mathchardef\Sigma="106 \mathchardef\Upsilon="107 + \mathchardef\Phi="108 \mathchardef\Psi="109 \mathchardef\Omega="10A + \def\ii{i} \def\jj{j} + \def\\##1{|##1|+}\mathtrial + \def\\##1{##1_2+}\mathtrial + \def\\##1{##1^2+}\mathtrial + \def\\##1{##1/2+}\mathtrial + \def\\##1{2/##1+}\mathtrial + \def\\##1{##1,{}+}\mathtrial + \def\\##1{d##1+}\mathtrial + \let\ii=\imath \let\jj=\jmath \def\\##1{\hat##1+}\mathtrial}% +\newcount\skewtrial \skewtrial='177 +\def\mathtrial{$\\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 \\a \\b \\c \\d \\e \\f \\g + \\h \\\ii \\\jj \\k \\l \\m \\n \\o \\p \\q \\r \\s \\t \\u \\v \\w \\x \\y + \\z \\\alpha \\\beta \\\gamma \\\delta \\\epsilon \\\zeta \\\eta \\\theta + \\\iota \\\kappa \\\lambda \\\mu \\\nu \\\xi \\\pi \\\rho \\\sigma \\\tau + \\\upsilon \\\phi \\\chi \\\psi \\\omega \\\vartheta \\\varpi \\\varphi + \\\Gamma \\\Delta \\\Theta \\\Lambda \\\Xi \\\Pi \\\Sigma \\\Upsilon + \\\Phi \\\Psi \\\Omega \\\partial \\\ell \\\wp$\par}% +\def\mathsy{\begingroup\skewtrial='060 % for math symbol font tests + \def\mathtrial{$\\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$\par} + \math\endgroup}% +% +\def\oct#1{\hbox{\rm\'{}\kern-.2em\it#1\/\kern.05em}}% octal constant +\def\hex#1{\hbox{\rm\H{}\tt#1}}% hexadecimal constant +\def\setdigs#1"#2{\gdef\h{#2}% \h=hex prefix; \0\1=corresponding octal + \m=\n \divide\m by 64 \xdef\0{\the\m}% + \multiply\m by-64 \advance\m by\n \divide\m by 8 \xdef\1{\the\m}}% +\def\testrow{\setbox0=\hbox{\penalty 1\def\\{\char"\h}% + \\0\\1\\2\\3\\4\\5\\6\\7\\8\\9\\A\\B\\C\\D\\E\\F% + \global\p=\lastpenalty}}% \p=1 if none of the characters exist +\def\oddline{\cr + \noalign{\nointerlineskip} + \multispan{19}\hrulefill& + \setbox0=\hbox{\lower 2.3pt\hbox{\hex{\h x}}}\smash{\box0}\cr + \noalign{\nointerlineskip}}% +\newif\ifskipping +\def\evenline{\loop\skippingfalse + \ifnum\n<256 \m=\n \divide\m 16 \chardef\next=\m + \expandafter\setdigs\meaning\next \testrow + \ifnum\p=1 \skippingtrue \fi\fi + \ifskipping \global\advance\n 16 \repeat + \ifnum\n=256 \let\next=\endchart\else\let\next=\morechart\fi + \next}% +\def\morechart{\cr\noalign{\hrule\penalty5000} + \chartline \oddline \m=\1 \advance\m 1 \xdef\1{\the\m} + \chartline \evenline}% +\def\chartline{&\oct{\0\1x}&&\:&&\:&&\:&&\:&&\:&&\:&&\:&&\:&&}% +\def\chartstrut{\lower4.5pt\vbox to14pt{}}% +\def\fonttable{$$\global\n=0 + \halign to\hsize\bgroup + \chartstrut##\tabskip0pt plus10pt& + &\hfil##\hfil&\vrule##\cr + \lower6.5pt\null + &&&\oct0&&\oct1&&\oct2&&\oct3&&\oct4&&\oct5&&\oct6&&\oct7&\evenline}% +\def\endchart{\cr\noalign{\hrule} + \raise11.5pt\null&&&\hex 8&&\hex 9&&\hex A&&\hex B& + &\hex C&&\hex D&&\hex E&&\hex F&\cr\egroup$$\par}% +\def\:{\setbox0=\hbox{\noboundary\char\n\noboundary}% + \ifdim\ht0>7.5pt\reposition + \else\ifdim\dp0>2.5pt\reposition\fi\fi + \box0\global\advance\n 1 }% +\def\reposition{\setbox0=\vbox{\kern2pt\box0}\dim=\dp0 + \advance\dim 2pt \dp0=\dim}% +\def\centerlargechars{ + \def\reposition{\setbox0=\hbox{$\vcenter{\kern2pt\box0\kern2pt}$}}}% +% +\def\text{{\advance\baselineskip-4pt +\setbox0=\hbox{abcdefghijklmnopqrstuvwxyz} +\ifdim\hsize>2\wd0 \ifdim 15pc>2\wd0 \hsize=15pc \else \hsize=2\wd0 \fi\fi +On November 14, 1885, Senator \& Mrs.~Leland Stanford called +together at their San Francisco mansion the 24~prominent men who had +been chosen as the first trustees of The Leland Stanford Junior University. +They handed to the board the Founding Grant of the University, which they +had executed three days before. This document---with various amendments, +legislative acts, and court decrees---remains as the University's charter. +In bold, sweeping language it stipulates that the objectives of the University +are ``to qualify students for personal success and direct usefulness in life; +and to promote the publick welfare by exercising an influence in behalf of +humanity and civilization, teaching the blessings of liberty regulated by +law, and inculcating love and reverence for the great principles of +government as derived from the inalienable rights of man to life, liberty, +and the pursuit of happiness.'' \moretext +(!`THE DAZED BROWN FOX QUICKLY GAVE 12345--67890 JUMPS!)\par}}% +\def\moretext{?`But aren't Kafka's Schlo{\ss} and {\AE}sop's {\OE}uvres +often na{\"\i}ve vis-\`a-vis the d{\ae}monic ph{\oe}nix's official r\^ole +in fluffy souffl\'es? }% +\def\omitaccents{\let\moretext=\relax}% +% +\def\sample{\fonttable\text}% +%DHL: Adjustments for LaTeX: +\ifx\AtBeginDocument\UndEfInEd + \let\table\fonttable +\else + \ifx\sevenrm\UndEfInEd + \def\sevenrm{\normalfont\fontfamily{cmr}\fontsize{7}{9}\selectfont}% + \fi +\fi +% +%DHL: +% \Init causes first fontname to auto-\init itself. For this purpose, the +% fontname must begin with a character with category 11 or 12. As in +% testfont.tex, this can be turned off by \let\noinit! before this file is +% input. With fntproof, we have the alternative of using the command +% \noinit *after* it is input. +\ifx\noinit!\else\Init\fi \def\noinit{\everypar{}}% -- cgit v1.2.3