home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / misc / volume4 / troff2lj-v2 / patch1 < prev    next >
Internet Message Format  |  1989-02-03  |  4KB

  1. Path: xanth!mcnc!rutgers!tut.cis.ohio-state.edu!cwjcc!hal!ncoast!allbery
  2. From: brian@natinst.UUCP (Brian H. Powell)
  3. Newsgroups: comp.sources.misc
  4. Subject: v04i019: troff2lj patch for old LaserJets
  5. Keywords: Works for new LJ's also
  6. Message-ID: <892@natinst.UUCP>
  7. Date: 11 Aug 88 14:02:15 GMT
  8. Sender: allbery@ncoast.UUCP
  9. Reply-To: brian@natinst.UUCP (Brian H. Powell)
  10. Organization: National Instruments, Austin, TX
  11. Lines: 92
  12. Approved: allbery@ncoast.UUCP
  13.  
  14. Posting-number: Volume 4, Issue 19
  15. Submitted-by: "Brian H. Powell" <brian@natinst.UUCP>
  16. Archive-name: troff2lj-v2/Patch1
  17.  
  18.      Here's a patch that will make the recently posted troff2lj filter work
  19. for all LaserJets, not just the newer ones.
  20.      The newer models have positioning commands with 300dpi resolution.  All
  21. LaserJets have positioning commands with 720dpi resolution (for some reason).
  22. Troff2lj was designed to use the 300dpi commands.  I've changed a few simple
  23. commands and scaling factors to get it to always use the 720dpi positioning
  24. commands.
  25.      By the way, if anybody has fixed troff2lj to cope better with ligatures,
  26. I'd really like to have your patches.
  27.  
  28. Brian H. Powell                    National Instruments Corp.
  29.     brian@natinst.uucp            12109 Technology Blvd.
  30.     cs.utexas.edu!natinst!brian        Austin, Texas 78727-6204
  31.     AppleLink:D0351                (512) 250-9119 x832
  32.  
  33. or if that doesn't work, you can use brian@cs.utexas.edu.
  34.  
  35. # This is a shell archive.  Remove anything before this line,
  36. # then unpack it by saving it in a file and typing "sh file".
  37. #
  38. # Wrapped by natinst!brian on Thu Aug 11 08:58:12 CDT 1988
  39. # Contents:  troff2lj.diff
  40.  
  41. echo x - troff2lj.diff
  42. sed 's/^@//' > "troff2lj.diff" <<'@//E*O*F troff2lj.diff//'
  43. *** troff2lj.c    Mon Aug  8 20:40:46 1988
  44. --- troff2lj.new    Mon Aug  8 20:39:43 1988
  45. ***************
  46. *** 25,36 ****
  47.   
  48.   /* Convert CAT units to LaserJet units and set first page offset (CAT units) */
  49.   
  50. ! #define SCALE_X(n)    ((300*n)/432)
  51.   #ifdef COMPRESS
  52. ! # define SCALE_Y(n)    ((286.36*n)/432+75)    /* 10.5", 0.25" margin */
  53.   # define SKIP        348            /* Empirical */
  54.   #else
  55. ! # define SCALE_Y(n)    ((300*n)/432)        /* 11", no margin */
  56.   # define SKIP        240            /* Empirical */
  57.   #endif
  58.   
  59. --- 25,36 ----
  60.   
  61.   /* Convert CAT units to LaserJet units and set first page offset (CAT units) */
  62.   
  63. ! #define SCALE_X(n)    ((720*n)/432)
  64.   #ifdef COMPRESS
  65. ! # define SCALE_Y(n)    ((687.27*n)/432+180)    /* 10.5", 0.25" margin */
  66.   # define SKIP        348            /* Empirical */
  67.   #else
  68. ! # define SCALE_Y(n)    ((720*n)/432)        /* 11", no margin */
  69.   # define SKIP        240            /* Empirical */
  70.   #endif
  71.   
  72. ***************
  73. *** 49,56 ****
  74.    * \033&k2G    line termination: CR->CR, LF->CRLF, FF->CRFF
  75.    */
  76.   #define EXIT        "\033E\033&k2G"
  77. ! #define X_POS(x)    "\033*p%dX",x        /* Left to right */
  78. ! #define XY_POS(x,y)    "\033*p%dx%dY",x,y    /* Top to bottom */
  79.   #define FORM_FEED    "\033&l1H"
  80.   #define POINT_SIZE(n)    "\033(s%dV",n
  81.   
  82. --- 49,56 ----
  83.    * \033&k2G    line termination: CR->CR, LF->CRLF, FF->CRFF
  84.    */
  85.   #define EXIT        "\033E\033&k2G"
  86. ! #define X_POS(x)    "\033&a%dH",x        /* Left to right */
  87. ! #define XY_POS(x,y)    "\033&a%dh%dV",x,y    /* Top to bottom */
  88.   #define FORM_FEED    "\033&l1H"
  89.   #define POINT_SIZE(n)    "\033(s%dV",n
  90.   
  91. @//E*O*F troff2lj.diff//
  92. chmod u=rw,g=r,o=r troff2lj.diff
  93.  
  94. echo Inspecting for damage in transit...
  95. temp=/tmp/shar$$; dtemp=/tmp/.shar$$
  96. trap "rm -f $temp $dtemp; exit" 0 1 2 3 15
  97. cat > $temp <<\!!!
  98.       48     212    1473 troff2lj.diff
  99. !!!
  100. wc  troff2lj.diff | sed 's=[^ ]*/==' | diff -b $temp - >$dtemp
  101. if [ -s $dtemp ]
  102. then echo "Ouch [diff of wc output]:" ; cat $dtemp
  103. else echo "No problems found."
  104. fi
  105. exit 0
  106.