#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License, Version 1.0 only
# (the "License").  You may not use this file except in compliance
# with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://www.opensolaris.org/os/licensing.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#

The devpost directory includes width tables for the entire LaserWriter Plus font
set (and a few others). The width tables assume a resolution of 720 dpi (which
isn't expected to match your printer's resolution) and by default are installed
in /usr/lib/font/devpost. You can point troff there using the -Tpost option, while
dpost goes there automatically. The width tables were generated on a PostScript
printer using postio (with the -t option) and the files that you'll find in
directory ../buildtables.

The mapping from troff's one or two character font names to PostScript fonts is
handled by definitions made near the start of file ../postscript/dpost.ps. troff
characters not available in PostScript fonts are constructed using the files in
./devpost/charlib. Characters that are assigned a code (ie. number in the fourth
column) less than 32 are looked up (by dpost) in the charlib directory. A code
of 1 implies the character definition comes in one piece, while anything else
means the character may come in two pieces. The first part is downloaded once,
while the second part (ie. the one that ends in .map) must be included every
time the character is printed.

Adding a new font file (for troff and dpost) can be time consuming, but isn't
difficult. The steps you'll need to follow are outlined below:

 1: Pick a one or two character font name for troff and dpost - no longer a
    trivial task! To find out what two character font names are taken type,

	cd devpost
	ls -l ? ??

    Any unused one or two character font name can be chosen. I've tried to choose
    two character font names with the first character representing the font family
    (eg. K for Bookman) and second (upper or lower case R, I, B, or X) indicating
    the style.

 2: Choose a unique internal name (ie. integer between 1 and 255). To find out
    what internal names (ie. numbers) are already taken type,

	cd devpost
	grep internalname ? ?? | sort -n +1 -2

    Any number not already used can be chosen. Consecutive numbering starting at
    a fixed offset (like 128) might be a useful approach.

 3: Build the width tables and install the ASCII files in ./devpost. Width tables
    can be built by hand or you can use postio (with the -t option) and the stuff
    in directory ../buildtables and have the printer generate the tables. Widths
    (ie. numbers in column 2) are point size 10 widths assuming a resolution of
    720 dpi. As an example if you wanted to find the width of character A in
    Times-Roman you could send the following to a PostScript printer,

	/Times-Roman findfont 100 scalefont setfont
	(A) stringwidth pop ==

    The fourth column in the width tables is the character code field and is only
    used by dpost. It must be the code assigned to the character in the PostScript
    font. For simple characters (like an a) it's just the ASCII code. Characters
    that are assigned codes less than 32 (typically 1 or 2) are special and are
    built up using files in devpost/charlib.

 4: Any new special character names you've added to the width table must appear in
    the charset portion of file devpost/DESC.

 5: Add a mapping definition to ../postscript/dpost.ps. For example if you've
    built a width table for font XR and the PostScript name is /ExtraFont-Roman
    then add,

	/XR /ExtraFont-Roman def

    to the dpost prologue.

 6: If you're system uses PDQs you'll need to build new PDQ font files. I've
    included the PDQ version of makedev and font.mk includes a target called PDQ
    that works on MHCC systems. Typing,

	make -f font.mk PDQ

    should work, provided you can execute the PDQFRONT program. The new binary
    PDQ files initially go in directory PDQ/devpost and from there are installed
    in /usr/lib/font/PDQ/devpost. If you don't know what PDQs are skip this stuff.

 7: Build and install the new binary font files and dpost prologue by typing,

	cd ..
	make TARGETS='font postscript' install

    Actually the install (as written above) installs everything in directory
    ../postscript. Since all you need is the new version of dpost.ps the following
    might be safer,

	cd ..
	make TARGETS=font install
	cd postscript
	cp dpost.ps /usr/lib/postscript/dpost.ps

The devpostaps directory is new and the binary tables won't be built or installed
unless you do it by hand. The tables are an attempt to make Linotronic output look
something like APS-5 output, and won't be useful to most people. The only real
application is for simple (perhaps one or two page) updates to larger documents
that have already been formatted and printed on the APS-5. The following commands
build and install the devpostaps tables,

	make -f font.mk makedev
	cd devpostaps
	../makedev DESC ? ??
	mkdir /usr/lib/font/devpostaps
	cp *.out /usr/lib/font/devpostaps
	cd charlib
	mkdir /usr/lib/font/devpostaps/charlib
	cp * /usr/lib/font/devpostaps/charlib

The tables should only be used by dpost - troff files should be formatted with
the -Taps option. In addition dpost must use level 2 encoding. A command line
that forces dpost to do the best it can with APS files would be,

	dpost -e2 -Tpostaps -C/usr/lib/postscript/aps.ps file >file.ps

where aps.ps is additional PostScript code (pulled in using the -C option) that
tunes the Courier, Times, and Helvetica fonts so they look more like APS fonts.
 
