[cl-typesetting-devel] Q: How to disable hyphenation andkerningglobally?

Peter Seibel peter at javamonkey.com
Wed Feb 11 22:26:54 UTC 2004


"Marc Battyani" <marc.battyani at fractalconcept.com> writes:

> Peter Seibel <peter at javamonkey.com> writes:

> > P.S. The beginning-of-page formatting lossage is still
> > happening--I have the latest cl-pdf and cl-typesetting from
> > subversion. I'm not sure how to characterize the problem it except
> > that the first paragraph of each page has some fairly high
> > probability of having its formatting screwed up in some way, often
> > manifesting as characters getting run together and overlapped,
> > sometimes by reverting to the default font. Without my patch this
> > happens on every page; with my patch it only happens sometimes.
> > Note that I'm adding a header to my page; that may have something
> > to do with it. My latest code is at:
> >
> >  <http://www.gigamonkeys.com/book/my-typeset.lisp>
> >
> > An output file that exhibits the problem is at:
> >
> >  <http://www.gigamonkeys.com/book/cl-typeset-bug.pdf>
> 
> Quite nice! (well except for the bug)
> 
> Your code seems ok for me when I look at it. If you send me some
> working toy exemple reproducing the problem I will look at it. It
> could be a mismatch between my graphic state and the pdf's one.

Okay. Here's some standalone code that demonstrates the problem. If
you take out the line that strokes the header box, it doesn't show up.
(BTW, this is running against the latest cl-typesetting without my
patch. With my patch the problem doesn't manifest on this document but
still does on more complex docs.)

(defun bug (&optional (file #P"/tmp/hello.pdf"))
  (let ((paragraphs
         (loop repeat 20 collect 
               (format 
                nil "~{~a~^ ~}"
                (loop repeat 20 collect "The quick brown fox jumps over the lazy dog."))))
        (width 612)
        (height 792)
        (margins '(108 36 108 108))
        (header-height (- 108 36)))
    (pdf:with-document ()
      (let ((content (typeset::compile-text 
                      () 
                      (dolist (p paragraphs) 
                        (typeset::paragraph
                         (:h-align :left :font "Times-Roman" :font-size 12)
                         (typeset::vspace 12)
                         (typeset::put-string p))))))
        (loop for header = (typeset::compile-text 
                            ()
                            (typeset::paragraph
                             (:h-align :right :font "Times-Roman" :font-size 12)
                             (typeset::put-string "HEADER") :eol))
            while (typeset::boxes content)
            do 
              (destructuring-bind (left &optional (top left) (right left) (bottom top)) margins
                (let ((x left)
                      (y (- height top))
                      (dx (- width left right))
                      (dy (- height top bottom)))
                  (pdf:with-page (:bounds (vector 0 0 width height))
                    (pdf:with-saved-state
                      (typeset::stroke
                        (typeset::make-filled-vbox header dx header-height :top) x y))
                    (typeset::stroke
                      (typeset::make-filled-vbox content  dx (- dy header-height) :top) x (- y header-height)))))))
      (pdf:write-document file))))

-Peter

-- 
Peter Seibel                                      peter at javamonkey.com

         Lisp is the red pill. -- John Fraser, comp.lang.lisp




More information about the cl-typesetting-devel mailing list