This is a help file for the Metafont mode in Alpha. This file should be located in the Help subfolder of Alpha's folder to show up automatically in the Help menu when Alpha is loaded.


Introduction

MetafontMode is a mode for the text editor Alpha: it is designed to make writing, processing and testing of Metafont source files much easier. Metafont is the programming language written, as a companion to TeX, by Donald Knuth in order to create characters, fonts, font families (and many other things).

Once Metafont mode is installed, the opening of a Metafont source file (i-e with extension ".mf") invokes a new menu (called Metafont !) in the menu bar with the following features :

As of this release, both CMacTeX Metafont and OzMetafont are supported.

Installation

Automatic installation

Open the "OPEN TO INSTALL" file. Opening this file indicates to Alpha that a new package has to be installed : the procedure is automatic. Alpha knows where to store the different elements of your Metafont Mode package.

Manual installation

After installing

From now on, the opening of any file with the ".mf" extension will invoke the Metafont menu. Have a look at the mode specific preferences : create or open any Metafont source file and choose "Preferences..." in the "Mode Prefs" submenu of the "Config" menu. You can set, for instance, the name of the printer mode corresponding to your printer, or indicate the path of a working folder. More explanations below.

Description

Description of the Metafont Menu items :

Switch To Metafont
Launches the Metafont application in front

Run The Buffer
Calls up the Metafont application and processes the current window

Save And Run
Saves the current window and calls up the Metafont application to process it.

Run a File
Prompts you for a "mf" file to run.

Run a Folder
When pressing the option key "Run a File" becomes "Run a Folder" Prompts you for a folder of "mf" files to run.

Run Current Folder
When pressing the control key "Run a File" becomes "Run Current Folder" Metafont will execute all the "mf" files in the currently selected folder if any. Its name is reflected at the bottom of the "Other Files" submenu.

Choose Metafont Mode submenu

The word mode has a different meaning for Alpha and for Metafont : here it means the Metafont's printer mode, the one you specify when you (or Maketexpk) process a font. As usual with Metafont if no mode is specified, the default is proof. You can choose among the following list. User Defined should be set in the Current Mode Prefs : it is the printer mode at your installation. If you do not know which mode corresponds to your installation, look in the modes.mf file which comes with your TeX distribution. You can edit this file directly in Alpha from this Metafont Menu (see below).

Proof
To make proof characters at 2602 resolution (36 pixels per point). No tfm file is produced in this mode.

Smoke
To make black proof characters. No tfm file is produced in this mode.

Localfont
Use this mode when you do not know the printer mode's name of your installation : if your administrator did his job well, the "localfont variable" contains the printer mode.

User Defined
Comes as default as canonex : you set here what you want.

Processing Options submenu

Define here any particular processing option allowed by Metafont.

Mag...
Default value is 1, which means no magnification.

Magstep...
Default value is 0, which means no magnification Note that you choose a magnification either in mag or in magstep : if you choose the magstep syntax, any choice you previously made with mag will be omitted (and vice versa).

Base File...
You can specify a particular file (a base file for instance) which should be input before the file you want to process. Like in the command line :
 mf \mode=foo ; input somebasefile.mf ; input currentwindowfile.mf
To cancel an input file you have to clear all options (see below the menu item "Clear All Options")

Gfcorners
Option to draw corners at the corners of the box containing each character. Works in smoke mode.

Imagerules
Option to draw the box of each character.

Nodisplays
Don't show the characters on the monitor : to build fonts faster

Notransforms
Don't calculate any transformation if currenttransform is identity. To run faster.

Screenchars
Show each character once it has been calculated.

Screenstrokes
Show each character stroke after stroke while it is calculated

Clear All Options
Cancel all previously selected options.

Source Files submenu

This submenu contains a hierarchical list of mf source files. You must set the path to the folder containing the mf's in the Mode Prefs : the "Source Files" submenu reproduces the hierarchical structure of this folder. The depth of nested subfolders can be set in the Prefs with the "Nesting Depth" variable. You can change it at any moment. If your main folder is to big, you might run into memory problems : this can be solved by increasing the memory allocated to Alpha. Choose a folder corresponding to your needs, not necessarily the top one. Choosing any item in the "Source Files" menu will edit the corresponding file.

Rebuild Source List
In case new Otp's have been added, you can update the Otp List with this menu item.

Convert Files submenu

Convert gf to pk
Invokes gftopk to transform the "gf" file produced after a run of Metafont to the "pk" (packed) format. This procedure reads in the log file to find the name of the gf file (which depends on the mode chosen and the mag) : if the log file is missing, it won't work. Note that with OzMetafont, pk fonts are automatically produced when a source file is processed.

Convert gf to dvi
Invokes gftodvi to transform the "gf" file produced after a run of Metafont to a "dvi" (device independant) file. This procedure reads in the log file to find the name of the gf file (which depends on the mode chosen and the mag) : if the log file is missing, it won't work. This item is present only when using CMacTeX Metafont.

View dvi file
If a dvi file has been produced (see previous item) you can view it with the dvi previewer (dvipreview with CMacTeX, built-in previewer with Oz).

The following items allow you to process a single file or all the files in a selected folder :

Tfm to pl...
Prompts the user for a "tfm" file to convert to human readable format : extension of these files will be "fpl"

Vf to vpl...
Prompts the user for a "vpl" file to convert to the corresponding "tfm" and "vf"

Pl to tfm...
Prompts the user for a "pl" file in human readable format to compile a tfm file

Vpl to vf...
Prompts the user for "tfm" and "vf" files to convert to the corresponding "vpl"

Other Files submenu

Open Log File
Edit in Alpha (read-only) the log file corresponding to the currentwindow and produced by a run of Metafont on this current window.

