[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: PostScript font installation: my evolving tools...



Hi:

There have been many heuristics for deriving `reasonable'
values for stretch and shrink. Attached is some code from AFMtoTFM.
You can also set these explicitly from the command line.

I do think though that the space width should be the width of the
space character given that that is what the font designer came up with.

Regards, Berthold.

int paulflag=0;	/* -P use Paul A's scheme for stretch and shrink */
		/* 1/2 stretch 1/6 shrink */
int alanflag=0;	/* -J use Alan J's scheme for stretch and shrink */
		/* 1/3 stretch 1/3 shrink */
int sebasflag=0;	/* -R use Sebastian R's scheme for stretch and shrink */
		/* 0.6 stretch 0.24 shrink */
int averageflag=0;	/* -N average of fixed and scaled scheme */
		/* 0.6 stretch 0.3 shrink averaged with 160 and 110 */


spacewidth = 300.0;	/* overridden by AFM */
spacestretch = 160.0;	/* default unless set from command line */
spaceshrink = 110;	/* default unless set from command line */
extraspace = 110;		/* default unless set from command line */

if (paulflag) {
	spacestretch = spacewidth/2;	/* 0.5    */
	spaceshrink  = spacewidth/6;	/* 0.1666 */
/*	extraspace = 500 - spacewidth; */	/* em/2 ??? */
}
else if (alanflag) {
	spacestretch = spacewidth/3;	/* 0.3333 */
	spaceshrink  = spacewidth/3;	/* 0.3333 */
/*	extraspace = 500 - spacewidth; */	/* em/2 ??? */
}
else if (sebasflag) {
	spacestretch = spacewidth * 3 / 5;	/* 0.6  */
	spaceshrink  = spacewidth * 6 / 25;	/* 0.24 */
/*	extraspace = 500 - spacewidth; */	/* em/2 ??? */
}
else if (averageflag) {
	spacestretch = (spacewidth * 6 / 10 + 160) / 2;
	spaceshrink  = (spacewidth * 3 / 10 + 110) / 2;
	if (spacewidth < 500)
		extraspace = ((500 - spacewidth) + 110) / 2;
	else extraspace = 110;		/* lower limit */
}

/*  prevent spacewidth - spaceshrink from becoming too small */
if (spacewidth - spaceshrink < 140) {
	spacestretch = spacestretch +
			   (140 - (spacewidth - spaceshrink));
	spaceshrink = spacewidth - 140;
	if (spaceshrink < 0) spaceshrink = 0;
}
/*  prevent spacewidth + spacestretch from becoming too large */
if (spacewidth + spacestretch > 500) {
	spacestretch = 500 - spacewidth;
	if (spacestretch < 0) spacestretch = 0;
}

The above is for proportionally spaced fonts only, of course.



Berthold K.P. Horn
MIT AI Laboratory
mailto: bkph@ai.mit.edu