[cl-typesetting-devel] Vertical space at the top and bottom of a page
iso at wemba.edu.pl
iso at wemba.edu.pl
Thu Apr 12 22:55:41 UTC 2007
> Sorry I don't have an answer for you, but I didn't even know there
> was support for two-column layouts. How do you do that?
I copied the idea from Peter Seibel's markup package. This is how I do it
(this code is not tested; you will also have to define compile-header and
compile-footer functions or comment out the appropriate lines in
%draw-page-2-column)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun make-some-content ()
(compile-text ()
(paragraph (:h-align :left
:top-margin 0
:bottom-margin 5)
"some text")
;; add more stuff
))
(defun two-columns ()
(tt:with-document ()
(let ((content (make-some-content)))
(loop
while (typeset::boxes content)
do (%draw-page-2-column
content
:width 482
:height 708
:margins '(42 48 49 48)
:header-height 36
:footer-height 36
)))
(tt:write-document "/tmp/two-columns.pdf")))
(defun %draw-page-2-column (content
&key width height margins
(header-height 12) (footer-height 12)
(column-gap 10))
(destructuring-bind (left &optional (top left) (right left)
(bottom top))
margins
(let* ((x left)
(y (- height top))
(content-width (- width left right))
(content-height (- height top bottom))
(column-width (/ (- content-width column-gap) 2.0))
(main-height (- content-height header-height footer-height)))
(pdf:with-page (:bounds (vector 0 0 width height))
(pdf:with-saved-state
(tt::stroke
(make-filled-vbox content column-width main-height :top)
x (- y header-height))
(tt::stroke
(make-filled-vbox content column-width main-height :top)
(+ x column-width column-gap) (- y header-height))
(typeset::stroke
(compile-header content-width header-height)
x y)
(typeset::stroke
(compile-footer content-width footer-height)
x (+ bottom footer-height))
)))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> By the way, would :vfill be helpful for you in your situation? It
> just occurred to me that might help.
But where do I put it? I don't know where the page break will occur
(I'm using the cl-typesetting engine to determine this).
iso
More information about the cl-typesetting-devel
mailing list