FED(1)

NAME
fed - font editor

SYNOPSIS
fed [ -i ] [ -q ] name

DESCRIPTION
Fed is an editor for font files. It is display oriented and must be used on an HP 2648 graphics terminal. Fed does the necessary handshaking to work at 9600 baud on the 2648.

The -i flag requests inverse video mode, where all dots are dark and the background is bright. This provides a setting similar to the hardcopy output of the plotter, and is useful for fonts such as the shadow font where shading is important.

The -q flag requests quiet mode, where all graphic output is suppressed. This mode is useful on terminals other than the HP 2648 (assuming you are editing blindly) and for operations such as the # and A commands, since these operations do not make essential use of graphics, and since suppression of the graphic output speeds of fed considerably.

FONTS

A font is a collection of up to 256 glyphs, each of which is some pattern or design. Glyphs are represented on Unix as a rectangular array of dots, each of which is either dark or blank. Each location in the array is called a pixel. There are 200 pixels per inch due to the hardware of the Versatec and Varian plotters.

Each glyph has, in addition to its bit pattern, a base and a width. The base is a point, typically near the lower left of the array, that represents the logical lower left point of the glyph. The base is not restricted to be within the array, in fact, it is usually a few locations to the left of the edge. The vertical position of the base defines the baseline, which is held constant for all glyphs when a line is typeset. Letters with descenders, such as ``g'', go below the baseline. Other glyphs typically rest on the baseline.

The width is used by troff(1) to determine where to place the next glyph. It need not be the same as the width of the array, although it is usually about the same.

The size of the array, location of the base, and the width can vary among glyphs in a font. Fonts where all glyphs have the same width are called fixed width fonts, others are variable width fonts.

Attributes which do not vary among glyphs include the font name, which can be up to 11 alphabetic characters, and the point size, which is a positive integer indicating the overall size of the font. A point is 1/72 inch. The point size of a font is the distance, in points, from the top of the tallest glyph to the bottom of the lowest. The software of troff currently restricts point sizes to 6, 7, 8, 9, 10, 11, 12, 14, 16, 18, 20, 22, 24, 28, and 36 point. Normal text is usually 10 point.

Font files conventionally have names of the form
    name.pointsize
for example, ``bocklin.14'' to indicate 14 point bocklin. Fed will look for such a file in both the current directory and /usr/lib/vfont. Vtroff will only look in /usr/lib/vfont.

There is a correspondence between glyphs and characters in a font. For a given font, each glyph has an ASCII character associated with it. The glyph is obtained in troff by typing the associated character, and in fed glyphs are also referred to by their character. However, it is not required for all characters to have a glyph, fonts never have more than 128 glyphs and usually have fewer.

There is usually a natural correspondence between glyphs and characters. For example, the glyph which is a roman lower case `a' will generally have the ascii character `a' as its corresponding character. In the special font, the Greek lower case alpha has `a' as it's corresponding character, upper case delta has 'D' as it's corresponding character, etc. However, special fonts such as the chess font have glyphs that do not appear to be related to their corresponding characters.

