[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Getting LaserJets to work

I too had trouble getting our LaserJet+ to work correctly with the new file
format (why it puts 'regular' symbolics carriage returns at the end of full
lines, and 'ascii' carriage returns at the end of blank lines, I'll never
know (unless someone tells me)).  I hope this will work for the LaserJet
II, too.

There are a few functions in the system code you have to change:

First, there is a file called Ascii.Lisp.  It does the following defmethod,
which is optional (it makes the laserjet use the smaller font so more can
go on a page).

(defmethod (print-start-header ascii-printer-manager) (request)
  (with-open-stream (hs (hardcopy:make-hardcopy-stream
                          :output-stream stream
                          :keep-output-stream-open-p t))
     ;;I added the following line:
     (format hs "~CE~C&l0O~C(8U~C(s0p16.66h8.5v0s0b0T~C&l8D" 27 27 27 27 27)
     ;;which makes the laserjet do small letters.

Next, you _must_ use the following to make the laserjet spit out the last
page of the file:

(defmethod (end-request ascii-printer-manager) (request)
  (ignore request)
  ;;following line laserjet specific
  (format stream "~CE" 27))

Note: if you change the file directly, I believe that the base is 8 in the
system printer files, so those ascii escapes (the 27s above) will have to
become octal (i.e., 33).

Next, to get those wierd carriage returns to go away, you must change the
following defmethod in the file >rel-7>hardcopy>stream.lisp.  

;;; Simple minded.  Probably don't need optimization...
(defmethod (:set-device-cursorpos simple-hardcopy-stream) ()
;; after the line
    (loop repeat (- device-cursor-y cursor-y)
;; change what's there to
          do (send output-stream ':tyo #\cr))
;; it was (send output-stream ':tyo (char-to-ascii #\cr)) .. why this
;; doesn't work is beyond me.

Then, change this defmethod:
(defmethod (:eject-page simple-hardcopy-stream) (&optional ignore)
   ;;changed: was ':tyo (char-to-ascii #\page)
   (send output-stream ':tyo (char-code #\cr))
   (send output-stream ':tyo (char-code #\page))

This makes sure that, before you do a page feed, the laserjet's cursor is
set to the leftmost column.  If you don't do that, then the first line on
the new page will start in the column the previous line ended at, rather
than at the left-hand edge of the page.

I define two files that do these things, and have them load when each user
logs in (rather than change the worlds, since I change things pretty often,
and don't like to be constantly redoing worlds).

This brings up two points:

	First, I have to make a pretty convoluted hack to get the loader
NOT to complain that the functions defined in the file being loaded are
redefinitions of stuff defined elsewhere.  Couldn't this be an (optional)
switch on load?

	Second, I understand that Symbolics can't (or won't, anyway -- I
don't specially blame them) implement perfect printer drivers for every
brand of printer that exists, but wouldn't it be nice (for us!) to have
something like termcap for unix, so WE can tell it what to send to OUR printer,
just once, for each thing, and not have to go in and hack code.

	Third (nobody expects the spanish...), as long as I'm complaining
about load, I created a useful program in a particular package (kee), and
tried loading it into a world in whom Kee didn't exist; I figured, well,
I'll just tell the load function (or the command line Load File) to use
a :package of 'cl-user.  WELL -- load bombs (both ways!) into the debugger,
and makes me respecify the package to get it to load!  _I_ know Kee doesn't
exist, that's why I told you to use the other package... aaarrrgghg.

	chris sterritt