Generating an APL Font
Total Page:16
File Type:pdf, Size:1020Kb
TUGboat, Volume 8 (1987), No. 3 275 Generating an APL Font a typewriter-like typeface with fixed spacing; the Aarno Hohti and Okko Kanerva same approach for representing TEX input was University of Helsinki adopted by Knuth in the wbook. The verbatim macros have often been used for importing screen ABSTRACT. The APL language is well known for its or paper outputs into 'I@X documents; some people peculiar symbols which have inhibited the use of this misuse them for an easy construction of tables etc. language in many programming environments. Making In verbatim, the typewriter mode is entered by the APL documents of good quality has been difficult and control sequence \ begint t - that mode is ended by expensive. We describe here a simple way how to use METAFONT to generate an APL font for Tk,X by using \endtt. In the same vein, we could enter the APL existing font definitions as far as possible. mode by the control sequence \beginapl, and to end it by \endapl. However, it is more convenient Introduction to augment verbatim with aplstyle so that it This note describes an interesting exercise in using can be used with several different typewriter-like METAFONT to produce new typefaces by combining fonts. (The verbatim macros can be found in the letters from standard fonts. As we know, the APL Wbook, p. 421.) Since Q (the at sign) is used as language [6] of Kenneth Iverson has never gained the escape character inside verbatim mode, our the popularity it deserves largely because of its code might (and in fact does) look as follows: strange symbol set. Indeed, true APL users require \choosett(apl) a special keyboard to support the nonstandard but \begintt powerful operator symbols. Moreover, putting APL @DL-S-SUMSQ N;I into print has always been a problem, and modern Cll s-1-0 low cost computerized typesetting programs do not [2] @GO (N<I-I+1) /0 usually support APL style. 'I@X can be used to C31 S-S+I*2 produce high quality printouts for technical text, [4] @GO-2 and it would be desirable to have a possibility to [5l @DL mix in APL code. The companion program of \endt t 'I)$-METAFONT-provides a full means for a The control sequences \DL and \GO are not cho- simple generation of an APL font for QX, and sen arbitrarily but follow the conventions used in the purpose of this note is to inform other people Digital's VAX APL interpreter [I]. As terminals about the result we have obtained at the University usually do not support the APL character set, an of Helsinki. Let us note that there are at least alternative representation by two-letter mnemonics three other APL fonts available for small computer is provided by the interpreter. For the most part environments. Indeed, the newsletter APL Quote we have adopted these mnemonics also for our APL Quad* is produced by using Troff, and there exists font. Hence, as an additional bonus the user should a Postscript APL font for the Apple Laserwriter find it easy to combine his or her APL code with [5] and another font for the TEXT typesetting usual TEX code. Thus, it is not necessary for a VAX system [2]. APL user to retype the definitions of APL functions Consider the following usual kind of function in order to be able to use them in documents. definition in APL: However, the syntax of TEX code for APL text is VS+-SUMSQ N; I somewhat different from that of Digital APL. In- Ell S+I+O deed, mnemonics must be followed by a non-letter [21 +(N<I+I+I)/O (a character whose catcode is different from 12) C3l S+S+I*2 and the escape character is Q, not period as in the 141 +2 interpreter. Moreover, all spaces are obeyed; thus, C5l V if the user does not want a space after an APL How to write in this code, providing that we have symbol obtained from a control sequence, the tilde a suitable font? The APL font should represent character (here a character with zero width) must the screen output style of APL code and obey be used as an end character. Using a macro for the same laws of spacing. Hence, it should be removing these differences would make aplstyle both slower and unnecessarilv com~licated. * Newsletter of SIGAPL, the Special Interest Group for APL. Quote Quad has the same status in the world of APL as TUGboat in mnical world. 276 TUGboat, Volume 8 (1987): No. 3 The APL font table comparison with modern typesetting. Then he de- APL symbols are divided into two classes: the prim- cided (together with the second author) to remedy itive symbols and those obtained by overstriking the situation by creating an APL font for Tm he two primitive ones. The overstrikes are tradition- was using for other kinds of document. Many of ally obtained by typing the first symbol, by using the APL symbols needed were contained in stan- backspace to go back one space and then typing dard fonts: for example. dzamond can be found in the second symbol over the first one. However, in cmsyl0. For alphanumeric characters one could use modern APL keyboards these double symbols are cmslttl0. The simplest try for a solution of the assigned to non-alphanumeric keys (for example, to problem would be to write a list of definitions that keys under the ALT key). We decided to include pick symbols from appropriate fonts. However. this only the primitive APL symbols in the font table; brute force method does not really work since these this enabled us to include also the lower-case letters, symbols come from very different typefaces and. following modern conventions. (The original APL moreover. do not provide a fixed typeface. Hence. letters were restricted to capitals.) The comment we decided to find an easy way of producing an symbol a is the only exception since it is keyed in APL font by using METRFONT. as a double quote. Our font is a fixed size typeface As the starting point. we took the font cm- with strongly slanted letters. Moreover, we have texl0. This is a fixed typeface for an extended followed the style of best books in APL: all symbols typewriter-like font including some Greek charac- should be drawn with a thin pen to get a touch of ters and mathematical symbols. The METRFONT a typewriter. (This point is clearly witnessed, for file for this font, cmtexl0 .mf contains (as usual) a example, in [5].) The places of some symbols are preamble that assigns values to several global vari- determined by the TEX font tables. For example, ables. and the command generate textset;. Now the hash sign # is used for the multiplication sign the driver file textset . mf contains the commands in VAX APL. and hence the corresponding symbol mode-setup;f ont-setup; (establishing the values has the the same octal code (043) as the hash sign of the variables for this font) and several input in m. The font table has the following form: files from which the METAFONT descriptions of the characters are to be found. Since some of these files treat the characters by name and since some of the definitions have to be changed (and some dropped). we considered it advisable to discard the driver file and to collect the separate METAFONT files. together with the preamble, to form a large single file cmapll0.mf. The .mf character files needed for cmapllo .mf are the following: greekl (rho.omega.alpha) i talms (iota) romand (roman digits) punct (punctuation symbols) romanp symbol (math symbols) sym romanu (upper case letters) roman1 (lower case letters) Definitions The necessary METRFONT files First. put font-ldentifier:="CMAPL1';and set The whole process started when the first author slant:=O; in the preamble. Many definitions can had a paper containing APL symbols and was dis- be copied verbatim from the .mf files. but some of appointed with the quality of the symbols available them need changes. The Greek zota. as given in on the typewriter. Moreover. the secretary who greekl .mf,is strange to APL style: we use instead had typed in the text had forgotten a couple of the dotless z from italms .mf. Moreover. we used lines in the middle of the paper. and the correc- the symbol elt (element) from sym.mf instead of tion of such mistakes seemed to be very clumsy in the Greek epsilon. The symbols del and delta are TUGboat, Volume 8 (1987), No. 3 taken from symbol .mf (where their names are large triangle and large inverted triangle). However, they \def\ifundefined#lC\expandafter are too sturdy and too short to be placed in a \ifx\csname#l\endcsname\relax~ proper APL font. Further, del must be lifted up so \outer\def \choosett#l(\ifundef ined(#l3 that it is vertically aligned with other symbols. The \message(Undefined font(?), modifications are very easy to do, and the modified replaced with cmttl03 definition is shown below. \let\tt=\tentt % sqrt48 was changed to 6.25 since the \else % Del symbol in APL has a narrower top \def\ttC\expandafter % than the original reversed triangle \csname#l\endcsname)\f i) % symbol (The control sequence \ifundefined comes from % rule.nib has been changed to the mbook, p. 308.) With the help of \choosett, % light-rule.nib the standard verbatim macro can be used without % bot y3=-d-o has been changed to y3=0 changes. % top yl=h-d has been changed to The APL symbols not in the font table are ob % top yl=h+20 tained - as usual -by overstriking two table sym- bols.