It is easy to confuse glyphs and characters. Note, however, that the three glyphs roman a, bold a, and italic a, are all different, yet all three correspond to the character `a'. When this is multiplied by the large number of font styles and point sizes, there are many glyphs that match a single character, (but only one in a particular font).

FED ORGANIZATION

Fed organizes the screen into 21 windows in a 3 by 7 array. Each window is 100 by 100 pixels, meaning that the maximum height and width of a glyph is 100 pixels. Since the HP 2648 has a resolution of 100 dots per inch, glyphs displayed on the screen and printer will be double the actual height and width, even when fully zoomed out. There is a current window, which will be marked with a square border. There are two pens, called fine and bold. The fine pen is one pixel wide, the bold pen can range from two pixels to ten pixels in diameter. The default width of the bold pen is taken from the point size implied by the file name. The point size is not otherwise used. There are also fine and bold erasers.

There are two locations in the window, called the cursor and the mark. These tools are used to draw on glyphs.

Sometimes the cursor is on, in which case it is indicated by the hardware graphics cursor of the terminal, a cross. The cursor is considered to be located at the center of the cross. Sometimes the rubber band line is turned on, showing the path a line drawn would traverse. This line runs from the mark to the cursor, and is the only way the mark is graphically visible.

COMMANDS
Commands to fed are single characters, sometimes followed by any needed arguments. The commands used by fed were chosen to be as similar to vi(1) commands as was reasonable. Another distinction is that certain commands are in upper case. These commands were deliberately made hard to type because they cause a large change in the state of the editor and should not be done by accident. In a few cases there are both upper and lower case commands with the same letter.

Alphanumeric Keypad: Note that this is the keypad on the far right. The graphics keypad on the near right will not work. These keys are each synonyms for other commands. They are arranged in a manner that causes the five arrow keys to behave sensibly, but the others need to be memorized or stickers placed on the keys. They are provided for convenience only, and the user can avoid memorization simply by using the mnemonic letter keys instead.

The layout is as follows:
	undo (u)	rezoom ( )	fillin (f)
	move (m)	up (k)	draw (d)
	left (h)	base (b)	right (l)
	setdot (.)	down (j)	cleardot (>)

The arrow keys move the cursor one pixel in the indicated direction. The cursor is turned on if it was off. Note that the alphanumeric keys (far right) must be used. The graphics keys (near right) will appear to move the cursor but it will not be moved internally. The cursor cannot be moved outside the current window.

^L: Redraw the screen. This is useful if an I/O error or background process has caused the screen to get messed up.

b: Move the cursor to the base of the window. This is the default location of the cursor.

c: If the cursor is on, turn it off. Otherwise, turn it on.

d: Draw a line from the mark to the cursor. The currently selected tool (fine pen, bold pen, fine eraser, bold eraser) is used. The cursor is turned off. The mark is moved to the location of the cursor.

f: Fill in the current hole. The cursor must be in a completely enclosed empty (white) area. The area is set to black. If this command is invoked on the outside or there are any leaks to the outside, the entire outside will be filled in. (Undo is useful in this case.) Filling in cannot jump diagonals, but can rather only spread in the four orthogonal directions.

g <x>: Get a glyph. X can be any character. The glyph corresponding to x is put in a window, and this window is made the current window. The glyph is centered horizontally in the window. The baseline is located at row 70 from the top of the window. The pen and cursor are placed at the base, and the cursor is turned off. The glyph must exist.

h, j, k, and l are accepted to mean left, down, up, and right, respectively. They are synonymous with the alphanumeric arrow keys. They have the same meanings as in vi(1).

m: Move the mark to the current location of the cursor. The cursor is turned on.

n <x>: New glyph. This is similar to g, except that the glyph must not exist. It is used to create a new glyph. A blank window is created, centered at (50, 70) as in g.

p: Print the contents of the screen. An HP 2631 printer must be connected to the terminal. The screen is copied to the printer. If in inverse video mode, the screen is changed to normal video mode before the print, and then changed back after the print.

r: If the rubber band line is on, turn it off. Otherwise, turn it on.

s <what> [<where>]: Set <what> to <where>. What and where are single characters. The possibilities are:

    spf: Set pen fine. (`l' for light is also accepted.)

    spb: set pen bold. (`h' for heavy is also accepted.)

    sd: Set draw. The pen is used instead of the eraser.

    se: Set erase. The eraser is used instead of the pen.

    ss<n>: Set size of bold pen. <n> is a digit from 1 to 9. The size of the bold pen is set accordingly. This also affects the bold eraser.

u: Undo. The previous change to the current window is undone. Note that undo is on a window by window basis, so that commands that affect characters or more than one window cannot be undone.

z <n>: Zoom to level n. The screen is blown up by a factor of n. This only affects the appearance of the screen to make it easy to see the individual dots, and does not affect the size of the glyph or the result of a print command. Zooming to 1 shows the entire screen, a level of 3 or 4 is probably good for editing glyphs. When a message is printed on the screen, fed automatically zooms out to level 1 so you can read the message. Hitting space will zoom back. z followed by <return> zooms out without changing the previous zoom.

space: Zoom back to the level most recently requested by the z command.

A <i/e/r> <first> <last> [<oldps> <newps>]:
Artificially italicize/embolden/resize a range of glyphs in the current font. Enter i for italicize, e for embolden, or r for resize, and the first and last character in the range desired. If you are resizing you will also have to enter the old and new point size, each terminated by a return. Each glyph is gotten and changed on the screen visibly. Glyphs are italicized by slanting them to the right at a slope of 1/5. They are emboldened by smearing them to the right a number if pixels equal to the current heavy pen size. They are resized with an algorithm which translates all on bits to the new position. These operations will be considerably faster if the -q option is in effect, since much overhead is involved in the graphic display.

B: Move the base to the cursor. The cursor is turned on.

C <from> <to>: Copy the glyph in character <from> to character <to>. If <from> has a window on the screen, that window is given to <to>.

D <from> <through>: Delete a range of characters in the font, from <from> through <through> inclusive. To delete a single character type it twice.

E <file>: Edit the named file. If changes have been made to the current file, confirmation will be requested. (Either 'y' or 'E' is accepted.) The file name is terminated with return.

F <first> <last>: Show the font on the screen. The characters in the specified range are shown. The width values are used to get natural spacing. The display will remain until another command is typed, at which time the previous display will be redrawn and the new command will be executed. As a special case, a ``p'' command will print the results of the ``F'' command instead of the previous display.

I <h/v>: Invert the current glyph about a horizontal or vertical axis, as indicated by h or v. The axis runs up the center of the window. The base can be subsequently positioned with the B command.

K: Kill the current glyph. All dots are set to blank. The glyph is not removed from the font. This is used for redrawing a glyph from scratch or replacing it with another glyph.

M <from> <to>: Move a glyph from <from> to <to>. This is just like the copy command but the original is deleted.

N <file>: Write out the current file, if necessary, and edit the new file specified. The file name is terminated with return.

P <first> <last> <file>: Partial read from a file. A file and the first and last characters in the range are prompted for. Characters not in the range are left unmodified, characters in the range are handled as in the R command.

Q: Quit the editor, without saving any work. If changes have been made confirmation will be required (either `Q' or 'y' is taken as `yes'.)

