[comp.text] Enhancements to Old Troff

tut%cairo@Sun.COM (Bill Tuthill) (10/07/87)

Thanks to responses from this newsgroup, I recently modified old troff to 
have a longer line length, and to use PostScript Times Roman width tables.
While I'm at it, I thought a few other changes might be nice.  Has anybody
ever done the following:

1.  Expanded the number of fonts from 4 to 6, let's say.  It would be great
	to have Courier and Courier Bold available.

2.  Fixed the various ligature bugs.  Most of these haven't even been fixed
	in the newest ditroff, by the way.  Getta loada these:

	% troff -a
	.nr f 1
	xx\nfyy
	.fl
	xxy1y

	% troff -man
	.TP
	.BI \-f fontname
	.TP
	\fB\-f\fIfontname\fP

	The above produces an ff ligature in bold instead of an f in bold
	then an f in italics.  The bug apparently results from .TP's use
	of the rare .it request.

Thanks in advance,
Bill Tuthill

karl@grebyn.COM (Karl A. Nyberg) (10/08/87)

In article <30176@sun.uucp>, tut%cairo@Sun.COM (Bill Tuthill) writes:
> While I'm at it, I thought a few other changes might be nice.

I'd like to add my major difficulty with troff - trying to use the -me
macros and get an entire document printed in a different point size.  I've
tried .ps, and .sz, but it seems that the moment I use .sh, the point size
reverts to some earlier default (it looks to be about 10 or smaller).  I'd
like to have the entire document printed in 12 point, but putting .sz and
.ps commands after every .sh command is a royal pain...  Any ideas?  I
thought I might just go hacking the troff source (ug.), if nothing turns up.

I'm running Ultrix 2.0, in case it matters.  Thanks.

-- Karl -- 
Karl A. Nyberg				Grebyn Corporation
karl@grebyn.com				P. O. Box 1144
nyberg@ajpo.sei.cmu.edu			Vienna, VA 22180
{decuac,umd5,vrdxhq}!grebyn!karl	703-281-2194

chris@mimsy.UUCP (Chris Torek) (10/08/87)

The -me macros have four (4) number registers that control point
size.  `.sz' changes the size until another command sets things
back with one of those.  These are:  fp pp sp tp  (footnote,
paragraph, section, and ?title?).  The macro `.ns <size>' below
sets the current size and all the others:

	.de ns
	.sz \\$1
	.nr pp \\$1
	.nr sp \\$1
	.nr fp \\$1-2p
	.nr tp \\$1
	..
-- 
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7690)
Domain:	chris@mimsy.umd.edu	Path:	uunet!mimsy!chris

crm@duke.cs.duke.edu (Charlie Martin) (10/08/87)

Posting-Front-End: GNU Emacs 18.47.4 of Sun Aug  9 1987 on duke (berkeley-unix)


This little macros helps set sizes in -me 

Just do .*s <number> to set point size to <number>, i.e. .*s 12.

.\" *s change point size -- pag
.de *s
.nr pp \\$1
.nr tp \\$1
.if \n(sp=0 \
.	nr sp 10
.nr sp \\$1
.sz \\$1
..
-- 
Charlie Martin (crm@cs.duke.edu,mcnc!duke!crm) 

edmoy@opal.berkeley.edu (10/09/87)

>2.  Fixed the various ligature bugs.  Most of these haven't even been fixed
>	in the newest ditroff, by the way.  Getta loada these:
>
>	% troff -a
>	.nr f 1
>	xx\nfyy
>	.fl
>	xxy1y

In n4.c, function setn(), you see code like:

	if((i=getch() & CMASK) == '+')f = 1;
		else if(i == '-')f = -1;
			else ch = i;

Change this to:

	lgf++;
	if((i=getch() & CMASK) == '+')f = 1;
		else if(i == '-')f = -1;
			else ch = i;
	lgf--;

>	% troff -man
>	.TP
>	.BI \-f fontname
>	.TP
>	\fB\-f\fIfontname\fP
>
>	The above produces an ff ligature in bold instead of an f in bold
>	then an f in italics.  The bug apparently results from .TP's use
>	of the rare .it request.

Actually, it's not the .it request, but the diversion that .TP uses.  The
problem is in t6.c, in getlg().  What getlg() needs to do is check the size
and font bits of the next letter with the current letter (which was the
letter f) and fail if they don't match.  You need something like:

#define	SFMASK	077000
#define	fontmismatch(i,j)	(((i) & SFMASK) != ((j) & SFMASK))

In getlg(), each time you do a getch0(), do a fontmismatch() test on the new
character with the original (f) character.  If there is a mismatch, you stop
where you are (either with just an f, or with a two character ligature).
Remember to push back the new character into ch0.

Edward Moy
Academic Computing Services
University of California
Berkeley, CA  94720

edmoy@opal.Berkeley.EDU
ucbvax!opal!edmoy