Bug in (most) ditroff back-ends

I.A.Utting iau at ukc.UUCP
Thu Feb 28 23:31:01 AEST 1985


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 at ukc)



More information about the Net.bugs mailing list