Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10.1 5/3/83; site ukc.UUCP
Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!godot!harvard!seismo!mcvax!ukc!iau
From: iau@ukc.UUCP (I.A.Utting)
Newsgroups: net.bugs
Subject: Bug in (most) ditroff back-ends
Message-ID: <4938@ukc.UUCP>
Date: Thu, 28-Feb-85 08:31:01 EST
Article-I.D.: ukc.4938
Posted: Thu Feb 28 08:31:01 1985
Date-Received: Sat, 2-Mar-85 04:40:18 EST
Reply-To: iau@ukc.UUCP (I.A.Utting)
Organization: Computing Laboratory, U of Kent at Canterbury, UK
Lines: 63

Subject: Problem with most distributed device independent troff back-ends.

Index: 	d202.c, daps.c, d8400.c etc.

Description:
	A combination of the use of non-standard fonts (font 0) and
thin-space characters (\| and \^) causes following charcters to be selected
from the wrong font.

Repeat-By:
	This rather depends on your font description files. IF:
	a)	Thin spaces are not declared in some font not named in DESC
		(say PO).
	b)	Both thin spaces and the character X (also in PO) are named
		in some standard font (say S).
	THEN:
		.ft PO
		X\|X
	will cause the first X to come from PO and the second from S. The
	width of both Xs will be the width in PO.

Fix:
*** dcan.c.OLD	Wed Feb 27 09:44:50 1985
--- dcan.c	Wed Feb 27 09:53:35 1985
***************
*** 884,890
  		for(k = smnt, j = 0; j <= nfonts; j++, k = (k + 1) % (nfonts+1))
  			if(fontbase[k] && ((i = fitab[k][c] & BMASK) != 0)) {
  				p = codetab[k];
- 				setfont(k);
  				break;
  			}
  	}

--- 884,889 -----
  		for(k = smnt, j = 0; j <= nfonts; j++, k = (k + 1) % (nfonts+1))
  			if(fontbase[k] && ((i = fitab[k][c] & BMASK) != 0)) {
  				p = codetab[k];
  				break;
  			}
  	}
***************
*** 893,898
  		if(dbg) fprintf(stderr,"0%o not found\n",c+32);
  		return;
  	}
  	if(dbg) fprintf(stderr,isprint(c+32)?"%c %d\n":"0%3o %d\n",c+32,code);
  	else xychar(code);
  	if(font != ofont) setfont(ofont);

--- 892,898 -----
  		if(dbg) fprintf(stderr,"0%o not found\n",c+32);
  		return;
  	}
+ 	if(k != font) setfont(k);
  	if(dbg) fprintf(stderr,isprint(c+32)?"%c %d\n":"0%3o %d\n",c+32,code);
  	else xychar(code);
  	if(font != ofont) setfont(ofont);
--
(PS.	The "fontbase[k] &&" in the test in the for loop is an old fix to stop
	nil-pointer de-referencing when there is no font 0)

		Ian Utting	(iau@ukc)