boldface in nroff
Lawrence Crowl
crowl at cs.rochester.edu
Fri Sep 28 01:08:37 AEST 1990
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 at 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 at cs.rochester.edu Computer Science Department
...!{ames,rutgers}!rochester!crowl Rochester, New York, 14627
More information about the Comp.bugs.4bsd.ucb-fixes
mailing list