[comp.text] Q: nroff character sizes

plona@romulus.rutgers.edu (Lawrence Plona) (06/07/91)

   For kicks I have been trying to get nroff on my Xenix box
to handle the proportional character mode on my dot-matrix
printer.  I haven't had much luck in figuring out the nroff
term variables.  I know what the documentation says but
when does nroff use Char, Adj, Em, Hor, Ver and plot mode?

  All the experimenting I have done hasn't been able to
uncover their relationships.  Has anyone used this feature?

Thanks,
Larry Plona
-- 

Sit denique inscriptum in fronte unius  "Let it finally be written on
cuiusque quid de rebus publicis sentiat  the forehead of each man what he
- Cicero                                 thinks of open systems"

brown@vidiot.UUCP (Vidiot) (06/08/91)

In article <Jun.6.18.37.50.1991.13440@romulus.rutgers.edu> plona@romulus.rutgers.edu (Lawrence Plona) writes:
<
<
<   For kicks I have been trying to get nroff on my Xenix box
<to handle the proportional character mode on my dot-matrix
<printer.  I haven't had much luck in figuring out the nroff
<term variables.  I know what the documentation says but
<when does nroff use Char, Adj, Em, Hor, Ver and plot mode?
<
<  All the experimenting I have done hasn't been able to
<uncover their relationships.  Has anyone used this feature?

You have to create a new nroff printer driver and set up all of the width
tables for each and every character.  Believe me, it just isn't worth the
trouble.  Nroff was basically made for fixed spaced fonts, like 10 cpi and
12 cpi.  I set up one nroff table for 15 cpi.  If you want proportional
spacing, you need to use troff.  But, I don't know of any tables for troff
to use for dot matrix printers.  Somebody has to have drivers for dot matrix
printers somewhere for a nroff or troff look-a-like.
-- 
      harvard\     att!nicmad\          spool.cs.wisc.edu!astroatc!vidiot!brown
Vidiot  ucbvax!uwvax..........!astroatc!vidiot!brown
      rutgers/  decvax!nicmad/ INTERNET:vidiot!brown%astroatc@spool.cs.wisc.edu

clewis@ferret.ocunix.on.ca (Chris Lewis) (06/09/91)

In article <1889@vidiot.UUCP> brown@vidiot.UUCP (Vidiot) writes:
>In article <Jun.6.18.37.50.1991.13440@romulus.rutgers.edu> plona@romulus.rutgers.edu (Lawrence Plona) writes:

><   For kicks I have been trying to get nroff on my Xenix box
><to handle the proportional character mode on my dot-matrix
><printer.  I haven't had much luck in figuring out the nroff
><term variables.  I know what the documentation says but
><when does nroff use Char, Adj, Em, Hor, Ver and plot mode?

>You have to create a new nroff printer driver and set up all of the width
>tables for each and every character.  Believe me, it just isn't worth the
>trouble.

