PKEDIT(1) — USER COMMANDS
NAME
PKEDIT: character-by-character manipulation of TeX PK and PL files and of X11 and Sun bitmaps.
SYNOPSIS
pkedit [<existing PK file>]
DESCRIPTION
PKEDIT can either edit characters in existing TeX PK files or create entirely new ones. Characters from several PK files can be brought together into one PK file. Even Sun bitmaps can be included as characters. PKEDIT can write out a TeX PL file as well, so that TeX can use the new PK file right away. PKEDIT also incorporates a character scaling feature, as well as primitive copy and paste operators and line drawing capabilities.
PKEDIT is an interactive SunView tool which is easy to use. The tool consists of five subwindows. The top window is a notice panel which displays useful help information and hints. The left window is the grid window, where all pixel-by-pixel manipulation is performed. The center window is a control panel with several buttons, each performing a specific function, each selected by clicking the left mouse button. The right window is the proofing window, showing the character at actual size (on a 83dpi Sun screen). The square view box in the proofing window corresponds to the area covered by the grid window. The bottom window is the selector panel, which is used to choose which character is to be edited.
If PKEDIT is invoked with an existing PK file on the command line, the user can easily tweak or replace a few select characters in the font, since all the characters in that PK file are loaded and stored in memory. Those characters which were not edited prior to writing the output PK file are then simply rewritten unchanged. If no PK file is included, PKEDIT starts from scratch with an empty PK file, adding a character to the file each time one is explicitly edited and saved. Up to 256 characters can be included in a TeX PK file, and characters can be as large as 400 by 400 pixels (96pt at 300dpi). The ".pk" suffix can be omitted from the PK file name.
The program will also accept Sun bitmap files as input files. The Sun bitmap is loaded by using the "New In-File" button after the user selects the current character for editing.
After editing is complete, the user writes out a new PK file and may elect to write out a new PL file as well. However, because this editor is pixel based, the accuracy of TFM dimensions may be greatly reduced. This is because a pixel is often as much as 100,000 times larger than a TFM unit. In addition, since the original TFM file is not referenced, kerning and ligature information may be lost. It is recommended that the user not blindly write out and replace existing PL or TFM files without keeping these points in mind. Generally, one shouldn’t need to write out a PL file if the PK file already existed beforehand, especially if the user did not adjust any TFM widths. The PL file must be converted to a TFM file using the PLtoTF utility program for TeX to recognize any changes.
FUNCTIONS
Editing an existing PK file.
Include the file name when PKEDIT is invoked, i.e. "pkedit cmr10.pk" or just "pkedit cmr10". Doing so loads the entire PK file into memory, so that it is easy to edit any character in the font without needing to reload it using "Reload Char" (see below). Forgetting to include the file name may result in lost characters when the new PK file is written, so remember, if the file exists, include its name in the command line!
Editing a brand new PK file from scratch.
Simply invoke PKEDIT without a filename. An empty PK file is started. The user will be prompted for the design size (in points) as well as the DPI resolution when it needs that information. Note that if a PK file is not included in the command line but is instead selected using the "New In-file" button, the user must explicitly reload each character (using "Reload Char") by hand to bring it up.
cting a particular character.
Using the mouse, move the cursor over the selector window (the bottom one). You’ll see something like "! 0 9 A Z a z". There are three ways to choose a character. You can type it in directly, i.e. pressing the ’A’ key will select character ’A’, or you can click the left mouse button in the region near where the desired character is. If you do this, the display will change to show 10 characters. Move the mouse over the desired character and click the left button again. The third way selects a character by its number. With the cursor over the selector window, press the escape key followed by a sequence of digits terminated by another escape. For instance, "<esc> 1 4 <esc>" will retrieve character 14. Pressing the escape key twice in succession loads character 27, the ASCII code for the escape key.
Editing a character.
When the cursor is over the grid window (the left one), the three mouse buttons change the pixel values of a character. The left button "fills" or paints pixels; the middle button "clears" or erases pixels; and the right button toggles the pixel to its opposite state. For convenience, holding any mouse button down while moving the mouse (an action called "dragging") makes it very easy to fill, clear, or toggle adjacent pixels. When the mouse is dragged with the middle button down so as to erase pixels, the cursor changes form to show this.
Moving the view box.
With the cursor over the proofing window, pressing the left mouse button relocates the view box so that its lower right corner is at the tip of the cursor. Pressing the right mouse button in the proofing window tends to "repel" the view box away from the cursor one grid row and/or one grid column at a time---sometimes more desirable than the macroscopic relocate function of the left mouse button.
haracter.
Pressing the "Scale Char" button causes PKEDIT to prompt the user for a percentage to which to scale the current character. It also displays the current scale value. If that is acceptable, the user can simply press return to scale to it. In addition, When the cursor is over the grid window, pressing "<ctrl> m" causes the current character to be magnified to 120% of its present size. Pressing "<ctrl> s" shrinks the character to 90% of its present size. The algorithm used is the same as that in ArborText’s various device drivers.
Copying and pasting the grid window.
When the cursor is over the grid window, pressing "<ctrl> c" on the keyboard copies the entire grid window into a buffer. Next, suppose the user moves the view box to another region in the proofing window. If the user then presses "<ctrl> p", the new grid window is replaced by the buffer. This is particularly useful for duplicating patterns (including blank space) in very large characters. The buffer continues to store the image until another image is copied, even between characters. Do not change the pixel size between copy and paste operations, as unpredictable results might occur during the paste.
erasing lines.
When the cursor is over the grid window, holding the shift key down while pressing a mouse button marks the current pixel with an M (in addition to performing the pixel clear or fill). If another pixel is chosen (perhaps by moving the view box) and a shifted operation is again performed, then that operation is replicated through all pixels between that pixel and the one previously marked. After the replication, the marked pixel becomes unmarked and loses its M. This function works very well on vertical, horizontal, and 45-degree oblique lines, but may not do so well on other oblique lines.
Comparing multiple characters in a font (plunking).
If the cursor is over the proofing window, any characters typed from the keyboard are "plunked" onto the proofing window. Additional characters typed in are set to the right of the previous one(s) until they exceed the window’s width, at which point the window is cleared and they start over again from left to right. In this manner, the user can compare characters by placing them next to each other in certain combinations. Plunking does not affect the current character that is being edited, but the current character must be saved for that version to be plunked. The proofing window will be refreshed if the escape key is pressed. Use control characters to plunk non-printable characters; numeric entry by character number, a feature of the selector window, is not supported in the proofing window.
Which current character/PK file is being edited?
If the current character or input file is forgotten by the user, pressing ’?’ over the grid window will solve the mystery.
BUTTON DESCRIPTIONS
Previous Char and Next Char
These buttons retrieve the in-memory character representations. If a PK file name was included in the command line, these buttons work well, since every character in the font is loaded into memory. If a brand new font is being started, however, only characters which have been saved already will be selected.
r Pressing this button after editing a character saves the character in memory, overwriting the previous version in memory but not affecting the character in any existing PK file. Any edited character must be saved or reload (see below) before another can be edited.
Reload Char
This causes the current selected character to be read in from the current PK file. If no PK file has been selected, the button does nothing. Using "New In-File" and selecting another PK file then restoring it causes subsequent characters to be loaded from the new PK file. Note that "restoring" does NOT imply reverting to a previous version in memory, but rather to a representation already stored in a PK file.
Clear Char
Sets all the pixels in the current character to zero, effectively making the character null. Useful for starting over with a totally botched character!
Renumber Char
Allows the user to duplicate a character in a font. Here’s how: Suppose a new character "P" is created. Since the "R" is very similar to the P, save the P then renumber the character to R (by entering ’R’ or its ASCII code, 82, when prompted), add the right leg to the P, and save the R!
The current character can be scaled to an arbitrary size if the user presses this button. See "Scaling a character" above.
Pixel Size
In the grid window, the PK pixels are represented by squares, which themselves are actually some number of screen pixels on an edge. Choosing this option allows the user to change this length. Selecting a smaller pixel size gives the grid window more effective area, thus indirectly increasing the size of the view box in the proofing window. The minimum useful grid pixel size is 3 screen pixels.
Grid Lines
Some users would like the grid window to look like a grid. Pressing this button toggles between no grid lines and grid lines, with no grid lines initially. Grid lines sometimes make it easier to draw horizontal or vertical lines, but watch out if the Pixel Size is too small---a lot of time will be spent by PKEDIT redrawing them every time a change is made! In addition to lines, a ruler is drawn along the top and left edges of the grid window, representing horizontal and vertical distance in points from the reference point of the character.
Move Ref Pt
The reference point of a character defines its position on a TeX baseline; usually the reference point is to the character’s left and somewhat beneath it. When this button is pressed, the current reference point is displayed as a X in the proofing window. If the X happens to be inside the view box, the reference point appears in the grid window as an R. To move it somewhere else, move the view box if necessary, then click the left mouse button at the desired spot in the grid window. To cancel the move, press "Move Ref Pt" a second time---it toggles. Note that if you move the reference point of a character, you may also need to move the TFM point as well (see below).
Move TFM Pt
The TFM point sets the character’s TFM width to an accuracy of one pixel by counting pixels between it and the reference point (see above) and converting that horizontal distance into TFM units. The TFM point is labeled as a T and is always at the same vertical location as the reference point. When the button is pressed, an X appears in the proofing window. To change the TFM width, select an appropriate distance to the right of the reference point and click the left mouse button at the desired spot in the grid window. To cancel the move, press "Move TFM Pt" a second time---it toggles.
New In-File
Pressing this button prompts the user for a new input file name. An input file can be either a PK file or a Sun bitmap file. Selecting a PK file causes all subsequent "Reload Char"s to extract the current character from that file. The current character can be changed using the selector window or the "Renumber Char", "Next Char", or "Previous Char" buttons. A Sun bitmap file will replace the current character when loaded, but attempting to reload a specific character from a Sun bitmap file will have no effect, since it is presumed that the file has only one character in it.
Write PKfile
When all the characters have been edited and saved, pressing this button prompts the user for a PK file name to be used for the output file. Any existing file with the same name will be overwritten.
Write PLfile
This button prompts the user for a PL file name. The PL file generated includes a cmr10 fontdimen, ligature and kerning table found in /usr/local/lib/pkedit/pkedit.lig. All TFM heights, widths, and depths are rounded to the nearest pixel each time a character is saved; however, the TFM widths of in-memory yet unedited characters are preserved--the rounding occurs only when the character is saved using "Save Char".
Quit PKEDIT
When the user is done using the PKEDIT tool, pressing this button allows a clean way to exit. If the file has been edited but the changes were not saved or written out to a new PK file, the user is asked to confirm the quit by selecting YES or NO from a box prompt.
MOUSE/KEYBOARD OPERATIONS - a summary
Over the control panel:
Select the buttons by clicking the left mouse button.
Over the grid window:
The left mouse button "fills" the current pixel, that is, sets it to 1; the middle button "clears" it, and the right button toggles the bit from 1 to 0 or vice versa. Holding the shift key down while pressing a mouse button marks the current pixel; repeating this at another pixel causes the pixel operation (fill or clear) to replicate through all pixels between that one and the marked one. Pressing "<ctrl> c" copies the current grid window into a buffer; Pressing "<ctrl> p" overwrites the current grid window with that in the buffer. Pressing ’?’ reminds the user as to the the current character and input file. "<ctrl> s" and "<ctrl> m" shrink and magnify a character to 90% and 120% of its current size, respectively. All other keyboard characters are inactive.
Over the proofing window:
The left mouse button relocates the view box so that its lower right corner is at the tip of the cursor. The middle mouse button moves the entire character around in the proofing window. The right mouse button "repels" the view box away from the cursor one grid row and/or column. Pressing the escape key refreshes the proofing window; all other characters typed from the keyboard cause those characters to be "plunked", that is, displayed next to each other in the proofing window.
Over the selector window:
Only the left mouse button does anything; it is used to select the character region the first time, and the actual character itself the second time. The escape key changes the mode so that a sequence of digits can be entered, terminated with another escape, as in "<esc> 1 1 7 <esc>", which loads character #117. Typing any other key on the keyboard loads the character with that ASCII equivalent.
SOME HINTS
In the selector window, the first time in the edit session the left mouse button is pressed, it seems to be ignored. Pressing it a second time seems to clear things up.
If you drag a character off an edge in the proofing window (by holding the middle button down), the window becomes messed up. Releasing the mouse button, should, however, restore the image. Generally, dragging a character off the screen should be avoided, since doing so may cause the program to crash, losing the entire edit session.
When a prompt box comes up, you can back space using the delete key (the backspace key does not work).
Sun Release 3.2 — Last change: 23 January 1990