🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.bugs.4bsd
Article #195

boldface in nroff

#195
From: Lawrence Crowl
Date: Thu, 27 Sep 1990 15:08
105 lines
3650 bytes
Less(1) recognizes the sequence "_\bc" as an underscored "c" and "c\bc" as a
bold "c".  Nroff(1) will generate the "_\bc" sequence, but not the "c\bc"
sequence.  This lack is especially noticable with man(1) program, which (by
convention) uses bold to indicate literal text.  I've modified the nroff
source file "n10.c" to generate the "c\bc" bolding sequence.  The terminal
type used by nroff for man would be better if it enabled bolding for special
characters as well as alphanumerics.  I did not make that modification.  The
remainder of this post contains the patch to "n10.c".

  Lawrence Crowl		716-275-9499	University of Rochester
		      crowl@cs.rochester.edu	Computer Science Department
	  ...!{ames,rutgers}!rochester!crowl	Rochester, New York,  14627

----cut here--------cut here--------cut here--------cut here--------cut here----
*** n10.c.orig	Wed Aug 23 16:49:23 1989
--- n10.c	Wed Aug 23 16:51:19 1989
***************
*** 113,118 ****
--- 113,124 ----
  	register char *codep;
  	extern char *plot();
  	int *q, w, j, phyw;
+ 	int underlining_ok;	/* boolean, true iff we are allowed to
+ 				   underline this character, we interpret this
+ 				   to also mean allow simulating boldface using
+ 				   backspacing */
+ 	int bold_toggle;	/* boolean, true iff the terminal has hardware
+ 				   bolding capability */
  
  	for(q=oline; q<olinep; q++){
  	if((i = *q) & MOT){
***************
*** 131,136 ****
--- 137,143 ----
  		continue;
  	}
  	codep = t.codetab[k-32];
+ 	underlining_ok = (*codep & 0200);
  	w = t.Char * (*codep++ & 0177);
  	phyw = w;
  	if(i&ZBIT)w = 0;
***************
*** 137,143 ****
  	if(*codep && (esc || lead))move();
  	esct += w;
  	if(i&074000)xfont = (i>>9) & 03;
! 	if(*t.bdon & 0377){
  		if(!bdmode && (xfont == 2)){
  			oputs(t.bdon);
  			bdmode++;
--- 144,151 ----
  	if(*codep && (esc || lead))move();
  	esct += w;
  	if(i&074000)xfont = (i>>9) & 03;
! 	bold_toggle = t.bdon && (*t.bdon & 0377);
! 	if(bold_toggle){
  		if(!bdmode && (xfont == 2)){
  			oputs(t.bdon);
  			bdmode++;
***************
*** 147,156 ****
  			bdmode = 0;
  		}
  	}
- 	if(xfont == ulfont){
- 		for(k=w/t.Char;k>0;k--)oput('_');
- 		for(k=w/t.Char;k>0;k--)oput('\b');
- 	}
  	while(*codep != 0){
  		if(*codep & 0200){
  			codep = plot(codep);
--- 155,160 ----
***************
*** 158,166 ****
  			oput(' ');
  		}else{
  			if(plotmode)oputs(t.plotoff);
! 			*obufp++ = *codep++;
! 			if(obufp == (obuf + OBUFSZ + ascii - 1))flusho();
! /*			oput(*codep++);*/
  		}
  	}
  	if(!w)for(k=phyw/t.Char;k>0;k--)oput('\b');
--- 162,177 ----
  			oput(' ');
  		}else{
  			if(plotmode)oputs(t.plotoff);
! 			if(underlining_ok){
! 				if(xfont == ulfont){
! 					oput('_');
! 					oput('\b');
! 				}else if(xfont == 2 && !bold_toggle){
! 					oput(*codep);
! 					oput('\b');
! 				}
! 			}
! 			oput(*codep++);
  		}
  	}
  	if(!w)for(k=phyw/t.Char;k>0;k--)oput('\b');
----cut here--------cut here--------cut here--------cut here--------cut here----
-- 
  Lawrence Crowl		716-275-9499	University of Rochester
		      crowl@cs.rochester.edu	Computer Science Department
	  ...!{ames,rutgers}!rochester!crowl	Rochester, New York,  14627
Technical Details
Message-ID: <1990Sep27.150837.10387@cs.rochester.edu>
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!nih-csl!lhc!adm!cmcl2!rutgers!rochester!crowl

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!nih-csl!lhc!adm!cmcl2!rutgers!rochester!crowl
From: crowl@cs.rochester.edu (Lawrence Crowl)
Newsgroups: comp.bugs.4bsd
Subject: boldface in nroff
Message-ID: <1990Sep27.150837.10387@cs.rochester.edu>
Date: 27 Sep 90 15:08:37 GMT
Reply-To: crowl@cs.rochester.edu
Organization: University of Rochester Computer Science Department
Lines: 105