No kidding.  It can't be done, because nroff won't use them no matter
what you do.  Troff will, but then the big problem is that troff doesn't
emit ASCII.  There are ways of getting C/A/T troff, ditroff or groff to
talk to dot matrix printers (via a conversion to TeX's DVI and using
epson drivers f'r instance) but it's kinda yucky.  I know the pieces exist,
but I don't know the sources for some of them.

One way of getting nroff to use proportional fonts, is to write a shell
script like this:

    echo MC
    nroff $*
    echo MC2

Where MC is the escape sequence required to get the printer to select
a proportional font on the printer, and MC2 is a reset sequence of some kind.
On system V, you'll should use the octal escapes, perhaps like this:

	echo "\033...\c"

On BSD/V7 style echos, generating the octal sequences are hard, but suppressing
the newline is done with -n (instead of trailing \c)

	echo -n "....."

And finally, the result will be very ugly because nroff is assuming
that all characters are constant width.  Tables won't line up.  Right
justification won't work.

Or, you could go whole hog and get ghostscript so that you could use
a troff to postscript converter to drive your printer.  Then you'd
have pretty sexy output limited only by the resolution of your printer.
But that may be extreme overkill for what you really want to do.
-- 
Chris Lewis, Phone: (613) 832-0541, Domain: clewis@ferret.ocunix.on.ca
UUCP: ...!cunews!latour!ecicrl!clewis; Ferret Mailing List:
ferret-request@eci386; Psroff (not Adobe Transcript) enquiries:
psroff-request@eci386 or Canada 416-832-0541.  Psroff 3.0 in c.s.u soon!

plona@romulus.rutgers.edu (Lawrence Plona) (06/10/91)

   Actually, I've got it working somewhat now. What I did was
   express each character in nroff units and set Char, Adj and Em
   accordingly. I think most of the remaining discrepancies come
   from faulty estimates of the individual character sizes and the
   in accuracy of the printer in moving fractions of an inch.

   I realize that all of this is a farce but its become a mini-
   obsession with me. nroff could have been written to do a lot more
   with line printers. But its too late now...


   - Larry Plona
-- 

Sit denique inscriptum in fronte unius  "Let it finally be written on
cuiusque quid de rebus publicis sentiat  the forehead of each man what he
- Cicero                                 thinks of open systems"

roy@phri.nyu.edu (Roy Smith) (06/11/91)

clewis@ferret.ocunix.on.ca (Chris Lewis) writes:
> Troff will [use character width tables], but then the big problem is that
> troff doesn't emit ASCII.

	At least in classic C/A/T troff, you can do "troff -a" to get ascii
output.  Whether that can be made to be useful when printing on a dot
matrix printer with proportional spacing or not is another question.
--
Roy Smith, Public Health Research Institute
455 First Avenue, New York, NY 10016
roy@alanine.phri.nyu.edu -OR- {att,cmcl2,rutgers,hombre}!phri!roy
"Arcane?  Did you say arcane?  It wouldn't be Unix if it wasn't arcane!"

roy@phri.nyu.edu (Roy Smith) (06/11/91)

plona@romulus.rutgers.edu (Lawrence Plona) writes:
> nroff could have been written to do a lot more with line printers.

	You're joking, right?  At the time nroff was written, you were
lucky to find a line printer that could do anything fancier than print a
subset of ascii (i.e. no lower case) and do linefeeds and formfeeds.  Even
if you expand the definition of "line printer" to mean "hard copy terminal"
that above is still largely true.
--
Roy Smith, Public Health Research Institute
455 First Avenue, New York, NY 10016
roy@alanine.phri.nyu.edu -OR- {att,cmcl2,rutgers,hombre}!phri!roy
"Arcane?  Did you say arcane?  It wouldn't be Unix if it wasn't arcane!"

plona@romulus.rutgers.edu (Lawrence Plona) (06/12/91)

>> nroff could have been written to do a lot more with line printers.

>You're joking, right?  At the time nroff was written, you were
>lucky to find a line printer that could do anything fancier than print a
>subset of ascii (i.e. no lower case) and do linefeeds and formfeeds.

Sorry, I did not realize that nroff source was sacred and
unable to be changed.

-Larry Plona
-- 

Sit denique inscriptum in fronte unius  "Let it finally be written on
cuiusque quid de rebus publicis sentiat  the forehead of each man what he
- Cicero                                 thinks of open systems"

pkr@sgi.com (Phil Ronzone) (06/12/91)

In article <1991Jun11.115142.8419@phri.nyu.edu> roy@phri.nyu.edu (Roy Smith) writes:
>plona@romulus.rutgers.edu (Lawrence Plona) writes:
>> nroff could have been written to do a lot more with line printers.
>
>	You're joking, right?  At the time nroff was written, you were
>lucky to find a line printer that could do anything fancier than print a
>subset of ascii (i.e. no lower case) and do linefeeds and formfeeds.  Even
>if you expand the definition of "line printer" to mean "hard copy terminal"
>that above is still largely true.


Actually, troff was written first. Nroff was a hack of troff that came
after.



--
Philip K. Ronzone (pkr@sgi.com)                     [OLD & HyperMedia Project]
Silicon Graphics, Inc. MS 9U-500                           work (415) 335-1511
2011 N. Shoreline Blvd., Mountain View, CA 94039            fax (415) 969-2314
"Gibber at that, ye scurvy rats", pkr     "Why, you little ...", Homer Simpson

brown@vidiot.UUCP (Vidiot) (06/12/91)

In article <Jun.11.15.32.56.1991.21125@romulus.rutgers.edu> plona@romulus.rutgers.edu (Lawrence Plona) writes:
<>> nroff could have been written to do a lot more with line printers.
<
<>You're joking, right?  At the time nroff was written, you were
<>lucky to find a line printer that could do anything fancier than print a
<>subset of ascii (i.e. no lower case) and do linefeeds and formfeeds.
<
<Sorry, I did not realize that nroff source was sacred and
<unable to be changed.

Of course the source is sacred.  It belongs to the copyright holder and only
they are allowed to change and distribute new source.

But, that isn't the real point.  If you want to do fancier things, the troff
program is what you need.  Now I am speaking generically here, since old troff
is for the C/A/T phototypsetter.  AT&T Documentor's Workbench is a redesigned
troff with generic output that used postprocessors to print the output on many
devices, one of which is a laser printer.  There is the publically available
psroff (not the Adobe TranScript one) that works with old troff and supplies
output for laser printers.  I'm not sure about other devices.  There is also
the groff suite of programs, which is a complete replacement for DWB troff.
The Adobe TranScript package will take output from old troff and DWB troff
and send it to a PostScript laser printer.

It would be much easier to use DWB troff or groff to provide output and build
a post-processor to send it to your device than it is to try and rewrite nroff.

To me, nroff is a dinosaur.  It has been replaced with the affore mentioned
programs.  One should never think of nroff as being anything more than a way
to send ASCII output to a fixed pitch device, like your CRT and daisy wheel
printer.  Line printers are included in this as well.

I said enough already.
-- 
      harvard\     att!nicmad\          spool.cs.wisc.edu!astroatc!vidiot!brown
Vidiot  ucbvax!uwvax..........!astroatc!vidiot!brown
      rutgers/  decvax!nicmad/ INTERNET:vidiot!brown%astroatc@spool.cs.wisc.edu

npn@cbnewsl.att.com (nils-peter.nelson) (06/12/91)

Poster wants to know if/why not nroff can be
enhanced for variable width dot matrix printers.

We supply the world with nroff; that is, all nroffs
I know of come from the original Bell Labs version
(except anything FSF supplies with groff).
We haven't changed nroff in recent memory; the code has
changed little since the 1970's.  The current DWB 3.1
and 3.2 packages have a troff postprocessor called dnroff
that permit you to use troff as a fixed-width printer
formatter. Variable-width nroff is not contemplated.

At some point we will drop nroff completely; instead,
you would use the pipeline
	... troff -Tnroff | dnroff | lp ...

It is simply not worth maintaining and testing a program
(nroff) that only works with 1970 technology devices.
troff does both jobs. I will add there is a misperception
that nroff is faster than troff-- it is not.

lewis@tramp.Colorado.EDU (LEWIS WILLIAM M JR) (06/13/91)

In article <1929@vidiot.UUCP> brown@vidiot.UUCP (Vidiot) writes:
...
...much dribble removed
...
>To me, nroff is a dinosaur.  It has been replaced with the affore mentioned
>programs.  One should never think of nroff as being anything more than a way
>to send ASCII output to a fixed pitch device, like your CRT and daisy wheel
>printer.  Line printers are included in this as well.
>
>I said enough already.
        ^^^^^^
       too much

And what you said is hogwash.  Given the proper version of nroff, i.e. one
that uses one of the tabXXX files in /usr/lib/term with the -TXXX option,
one can produce proportional output limited only by the printing device
resolution.  It takes a bit of work, but can be done.

plona@romulus.rutgers.edu (Lawrence Plona) (06/14/91)

Philip K. Ronzone (pkr@sgi.com)
> Actually, troff was written first. Nroff was a hack of troff that came
> after.

   According to The UNIX Programming Environment by Kernighan and
   Pike, nroff came first and troff was written as an extended
   version.  Apparently, nroff has been frozen since. The only change
   that comes to mind is the move from binary to text driving tables.

   Again, I'd like to say that I think that nroff should have been
   (I realize that its pointless now) updated with the increasing
   abilites of cheap printers. One look at an nroff driving table
   shows that the basis is already there.

   - Larry Plona
-- 

Sit denique inscriptum in fronte unius  "Let it finally be written on
cuiusque quid de rebus publicis sentiat  the forehead of each man what he
- Cicero                                 thinks of open systems"

npn@cbnewsl.att.com (nils-peter.nelson) (06/14/91)

Since the parentage of nroff is in question...
I have two unfair advantages-- I was around when it was
born, and I have access to the on-line data base of
all Bell Labs memos ever written.
runoff was the original grandaddy. I recall it was written
by Salzer at MIT in the 1960's. Generated fixed-width
line printer output, but did right justification, vertical
spacing, etc.
The date on the first nroff memo is 1973. It was intended
to take advantage of the Model 37 teletype, which had
lower-case letters (a breakthrough!), half-line spaces,
reverse line-feed.
The first troff memo is dated 1974. It was designed around
the features of the C/A/T phototypesetter (no lasers then--
it had a rotating wheel with tiny film images of the
characters.)  Joe Ossanna wrote both programs.
The essential difference between nroff and troff is troff's
ability to handle variable-width characters, and to move
freely around the page vertically and horizontally in small
increments (1/720 inch). Thus, a "fancy" nroff that takes
advantage of new printers would, in fact, be troff.

Were the original poster to do the modifications to nroff
he suggests, he'd get ragged right margins only, since
nroff believes all characters are equal width and
adjusts accordingly.
For those who still want to venture into this,
it is very easy to modify the troff font width tables
in DWB 3.1 and 3.2 (they are readable ASCII files in
a self-evident format) to agree with your favorite
printer, call it prt. Then "troff -mm -Tprt file | dnroff"
would do what you want (need width tables under
/usr/lib/font/devprt).

brown@vidiot.UUCP (Vidiot) (06/14/91)

In article <1991Jun13.011722.913@colorado.edu> lewis@tramp.Colorado.EDU (LEWIS WILLIAM M JR) writes:
<In article <1929@vidiot.UUCP> brown@vidiot.UUCP (Vidiot) writes:
<...
<...much dribble removed
<...
<>To me, nroff is a dinosaur.  It has been replaced with the affore mentioned
<>programs.  One should never think of nroff as being anything more than a way
<>to send ASCII output to a fixed pitch device, like your CRT and daisy wheel
<>printer.  Line printers are included in this as well.
<>
<>I said enough already.
<        ^^^^^^
<       too much
<
<And what you said is hogwash.  Given the proper version of nroff, i.e. one
<that uses one of the tabXXX files in /usr/lib/term with the -TXXX option,
<one can produce proportional output limited only by the printing device
<resolution.  It takes a bit of work, but can be done.

I've never see a nroff driver table built for proportional spaced printing.
The tables delivered with 4.3BSD are all fixed pitch devices.  I've had to
set up a couple of tables myself and have seen the area that appears to be
for character widths.

You are right about the amount of work.  But, I have never seen any documention
on building nroff tables.  One tends to dig through the source for one of the
tables to build another.  But never having seen one for a proportional spaced
printer, I was never able to build one for the Qume daisy wheel printer, using
a proportional wheel.  I wasn't going to even try to figure that out.

I still believe that nroff was meant for fixed spacing devices PERIOD.  For
proportional stuff I moved over to troff.
-- 
      harvard\     att!nicmad\          spool.cs.wisc.edu!astroatc!vidiot!brown
Vidiot  ucbvax!uwvax..........!astroatc!vidiot!brown
      rutgers/  decvax!nicmad/ INTERNET:vidiot!brown%astroatc@spool.cs.wisc.edu

clewis@ferret.ocunix.on.ca (Chris Lewis) (06/15/91)

In article <1991Jun13.200408.28043@cbnewsl.att.com> npn@cbnewsl.att.com (nils-peter.nelson) writes:

Thanks for the clarification...

>The date on the first nroff memo is 1973. It was intended
>to take advantage of the Model 37 teletype, which had
>lower-case letters (a breakthrough!), 

No kidding.  I still remember the hassles I had to go thru to
get the only lowercase printer on campus to emit lowercase given only 
an 029 keypunch (which didn't support lowercase) as the only
input device...  Those were the days.

>The essential difference between nroff and troff is troff's
>ability to handle variable-width characters, and to move
>freely around the page vertically and horizontally in small
>increments (1/720 inch).

Minor nit: 1/432's horizontally and 3/432's vertically.  I know C/A/T codes
rather intimately....

>Thus, a "fancy" nroff that takes advantage of new printers would, in fact,
>be troff.

Exactly.

One of these days I should implement a dumb ascii driver in psroff.
-- 
Chris Lewis, Phone: (613) 832-0541, Domain: clewis@ferret.ocunix.on.ca
UUCP: ...!cunews!latour!ecicrl!clewis; Ferret Mailing List:
ferret-request@eci386; Psroff (not Adobe Transcript) enquiries:
psroff-request@eci386 or Canada 416-832-0541.  Psroff 3.0 in c.s.u soon!

rcd@ico.isc.com (Dick Dunn) (06/19/91)

npn@cbnewsl.att.com (nils-peter.nelson) writes about getting nroff to work
with printers having non-fixed-pitch fonts:
...
> Were the original poster to do the modifications to nroff
> he suggests, he'd get ragged right margins only, since
> nroff believes all characters are equal width and
> adjusts accordingly.

It depends on the version of nroff.  It's certainly true for the DWB 2.x
versions of nroff, and for very old nroff.  There were intermediate ver-
sion(s) of nroff for which the "terminal description" did contain widths
for every character.  This was apparently intended to allow for characters
which were multiples of the standard fixed width.  However, it was possible
with these nroffs to set the unit width to the printer increment, build up
the character widths in multiples of this unit, and have nroff work with
variable-width characters--*almost*.  There were some bugs that prevented
it from working completely.  One of them had to do with underlining (as I
recall, nroff assumed that the underline character had unit width) and I
don't recall the others...it's been too many years since I tried it, but I
recall the final result being "so close, yet so far."
-- 
Dick Dunn     rcd@ico.isc.com -or- ico!rcd       Boulder, CO   (303)449-2870
   ...Simpler is better.

plona@romulus.rutgers.edu (Lawrence Plona) (06/19/91)

From: rcd@ico.isc.com (Dick Dunn)
> There were intermediate version(s) of nroff for which
> the "terminal description" did contain widths for every character...
> However, it was possible with these nroffs to set the unit width
> to the printer increment, build up the character widths in
> multiples of this unit, and have nroff work with variable-width
> characters--*almost*.  There were some bugs that prevented it from
> working completely...it's been too many years since I tried it,
> but I recall the final result being "so close, yet so far."

T H A N K   Y O U.  It is with this nroff that I have been driving
myself crazy. Now I can give up honorably!

- Larry Plona
-- 

Sit denique inscriptum in fronte unius  "Let it finally be written on
cuiusque quid de rebus publicis sentiat  the forehead of each man what he
- Cicero                                 thinks of open systems"