[comp.lang.postscript] Help me write some DESC files for postscript

brad@bradley.bradley.edu (Bradley E. Smith) (01/10/91)

Hi, I am try to write DESC & font files for postscript fonts we have

according to the ADOBE FONT METRIC FILES specifiaction (version 3.0)
"All measurements in an AFM and ACFM file are given in terms of units
equal to 1/1000 of the scale factor(point size) of the font program.
To compute actual sizes in a document, these amounts should be
multiplied by (scale factor of font)/1000."

Also characters are defined like the following:

C 33; WX 333; N excalm ; B 100 -15 233 683;
C 208; WX 1000; N emdash ; B 0 174 1000 228;

And also from Troff we get (in the DESC file)

res - is the machine resolution in units per inch
hor & vert - the minimum number of machine units that it is possible
    to move
unitwidth - the point size at which the character widths map directly
    into machine units.

Now that we have that the DESC files that came with 'tpscript' (for the apple
laser write have the following 

res 720
hor 1
vert 1
unitwidth 10

and the 'R' file has the following as well (cut out a lot)

# Times-Roman
name R
internalname Roman
ligatures fi fl ff ffi ffl 0
spacewidth 25
charset
!	33	2	041
em	100	0	0320	emdash


-----------------
Now my question, do I just set unitwidth to 10 for all fonts?  Do I divide the
width from the Adode font printout by 10 and use it?  what about round off
is 339 the same 331 (ie 33, or should 339 be 34)?  Can I set unitwidth to 1
and just use 333?

Thanks

Brad Smith
Bradley University
brad@bradley.bradley.edu
309-677-2337

clewis@ecicrl.UUCP (Chris Lewis) (01/12/91)

In article <1991Jan9.175920.20119@bradley.bradley.edu> brad@bradley.bradley.edu (Bradley E. Smith) writes:
>Hi, I am try to write DESC & font files for postscript fonts we have

One way of doing this is to get the psdtwd program out of the psroff
distribution.  It's a postscript program that you download to the printer
which will punt back up to the host a set of ditroff width tables for the
fonts you want.  (provided that the font is actually on the printer first..)

Since you seem to have tpscript, tpscript comes with the original version
of this program, so you could use that instead.

If there's sufficient interest, I could post the psdtwd program.

Regarding DESC files.  Use the ones that come with tpscript, they work
well.  The widths in the ditroff tables are the widths in the "res" value
at the unitwidth size.  Thus, with your example of res being 720 and unitwidth
being 10, a 33 means that the character is 33/720's of an inch wide at 10
points.

Where a width doesn't scale exactly, round off as close as possible.  Otherwise,
ditroff filters that optimize (convert individual character placements into
strings with a single show) will bugger up royally - noticable in either too
big or too small inter-word spacing.  This is noticable in psroff (CAT troff),
where a single digit change in the width tables (res == 432, unitwidth == 6)
can bugger the optimizer's word spacing with words as short as 9 letters.
For a little increased accuracy, you could change unitwidth to the largest number
you can, where the highest converted width is still less than 255.

The unitwidth MUST be the same for all fonts under a given DESC (because it can
only be specified in the DESC).  Enforced by the binary width table structure.

Also, the width values themselves MUST be <= 255 (stored as chars in the width
table binary files).

As far as calculating goes, consider ! again, which has the AFM of 333.
Which means, that a 10 point (unitwidth!) "!" would be 3.33 points wide
(333 * 10/1000).  Then, you convert it to decipoints (res!) which gives
33.3, then round off to 33.  Ie: divide by 10 and round.  You were right.
-- 
Chris Lewis, Phone: (613) 832-0541
UUCP: uunet!utai!lsuc!ecicrl!clewis
Moderator of the Ferret Mailing List (ferret-request@eci386)
Psroff mailing list (psroff-request@eci386)