CLIM mail archive

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

Output-recording for fast word wrap



I am displaying text in a CLIM window on the Macintosh.  When I use
indenting-output and filling-output to position the text in the window,
complete with wordwrap, the performance is unacceptable (4 seconds
versus < 1 second without filling-output/indenting-output for 20
lines of text).

So, I'm thinking of a 2 phase operation.
Phase 1.  Read text from file.  Calculate the required linefeeds.
          Store result of this computation, including explicitly
          indicated linefeeds.  This is essentially a pre-processing phase.

Phase 2.  Read formatted text from file.  Write to screen.  This will
          be done "live" when the user asks to see the text.

I can think of 3 ways to get the formatted information I want
1)  Use with-output-to-postscript to create a postscript representation
    of the text.  Can this be read into CLIM later?  If so, how?

2)  Use with-output-to-output-record to get the formatted version.
    Is there a way to store the resulting output record in a file for
    reading/replaying in a later session?

   As an aside, a mini-test I tried didn't work:
(defmethod display ((abstract abstract) stream)
  (with-slots (lmargin) *application-frame*
    (let ((line-length (- (window-inside-width stream) (* 2 lmargin))))
      
      (with-output-to-output-record 
        (stream 'clim::linear-output-record new-record)
        (indenting-output (stream lmargin)
          (filling-output (stream :fill-width line-length)
            ;; do a bunch of writing
            (mapc #'(lambda (obj)
                      (display obj stream)) (seq abstract))))
      (replay new-record stream)
      )
      
   Nothing was ever displayed in the pane.  Without the (with-output-to-output-
   record.....(replay...)) code, this works.  Why doesn't this work?

3)  Use my own wrapping code.  I've done this in the past, but would like to
    use CLIM's output records, if possible, since they capture change in
    fonts as well as just wrapping information.


I'm open to any other suggestions to improve speed.

Susan Gauch
sgauch@flora.ccs.northeastern.edu

0,,

Follow-Ups:

Main Index | Thread Index