[comp.text] TeX fonts --- modifying \tt spacing

rbr4@uhura.cc.rochester.edu (Roland Roberts) (04/14/89)

I'm wondering if it is possible to change the spacing on the tt fonts
as an afterthought, i.e., without having to use METAFONT to generate a
new set.  According to the TeXbook, the cmtt characters all occupy
0.5em which is defined as 5.25pt.  I thought I could get by with doing
\font\myfont=cmtt
\fontdimen6\myfont=6.02pt
and go from approx 14 char/inch to 12 char/inch since I changed the
value of an em.  But no such luck.  Is there a way to change this
spacing?
 

-- 
Roland Roberts                      BITNET: roberts@uornsrl
  Nuclear Structure Research Lab  INTERNET: rbr4@uhura.cc.rochester.edu
  271 East River Road                 UUCP: rochester!ur-cc!uhura!rbr4
  Rochester, NY  14267                AT&T: (716) 275-8962

leichter@CS.YALE.EDU (Jerry Leichter) (04/15/89)

In article <1514@ur-cc.UUCP>, rbr4@uhura.cc.rochester.edu (Roland Roberts) writes...
>I'm wondering if it is possible to change the spacing on the tt fonts
>as an afterthought, i.e., without having to use METAFONT to generate a
>new set.  According to the TeXbook, the cmtt characters all occupy
>0.5em which is defined as 5.25pt.  I thought I could get by with doing
>\font\myfont=cmtt
>\fontdimen6\myfont=6.02pt
>and go from approx 14 char/inch to 12 char/inch since I changed the
>value of an em.  But no such luck.  Is there a way to change this
>spacing?
> 

\fontdimen6 is the quad width; it defines the size of an em when the given
font is selected.  I don't think it has any direct effect on anything else.
There are several other \fontdimen's which you would also have to change,
especially \fontdimen2 (interword space).

However, none of these affect interCHARACTER spacing.  That is taken directly
from the TFM file and isn't changeable within TeX.  You COULD change the TFM
file itself:  Use TFTOPL to convert the TFM file to (human-readable) Property
List format, edit the PL file, then use PLTOTF to change it back.  (You'd
probably want to call the new TFM file something other than CMTT10.TFM, or
whatever you started with, since it would be quite incompatible with the
original.)

HOWEVER, that's only the minor part of your problem!  With the new TFM file,
TeX would assume the new sizes you specified for the characters in the font.
But you would still need a font bitmap file (PK or whatever) which matched:
The font bitmap files duplicate the intercharacter spacing information which
is in the TFM file, so TeX does not need to specify how far apart successive
characters are to be placed (unless they are kerned, or in certain other cases
not worth going into here).  If you leave the font bitmap file unchanged, the
actual intercharacter spacing you get in your output will match the original
values, not the values you hacked with in the TFM file (except where TeX has
needed to set the position explicitly).

While there are programs, like PKTYPE, which allow you to DISPLAY font bitmap
files, I know of none which take a readable representation and turn it back
into a font bitmap file.  (That is, analogues of TFTOPL exist, but not those
of PLTOTF.)

When all is said and done, what you are REALLY asking for is a new font.
Changing the character spacing for cmtt should involve only very minimal MF
file hacking.  (An easy thing you might try is just to change the u parameter
in the cmtt10 definitions to 24.5.  This will actually change the characters,
rather than just the space around them.  I have no idea how it will look -
try it!)  (u is the "unit cell width", which for a monospace font is the size
of a character.  It is in units of 1/36 pt.  It's defined by a line of the
form:
	u# = 21/36pt#

in the CMTT10.MF file.)

I doubt anything other approach will, in the end, be worth the trouble.

							-- Jerry