Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!brutus.cs.uiuc.edu!apple!csibtfr!motcsd!hpda!hpcuhb!hp-ses!bd From: bd@hp-ses.SDE.HP.COM (Bob Desinger) Newsgroups: comp.sys.hp Subject: Re: [tn]roff -> ThinkJet Message-ID: <920040@hp-ses.SDE.HP.COM> Date: 4 Dec 89 08:29:45 GMT References: <2848@skivs.UUCP> Organization: HP Software Engineering Systems, Palo Alto Lines: 183 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 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 #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 HN7"()5V]R9',@:6X@>"!F;W)M870L"BY<(@EA0HN7"()7"I%(&5X<&%N M9&5D"5PJ4B!R;VUA;@E<*DD@:71A;&EC"5PJ3B!N;W)M86P*+EPB"BY<(B!" M;VQD("A<*D(I(&ES('1U'0M87)G M"BYD92!F,0HN7"(@+FQL(%Q<)#()7"(@=7-E(&-U