@node Fonts, , Mongo, Appendices @appendixsec SM's Fonts @findex fonts, available characters @findex fonts, choice @findex fonts, hardware character sets These are a sub-set of the well-known Hershey fonts@footnote{created by Dr. A. V. Hershey at the U. S. National Bureau of Standards and illustrated in National Bureau of Standards publication NBS SP-24. The format used in the hershey_oc.dat file was originally due to James Hurt at Cognition, Inc., 900 Technology Park Drive, Billerica, MA 01821. It may be converted to any format @emph{except} the format distributed by the U. S. NTIS (whatever it may be). We have to tell you all this for copyright reasons, but as distributed the fonts are in the public domain.} and the available characters are listed in the following table, which were generated from within SM by saying @code{load fonts fonts}. For details on SM's implementation of @TeX{} and the `traditional' style see the section in the main body of this manual (@pxref{Labels}). The characters in a font are specified using a programme @code{read_fonts} which you can use to make binary font files from the list of Hershey characters, using an index file to specify what character should go where. The binary fonts file also specifies which @TeX{} `definitions' are available (e.g. @code{\alpha}). The first 4 bytes of the file are an integer (in binary) that specifies the format of the file; when the format is changed in an incompatible way this number if changed and you will have to rebuild your font files (`make fonts'). The default font table is illustrated at the end of this appendix. Which font file you want to use is specified as the @code{fonts} entry in your @file{.sm} file.@footnote{It's possible to resurrect the font table used by pre-2.0 versions of SM, using the index file @file{old_font_index}}. @findex fonts, .sm @findex .sm, fonts The @code{fonts.bin} fonts have been cleaned up a bit for version 2.0 of SM, although the order of characters in the greek and roman fonts is unchanged. There is a new font, `Old English' or \o or \oe, and a good number of new characters are provided. Neither of these fonts supports the `private' fonts, that is there in case users desperately need something, when they can make their own binary font file. For example, there is a set of Hershey oriental fonts that can be used to help SM write Japanese (@pxref{Japanese}). The complete list of (occidental) Hershey characters is given in a file called @code{hershey_oc.dat}, and is in the public domain. Each character is specified by a number in the first 5 columns, then a number of strokes in the next 3, then pairs of letters in the remaining columns up to 72, and in as many 72 character lines as are needed. (Annoyingly, if a line consists of exactly 72 characters, the next must be left blank). Each pair of characters consists of a coordinate, with the origin at (R,R), and the y axis pointing @emph{down}. A ` ' indicates that the next point is a move, otherwise just connect the dots. The very first pair is different, as it specifies the left and right spacing for the character. If this isn't clear, try drawing a few characters on graph paper, character 2001 (roman A) for example. There are a few characters that have traditionally been available in Mongo that are not in the Hershey set, these have been added to the end of the @file{hershey_oc.dat} file, plus a few that we thought deserved adding. If you want to create your own characters, the macro @code{make_char} in @file{fonts} (i.e. @code{load fonts make_char}) might help. It uses the cursor to make a string that is (nearly) in the correct form for inclusion in @file{hershey_oc.dat} The programme @code{read_fonts} reads this file, @findex read_fonts an `index' file that specifies the characters to be put into the fonts, and a list of @TeX{} definitions. The index file consists of character numbers, or ranges consisting of two numbers separated by a minus sign. Comments go from the character # to end of line. Each font consists of 96 characters in ascii order, and fonts appear in the index in the order rm, gr, sc, ti, oe, and then the various private fonts (privateA, privateB, @dots{}, privateG.). @findex cat_fonts You can also use @code{cat_fonts} to concatenate binary font files prepared with @code{read_fonts}. The format of the @TeX{} definition file is that each definition has a line to itself, lines starting with a # are comments. A line consists of a name, some whitespace, the number of arguments (optional, defaults to zero), the name of the font to use, a single white-space character, and the value of the definition to the end of the line; you can continue onto another line by putting a @code{\} at the end of the line. You can use any of the normal font specifications, or @code{cu} which means use the current font. For example @example alpha gr a alsoalpha 0 cu \gr a alphatoo 1 gr \#1a @end example @noindent defines @code{\alpha} the conventional way as the character @code{a} in the greek font, then defines @code{alsoalpha} in a less efficient way (by specifying the current font, then explicitly switching to greek), then defines @code{alphatoo} as a large @tex $\alpha$ @end tex @ifinfo alpha @end ifinfo , used as @code{\alphatoo5}. There's no reason why your definitions can't be reasonably complicated, see for example the definition of @code{\TeX}. If the number of arguments is given as -1 the @TeX{} symbol will be interpreted as an alias for the specified font, for example the @TeX{} definition file begins @example katakana -1 privateA hiragana -1 privateB @end example @noindent to make @code{\katakana} change to the @code{privateA} font. The main Makefile prepares your binary font file for you. There is also a programme @code{cat_fonts} that can be used to concatenate two or more binary fonts files; an example is given in the section on Japanese fonts (@ref{Japanese}). @tex \vfill\eject \centerline\file{% Select a device and say `load fonts TeX\_defs' to make this page} \vfill\eject \centerline\file{% Select a device and say `load fonts fonts' to make this page} @end tex @ifinfo If you want to see the @TeX{} definitions that SM knows about, start SM, then say @example load fonts TeX_defs @end example @noindent you can see the raw font tables with @example load fonts fonts @end example @noindent but why would you want to do that? @end ifinfo It is also possible to build SM fonts for other languages: @menu * Japanese:: Using SM to write Japanese @end menu @node Japanese, , , Fonts @appendixsec Using SM to write Japanese SM is currently able to use either katakana or hiragana fonts, but no kanji are yet supported. The order of characters in the fonts is likely to change, based on the desires of the users. Please let me know what you want. As distributed, the Japanese font tables aren't built. To make them, say @code{make jfonts.bin} in the toplevel SM directory, and ensure that your @file{.sm} file sets @code{fonts} correctly. The Japanese characters are available as @code{\hiragana} and @code{\katakana}. You can list the characters available with @code{load fonts jTeX_fonts}. One question is whether @code{\katakana 2} should print an Arabic (western) or a Japanese two; I am open to suggestions. There are a variety of kanji characters present, but no easy way to select them. If someone would like to donate a table of the correspondence between some accepted ascii encoding and the available characters, I will ensure that the character encoded as @code{AB} os available as (say) @code{\kanjiAB}, and provide a programme to generate such codes from the output of at least one popular word processor, expecting the user to cut-and-paste the result. Of course, it'd be quicker if you did it for me!