home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Usenet 1994 October
/
usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso
/
misc
/
volume4
/
troff2lj-v2
/
patch1
< prev
next >
Wrap
Internet Message Format
|
1989-02-03
|
4KB
Path: xanth!mcnc!rutgers!tut.cis.ohio-state.edu!cwjcc!hal!ncoast!allbery
From: brian@natinst.UUCP (Brian H. Powell)
Newsgroups: comp.sources.misc
Subject: v04i019: troff2lj patch for old LaserJets
Keywords: Works for new LJ's also
Message-ID: <892@natinst.UUCP>
Date: 11 Aug 88 14:02:15 GMT
Sender: allbery@ncoast.UUCP
Reply-To: brian@natinst.UUCP (Brian H. Powell)
Organization: National Instruments, Austin, TX
Lines: 92
Approved: allbery@ncoast.UUCP
Posting-number: Volume 4, Issue 19
Submitted-by: "Brian H. Powell" <brian@natinst.UUCP>
Archive-name: troff2lj-v2/Patch1
Here's a patch that will make the recently posted troff2lj filter work
for all LaserJets, not just the newer ones.
The newer models have positioning commands with 300dpi resolution. All
LaserJets have positioning commands with 720dpi resolution (for some reason).
Troff2lj was designed to use the 300dpi commands. I've changed a few simple
commands and scaling factors to get it to always use the 720dpi positioning
commands.
By the way, if anybody has fixed troff2lj to cope better with ligatures,
I'd really like to have your patches.
Brian H. Powell National Instruments Corp.
brian@natinst.uucp 12109 Technology Blvd.
cs.utexas.edu!natinst!brian Austin, Texas 78727-6204
AppleLink:D0351 (512) 250-9119 x832
or if that doesn't work, you can use brian@cs.utexas.edu.
# 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 natinst!brian on Thu Aug 11 08:58:12 CDT 1988
# Contents: troff2lj.diff
echo x - troff2lj.diff
sed 's/^@//' > "troff2lj.diff" <<'@//E*O*F troff2lj.diff//'
*** troff2lj.c Mon Aug 8 20:40:46 1988
--- troff2lj.new Mon Aug 8 20:39:43 1988
***************
*** 25,36 ****
/* Convert CAT units to LaserJet units and set first page offset (CAT units) */
! #define SCALE_X(n) ((300*n)/432)
#ifdef COMPRESS
! # define SCALE_Y(n) ((286.36*n)/432+75) /* 10.5", 0.25" margin */
# define SKIP 348 /* Empirical */
#else
! # define SCALE_Y(n) ((300*n)/432) /* 11", no margin */
# define SKIP 240 /* Empirical */
#endif
--- 25,36 ----
/* Convert CAT units to LaserJet units and set first page offset (CAT units) */
! #define SCALE_X(n) ((720*n)/432)
#ifdef COMPRESS
! # define SCALE_Y(n) ((687.27*n)/432+180) /* 10.5", 0.25" margin */
# define SKIP 348 /* Empirical */
#else
! # define SCALE_Y(n) ((720*n)/432) /* 11", no margin */
# define SKIP 240 /* Empirical */
#endif
***************
*** 49,56 ****
* \033&k2G line termination: CR->CR, LF->CRLF, FF->CRFF
*/
#define EXIT "\033E\033&k2G"
! #define X_POS(x) "\033*p%dX",x /* Left to right */
! #define XY_POS(x,y) "\033*p%dx%dY",x,y /* Top to bottom */
#define FORM_FEED "\033&l1H"
#define POINT_SIZE(n) "\033(s%dV",n
--- 49,56 ----
* \033&k2G line termination: CR->CR, LF->CRLF, FF->CRFF
*/
#define EXIT "\033E\033&k2G"
! #define X_POS(x) "\033&a%dH",x /* Left to right */
! #define XY_POS(x,y) "\033&a%dh%dV",x,y /* Top to bottom */
#define FORM_FEED "\033&l1H"
#define POINT_SIZE(n) "\033(s%dV",n
@//E*O*F troff2lj.diff//
chmod u=rw,g=r,o=r troff2lj.diff
echo Inspecting for damage in transit...
temp=/tmp/shar$$; dtemp=/tmp/.shar$$
trap "rm -f $temp $dtemp; exit" 0 1 2 3 15
cat > $temp <<\!!!
48 212 1473 troff2lj.diff
!!!
wc troff2lj.diff | sed 's=[^ ]*/==' | diff -b $temp - >$dtemp
if [ -s $dtemp ]
then echo "Ouch [diff of wc output]:" ; cat $dtemp
else echo "No problems found."
fi
exit 0