\documentstyle[11pt]{article}

\newcommand{\ft}{FONTTOOL}
\newcommand{\pxl}{{\tt pxl}}
\newcommand{\tfm}{{\tt tfm}}
\newcommand{\mf}{{\sf METAFONT}}

\begin{document} 

\title{\bf \ft}
\author{Brad Rullman\thanks{Thanks go to Randy Day for
  large contributions to the first prototype of \ft.
  And some of the facilities provided by \ft\ were created at the suggestion
  of Pierre Mackay.}\\
  Department of Computer Science  FR-35\\
  University of Washington\\
  Seattle, Washington  98155\\
  email: ecola@cs.washington.edu}
\maketitle

\section*{Introduction}

\ft\ is a mouse-driven interactive font editor that works on \pxl\ files.
A \pxl\ file contains raster descriptions at a particular resolution
of the characters in a font, and is
used by driver programs for dot matrix devices.\footnote{See {\it The Format
of PXL Files}, a report by David Fuchs, for more information on \pxl\ files.}
\ft\ is used
to modify the characters described in the \pxl\ file;
it is implemented on the Sun Microsystems Workstation.

\section*{User Interface}

The user operates with one main window on the screen, the {\it tool\/} window,
which contains a header and several smaller subwindows.  The user displays 
the tool window by typing ``fonttool'' once he/she
 is in Suntools\footnote{The Suntools graphics package is invoked by typing
``suntools'' at the prompt. Then it is necessary to obtain a shell window,
by clicking the right mouse button and releasing it over the ``ShellTool''
option in the menu that pops up. Note that in Suntools, the 
right mouse button is usually designated as the menu button.}
on a Sun workstation
on which \ft\ has been installed.
He quits by moving the mouse so that the cursor appears inside the header,
clicking the menu button, and choosing 
``Quit'' from the menu.  This Tool Menu also allows the user to
move, change the size of, hide, close, or expose the main \ft\ window.

The four subwindows are dominated by the {\it Paint Window}.  Here, the user 
operates on one font character at a time, which is magnified to make the 
manipulation of individual pixels convenient and easy.
The {\it View Window\/} shows the character currently
being modified at close to true size.
Two smaller subwindows, the {\it Message Window\/} and the
{\it Option Window}, help the user to perform his/her task.

In the ensuing discussion, it should be remembered that
for a Suntools window to be active,
the mouse cursor must
be somewhere inside it, otherwise typing or other action on the
user's part will appear to have no effect in that window.

\subsection*{The View Window}

The function of the View Window is to show the character currently being
edited at a one-to-one ratio
between the Sun screen pixels and the dots that get
printed by the output device
for which the character is intended to be used. This allows
the user to see the final product at 
as close to true size as is possible while still maintaining the correct
resolution.
For instance,
if the \pxl\ file's raster description of a character is 32 pixels in 
height, the pixel height of the same character in the View Window
will also be 32, but may actually be taller in absolute height due to 
the difference in sizes of the screen pixels and the \pxl\ file pixels,
the dimensions of the latter being based on the resolution of the
intended output device.

The View Window provides instant visual feedback of the
changes being made in the Paint Window.  It's default size is 60-by-60
pixels, but if a character is loaded that exceeds either of these
dimensions then the window is automatically enlarged so that the entire
character fits inside.  In addition, the user may manually change the
size of the window by specifying new dimensions in the appropriate
fields of the Option Window---the 
section of this manual titled {\it The Option Window\/}
describes how to do this.

\subsection*{The Paint Window}

The Paint Window is where the user operates on an individual font
character.
For each pixel in the View Window there is a
{\it cell\/} of {\it magnification}-by-{\it magnification\/} pixels
in the Paint Window, where {\it magnification\/} is specified
by the user.
Generally, to ``paint''
the user selects individual cells by clicking the left 
mouse button over them.
The middle mouse button can be used to erase (``paint'' white).
If either button is held down, all pixels that
lie under the path of the mouse cursor are painted.
\ft\ provides other ``mouse modes'' for drawing lines and filling regions;
these modes will be described in the next section.

