[cl-typesetting-devel] How to make some text flush leftandsomeflush right?

Peter Seibel peter at gigamonkeys.com
Thu Jul 27 23:09:33 UTC 2006


On Jul 27, 2006, at 3:27 PM, Marc Battyani wrote:

> "Peter Seibel" <peter at gigamonkeys.com> wrote:
>
>> On Jul 26, 2006, at 2:19 PM, Peter Seibel wrote:
>>
>>> There are two problems with the output.
>>
>>> The other problem, which I just noticed, is that not all the
>>> content is rendered. FWIW, the next thing that should appear is a
>>> table; dunno if that matters or not.
>>
>> So, I'm seeing the same problem even without tables involved. Here's
>> a stand-alone test that seems to show that draw-pages has problems
>> emitting the last page. Attached is the PDF I get.
>
> OK I will try to look at that and at your previous email in the  
> plane to Vancouver. (I'm leaving in 6 hours and still packing the  
> luggage)

Okay. Here's one more simple test that shows the problem with weird  
inter-word spacing. (*text* is the same as in the previous email).  
Attached is what I get.

-Peter

(defun test-header-&-footer (file)
   (with-document ()
     (let* ((content
	    (compile-text ()
	      (loop for p in *text* do
		   (paragraph (:h-align :left :font "Times-Roman" :font-size 12)
		     (vspace 12)
		     (put-string p)))))
	   (width (* 8.5 72))
	   (height (* 11 72))
	   (header-height 36)
	   (footer-height 36)
	   (left 72)
	   (right 72)
	   (top 36)
	   (bottom 36)
	   (x left)
	   (y (- height top))
	   (content-width (- width left right))
	   (content-height (- height top bottom))
	   (main-height (- content-height header-height footer-height)))
       (loop while (boxes content) do
	   (pdf:with-page (:bounds (vector 0 0 width height))
	     (pdf:with-saved-state
	       (typeset::stroke
		(make-filled-vbox
		 content
		 content-width main-height :top) x (- y header-height))
	       (typeset::stroke
		(make-filled-vbox
		 (compile-text (:font "Times-Italic" :font-size 10)
		   (paragraph (:h-align :fill)
		     (put-string "Gigamonkeys Transactions Foo")
		     :hfill
		     (put-string (format nil "Page ~d" pdf:*page-number*))))
		 content-width header-height :top) x y)
	       (typeset::stroke
		(make-filled-vbox
		 (compile-text (:font "Times-Italic" :font-size 10)
		   (paragraph (:h-align :fill)
		     (put-string (format nil "Copyright ~c ~a" +copyright+  
*copyright*))
		     :hfill
		     (put-string "27 July 2006, 3:58 pm")))
		 content-width footer-height :bottom) x (+ bottom footer-height))))))
     (pdf:write-document file))
   (truename file))

-------------- next part --------------
A non-text attachment was scrubbed...
Name: header-footer-test.pdf
Type: application/pdf
Size: 64762 bytes
Desc: not available
URL: <https://mailman.common-lisp.net/pipermail/cl-typesetting-devel/attachments/20060727/09b299de/attachment.pdf>
-------------- next part --------------


-- 
Peter Seibel           * peter at gigamonkeys.com
Gigamonkeys Consulting * http://www.gigamonkeys.com/
Practical Common Lisp  * http://www.gigamonkeys.com/book/




More information about the cl-typesetting-devel mailing list