[comp.sys.hp] [tn]roff -> ThinkJet

jmm@skivs.UUCP (Joel M. Miller) (11/28/89)

Is there a filter?
-- 
Joel M Miller                      Internet: jmm@skivs.ski.org
Smith-Kettlewell Institute         Usenet:   uunet!skivs!jmm
2232 Webster St                    Bitnet:   jmm%skivs.ski.org@uunet.uu.net
San Francisco, CA 94115            Voice:    415/561-1703     Fax: 415/561-1610

davew@hp-ptp.HP.COM (Dave_Waller) (11/30/89)

No filter that I'm aware of for troff. However, if you are trying to
take nroff output and make it printable on a dumb printer, you can use
'col' to remove overstrikes and such, and that should work.

Dave Waller  \  The opinions expressed are solely my own, and in no way
Hewlett-Packard Co.  \  represent those of my employer (but we all know
dave@hpdstma.ptp.hp.com | hplabs!hpdstma!dave  \  they should!)

bd@hp-ses.SDE.HP.COM (Bob Desinger) (12/04/89)

I wanted to get at the different fonts built into the Thinkjet.  You
can do this with escape sequences, but who can remember them all?
I wanted to type a macro (as in .b to turn on bold, .c to turn on
compressed, and so forth).  I also wanted to occasionally be able to
use an nroff-style string (as in \*B to turn on bold, \*C to turn on
compressed, and so forth), so I whipped up the attached crude macro
package.

It turns on the appropriate fonts, sets the line length, and performs
page breaks in about the most barbaric way you could imagine.  That's
about *all* it does.  I've used it for a couple of years to create new
text when all I want is to change fonts and get a new page to come out
in the right spot.

Sadly, you'll have to know a fair amount of nroff to modify it.  I
wrote it for my own use, but there are at least examples in the file
as comments.  Briefly:

	.c
	This turns on compressed letters and sets the margins for it.
	.e
	This turns the letters into expanded and sets the margins.
	.l
	This turns on the font I use for letters,
	called "expanded-compressed" (?!) in the Thinkjet manual.
	That's a lower-case L up there in the macro name.
	.r
	This turns on the default ("Roman") font and margins,
	which matches the Thinkjet at power-up.

	You can also set \*Bboldface\*S in any font,
	and \*Iitalic\*N (really just underlined).
	Bold (\*B) is turned off by Shy (\*S);
	Italic (\*I, underlined) is turned off by Normal (\*N).
	[I couldn't think of a cute name for un-italic.]

The macro package starts nroff in no-fill mode because that's what I
use for the lecture outlines that I type up.

The BP macro does the Begin-Page spacing and header printing.  You get
an extra page with header after the final page of output---this is
what I mean by barbaric---but I typically thwart that by finishing up
my documents with a final command:

	.rm BP

It's crude but it works.  I'm real happy with the results on my
Integral PC and its built-in Thinkjet.  My typical command line is:

	nroff ~/lib/tmac.tj file

-- bd


# This is a shell archive.  Remove anything before this line,
# then unpack it by saving it in a file and typing "sh file".
#
# Wrapped by Bob Desinger <bd@hp-ses> on Mon Dec  4 00:16:32 1989
#
# This archive contains:
#	tmac.tj	(contains escape characters)


rm -f /tmp/uud$$
(echo "begin 777 /tmp/uud$$\n \nend" | uudecode) >/dev/null 2>&1
if [ -f /tmp/uud$$ ]
then
	rm -f /tmp/uud$$
	unpacker=uudecode
else
	echo Compiling unpacker for files containing escape characters
	pwd=`pwd`; cd /tmp
	cat >unpack$$.c <<-'EOF'
	#include <stdio.h>
	#define DEC(c)	(((c) - ' ') & 077)
	main()
	{
		int n;
		char dest[128], a,b,c,d;

		scanf("begin %o ", &n);
		gets(dest);

		if (freopen(dest, "w", stdout) == NULL) {
			perror(dest);
			exit(1);
		}

		while ((n=getchar()) != EOF && (n=DEC(n))!=0)  {
			while (n>0) {
				a = DEC(getchar());
				b = DEC(getchar());
				c = DEC(getchar());
				d = DEC(getchar());
				if (n-- > 0) putchar(a << 2 | b >> 4);
				if (n-- > 0) putchar(b << 4 | c >> 2);
				if (n-- > 0) putchar(c << 6 | d);
			}
			n=getchar();
		}
		exit(0);
	}
	EOF
	cc -o unpack$$ unpack$$.c
	rm unpack$$.c
	cd $pwd
	unpacker=/tmp/unpack$$
fi

echo x - tmac.tj '[contains escape characters]'
$unpacker <<'@eof'
begin 664 tmac.tj
M+EPB(&YR;V9F("UM=&H@;6%C<F]S(&9O<B!T:&4@=&AI;FMJ970*+EPB"BY<
M(B!&;VYT+7-E='1I;F<@;6%C<F]S.@HN7"()+F,@8V]M<')E<W-E9 D)+F(@
M8F]L9 HN7"()+F4@97AP86YD960)"2YI(&ET86QI8PHN7"()+G(@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0E *)VYR(",@7%QN)2LQ"B=&3PHG<W @-0HN=&P@
M)R=<*D-<7"HH5%,@7%QN(UQ<*B@I4"<*)W-P(#0*)VYS"BXN"BY<(B!3970@
D=&AE('1R87 @9F]R('!A9V4M8G)E86MS"BYW:" M.'8@0E *
 
end
@eof
set `wc -lwc <tmac.tj`
if test $1$2$3 != 1114732601
then
	echo ERROR: wc results of tmac.tj are $* should be 111 473 2601
fi

chmod 664 tmac.tj

rm -f /tmp/unpack$$
exit 0