Clicking the right mouse button always invokes an ``Undo'' operation
which causes the last paint action to be undone.
Naturally, the user can Undo an Undo, i.e.\ consecutive
Undo's toggle back and forth between the 
``done'' image and the ``undone'' image.

The Paint Window is exactly {\it magnification\/} times 
larger than the View Window in both dimensions, unless it becomes too
large to fit inside the main tool window, in which case it is clipped.
Remember, however, that the main tool window may be enlarged
so that more of the Paint Window becomes visible.
In addition, vertical and horizontal scroll bars are provided so
that the user is always able to access any portion of the character.

Associated with each character raster 
in a \pxl\ file is
a reference point, which is a pair of coordinates that describes how to 
position the character on a line of text in a document. 
As an aid to the font designer, a reference point is provided in the 
Paint Window.\footnote{The reference point is displayed as
an `X' the size of one cell.}
Each character of a font that is being modified is displayed
in the correct location in reference to this point, so that when the font
is written and actually used by \TeX, the characters will be aligned
properly when they are actually printed in a document.  

\subsection*{The Option Window}

The Option Window presents the user with various choices he/she can make
while editing a font. The user
specifies his/her choice of a particular option by
clicking the left mouse button
over the label of that option. The various options are as follows:
%
\begin{itemize}
  \item {\bf PXL File} -- Normally the first option selected, this is a text
	field in which the user enters the name of a font's \pxl\ file.
  \item {\bf Open Font} --  The user clicks
	over this label once the name of a \pxl\ file has been typed into
	the text field labeled ``PXL File''.  Doing so causes the \pxl\ file
	to be opened and data initialized.
  \item {\bf Char Name / or Char Number} -- The user selects the particular 
	character raster he/she wishes to modify by
	entering the character in the ``Char Name'' text field,
	or by entering the character's ASCII number in the ``or Char Number''
	text field.
	Typing in one field will automatically clear the other field.
  \item {\bf Load Char} -- When the label for this option is clicked, the
	raster of the character specified in the Char Name/Char Number
	fields is read from the \pxl\ file and is centered and
	displayed in both the View and the Paint windows.
  \item {\bf Save Char} -- Writes the raster displayed in the View Window
	to the current \pxl\ file, replacing the existing raster for the 
	character specified in the Char Name/Char Number fields.
	The first time this option is selected after a new
	\pxl\ file has been opened also causes the extension {\tt .bak} to be
	appended to the name of the original \pxl\ file, and causes this file
	to then be copied to a file with the original name.  All ensuing saves
	go to this copied file until either a new \pxl\ file
	is opened, or the same one is opened again.
  \item {\bf View Width / View Height} -- These text fields always reflect 
	the current dimensions of the View Window, in pixel units.
	The user may edit these fields if he/she wishes to enlarge or
	shrink the View Window;  clicking over the ``Apply'' button then
	causes \ft\ to resize the window and re-position the character 
	so that it lies in the middle of the window.  The user should 
	be warned that this is a ``what you see is what you get'' window,
	so for example if the window is shrunk to a width that is less than
	that of the character that it
	displays, data from each vertical side of the character will be 
	permanently lost.\footnote{Unless, of course, the 
	character is then reloaded from the \pxl\ file, assuming that
	extensive modifications have not been made.}
	Also, the width or height is limited to the range 60--600, inclusive.
  \item {\bf Magnification} -- Currently the available magnifications
	are 1, 2, 4, 6, 8, and 10.
	The default is 10.
	When a new magnification is selected, the entire contents
	of the Paint Window are scaled to that magnification, and any ensuing
	paint operations will apply to the new image.
  \item {\bf Cell Type} -- Most output devices are either ``write-black''
	or ``write-white'', in that they create images by writing black dots
	on a white background or by writing white dots on a black background.
	Since a font printed or displayed on a write-black device can look
	very different from the same font displayed on a write-white device,
	\ft\ provides the ``Cell Type'' options {\it Normal\/} (the default), 
	{\it Write-Black}, and {\it Write-White}.
	Selecting either of the latter
	two options causes the entire contents of the Paint Window to be
	redrawn so as to simulate the corresponding type of device.
	The square {\it magnification}-by-{\it magnification\/} cells become
	circles;\footnote{These circles are, of course, not perfect due to the
	limited size and resolution at which they are produced.  As a result,
	the effects of write-white, for example, are somewhat exaggerated in
	the Paint Window. However, this may actually be advantageous when
	one is attempting to design/modify a font for a write-white device.}
	each circle's diameter is equal to the length of the diagonal of
	a square cell. This facility allows font designers to make
	adjustments to their \pxl\ files that depend on the type of device 
	on which the fonts are intended to be used.  It should be noted
	that the monitor of the Sun Workstation
	is a write-white device, therefore the
	contents of the View Window, which are not magnified, should (one
	would think) reflect the character as it would look on a write-white
	device.  However the people at Sun have employed a few tricks
	in order to reduce the effect that ``writing-white'' has on the edges
	of images drawn on the Sun screen, so in fact the View Window can
	never reflect {\it exactly\/} the contents of the Paint Window!
  \item {\bf Mouse Mode} -- The default mode of the mouse allows the user 
	to paint individual points.  The ``Mouse Mode'' option is used
	to select alternative modes that allow the user to draw lines, 
	fill regions, and move the character's reference point.
	In ``Lines'' mode, the user can generate
	straight line segments by dragging with the mouse to indicate 
	the endpoints of the line.  After the first point
	has been designated, a line segment is dynamically displayed
	between that point and the mouse cursor as the cursor moves
	around the screen.  Once the mouse button is released, the line
	segment is anchored.  (Remember that the left mouse button paints
	black, and the middle button paints white.)  The
	``Fill'' mode lets the user fill an
	area delineated by a drawn outline by simply clicking the left
	or middle mouse button anywhere inside the area.
	\ft\ will then proceed
	to fill it in with the appropriate paint color.
	The character's reference point can
	be moved by selecting the ``Move'' mode, and clicking either the left
	or the middle mouse button at the new location.
	The new reference point will move with the mouse cursor until
	the button is released.
	The ``Undo'' mouse button (the right button) works in any of these 
	modes.
  \item {\bf Clear} -- This is just an easy way to erase the entire
	character if the user decides he/she wants to start over.
\end{itemize}

The user should be aware that currently \ft\ does not modify the \tfm\ 
width\footnote{The \tfm\ width tells document formatters like
\TeX\ how much horizontal space to leave on the page for a character.
The \tfm\ width of each character is kept in both
the \pxl\ file and in the corresponding \tfm\ file for
the font being modified.
See {\it \TeX\ Font Metric Files}, a report by David Fuchs, for more 
information.}
of a character when the ``Save Char'' option is selected.
The implication here is that
extensive dimensional modifications to the character rasters
should not be made, since this could result in
poor placement of the characters immediately 
surrounding the modified one in any document in which the latter is used.
The reason \ft\ does not touch the \tfm\ widths is that it
was designed to be used to make the final, minor modifications
to character bit-maps that are sometimes necessary after creating a font 
with \mf.  Changing the \tfm\ widths in these instances would be
disastrous, since then they would no longer coincide with the \tfm\ width
fields in the corresponding \tfm\ file, and since the characters were
designed to be used at these widths in the first place.

Hopefully, in the future 
\ft\ will be used to {\it create\/} new fonts by using any
existing \pxl\ file as a skeleton to contain the new rasters, and
passing the resulting \pxl\ file through a 
{\tt pxltomf} filter, which will ``de-compile'' the bit-maps and create
\mf\ code for them.  This code can then be given to \mf\ as input so that 
the proper \tfm\ and \pxl\ files are produced.\footnote{This filter has
actually been implemented,
and is currently producing very low-level \mf\ code;  work is continuing
on producing higher-level code.
Details can be found in Brad Rullman's forthcoming thesis.}

\subsection*{The Message Window}

The Message Window displays various messages to help the user
interact with \ft.  When the message is an error message, \ft\ rings a 
bell and flashes the window.
Also, if the user makes some request that results
in a time-consuming operation, such as filling a large region,
the mouse cursor becomes a ``ticking watch'' to indicate
that \ft\ is immersed in scaling operations, and that
it might be a second or two before
the user will regain control of the program.

\end{document}