Open Property List
Open the property list file related to the current window (if it exists, i-e if you have already converted the tfm to pl)

Open Modes.mf
Edit (read-only) the modes.mf file. It is the file containing the printer mode definitions for allmost all the available printers.

Open Plain.mf
Edit (read-only) the plain.mf file. It is the file containing the definition of all the basic Metafont macros. Note : you have to set the paths to these files in the mode specific preferences when you first use the Metafont Mode.

Remove Files
Sub menu to delete several types of files in the current folder : log, gf, pk, dvi, tfm, vf, pl, vpl. The pl files will be removed only if they have the plf extension (to avoid accidentally destroying Perl script files)

Select A Folder...
Use the "Select A Folder..." item to select another folder. If a folder has already been selected, its name will be recalled at the bottom of the "Other Files" submenu. It says either

No Folder Selected
If no folder is currently selected.

Current Folder Is:
Followed by the name of the currently selected folder

New Font Template
Builds a template for a complete new font source file. User is asked for the number of characters in the font.

Make Short Menu / Make Long Menu
Toggle between short and long menu. The long menu adds a series of submenus containing all Metafont commands (primitives and macros from the plain format).

Any item you choose will be inserted in your file at the cursor's current position with electric tabs for those commands which need arguments. In some cases, you will be asked to enter a number (see "makegrid" for instance). All the macros relevant to a particular aspect have been collected together in a (supposedly) logical way:

NB : make use of the option, shift and command keys to get variants of the macros. For instance, if you hold the option key down, "addto contour" will become "addto contour withpen" ; with the command key you will get "addto contour withweight"

File marking

Various elements are marked : macros definitions, character definitions, related files, input files etc. and can be easily accessed through pop-up menus and option or command clicking.

The Mark pop-up menu

If you choose to mark your file from the "M" pop-up menu (top right of your editing window), all the def, vardef and beginchar declarations in your source file will be marked. Remember that the beginchar command is customizable (in the Mode Prefs) and any change you make there will be taken into account for marking. If the 'Auto Mark' checkbox is checked in the Prefs, the file is automatically marked at opening.

The Functions pop-up menu

The "{}" pop-up menu (top right of your editing window) contains the functions and macros defined in your source file. We list here all the def, primarydef, secondarydef, tertiarydef and vardef definitions as well as the files input with an "input" command.

Command double clicking a word

If you Command-Double-Click on a keyword you access its definition. This procedure looks first for a definition in the current file itself, then in the list of primitives, then in the plain Metafont macros file and finally in the other text files located in the same folder and called in the current file by an 'input' command (typically they are macros files).

Option clicking the title bar

If you Option-Click on a the title bar, you get a list of all the .mf and .log files located :

Selecting any item in this list will open it in a window or bring its window to front if it is already open.

Completions

There is a set of completion procedures in Metafont Mode. To enable them, you must activate the "elecCompletion" package (in "Config--" Preferences--" Menus and Features") and choose your completion key (default is F1).

Completion will behave differently depending on the context.

Key bindings

A few key bindings are defined in Metafont mode. For all of them you have to hit 'ctrl-m', release, then hit one of the following letters : 'p', 's', 'l' or 'u' to select respectively "p"roof, "s"moke, "l"ocalfont or "u"ser defined modes

'b'to process the "b"uffer
'f'to process a "f"ile
'd'to process a "d"irectory
'n'to create a "n"ew font template
'm'to edit the "m"odes file 'modes.mf'
'c'to edit the macro "c"ommands file 'plain.mf'
'g'to edit the lo"g" file
't'to convert "t"fm file to pl
'i'to convert gf file to dv"i"
'k'to convert gf file to p"k"
'i'to "v"iew the d"v"i

Metafont Mode preferences

The "Preferences..." item in the "Mode Prefs" submenu of the "Config" menu allows you to edit specific preferences for the Metafont Mode. All of them should be self-explanatory. You can specify there :

Version History

Known problems

With versions of CMacTeX Metafont OLDER than 2.2.1 (this is Metafont's version number, not CMacTeX version number), the output folder defaults to the current window's folder. In this case, don't change it in the mode specific preferences.

The file extension for property lists (corresponding to fonts metrics) is 'pl' which is the same as the extension of Perl script files : this means that when you open a pl file, it invokes automatically the Perl menu. The only thing you can do is to set Mf mode in the popup menu at the right bottomof the screen.

Due to a CMacTeX limitation concerning the tftopl, pltotf etc. programms, it is necessary to quit and relaunch the programms each time they are used. This leads to a semi-automatic processing of an entire folder : user is asked to click each time to guarantee that delays are sufficient for the applications to perform their tasks. Mf itself is not concerned by this. So far only CMacTeX Metafont and OzMetafont are supported : I'll try to add support for Textures in the future if there is a demand for it.

Please e-mail any problem or bug you encounter : berdesg@easynet.fr

Visit my Metafont Web page for updates and the utilities for Alpha page:

http://perso.easynet.fr/~berdesg/metafont.html

http://perso.easynet.fr/~berdesg/alpha.html

License and Disclaimer

Copyright : Bernard Desgraupes, 2000, 2001 All rights reserved.

This software is free software and distributed under the terms of the new BSD license :

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

This software is provided by the copyright holders and contributors "as is" and any express or implied warranties, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose are disclaimed. In no event shall the regents or contributors be liable for any direct, indirect, incidental, special, exemplary, or consequential damages (including, but not limited to, procurement of substitute goods or services; loss of use, data, or profits; or business interruption) however caused and on any theory of liability, whether in contract, strict liability, or tort (including negligence or otherwise) arising in any way out of the use of this software, even if advised of the possibility of such damage.