R <file>: Read in the named file on top of the current file. Glyphs are merged wherever possible. If there is a conflict, you will be asked whether fed should take the glyph from the file (f) or buffer (b). Responding with F or B will lock in that mode for the remainder of the read. The file name is terminated with a return.

T <text>:

Typeset the line of text on the terminal. This is similar to the F command except that the given text is arranged on the screen, so you can see how some particular combination of characters would look.

V: Toggle whether editing is being done in inverse video mode.

W <file>: Write the buffer out onto the named file, which is terminated by return. A null file name means the current file name.

ZZ: Exit fed. A write is done, if necessary, followed by a quit. This is the normal way to leave fed. The Z must be doubled for compatibility with vi.

.: Turn on the dot under the cursor. The cursor is turned off.

>: Turn off the dot under the cursor. The cursor is turned off.

# <char> <field> <value>: Edit a numerical field. This only makes sense if the glyph has not been gotten (g or n) yet, since otherwise the values are taken from window specific things such as the base. Fed does not do any sanity checking, but just substitutes the value input. Fields are the first letter of any field from the dispatch structure (see vfont(5)), specifically, these fields are addr, nbytes, left, right, up, down, and width. The number, which may be signed, is terminated by a newline.

FILES
/usr/lib/vfont/*.*

SEE ALSO
vfont(5), vfontinfo(1), vtroff(1), vwidth(1)

AUTHOR
Mark Horton

BUGS
Attempting to use the second 128 characters would be folly. Fed has never been tested on such fonts, and at a bare minimum there would be problems trying to input 8 bit characters.

The character DEL is interpreted by the tty driver to mean interrupt. Hence the corresponding glyph cannot be accessed. The start, stop, and quit characters are turned off, but other characters used by the new tty driver must be quoted with ^V.

Changed widths are not copied to the width table used by troff. This only matters if logical widths are changed, or if glyphs are moved around. For these cases, vwidth(1) must be used.

The artificial operations don't do a very good job. The quality possible from blowing a font up is in general poor. Italicizing tends to make edges that were previously slanted very ragged. However, these operations are better than nothing at all and are a reasonable first approximation for hand fixing.