[cl-typesetting-devel] Why does this wrap?
Peter Seibel
peter at gigamonkeys.com
Thu Sep 7 03:51:32 UTC 2006
With the code below I get a table that wraps the contents of the
first cell despite there being plenty of room for the text. Can
someone explain why or what I'm missing or whatever.
-Peter
(in-package :cl-user)
(defpackage :com.gigamonkeys.checkboxes-test
(:use :cl :typeset))
(in-package :com.gigamonkeys.checkboxes-test)
(defclass checkbox (typeset::soft-box typeset::h-mode-mixin) ())
(defun checkbox ()
(typeset::add-box (make-instance 'checkbox
:baseline typeset::*font-size*
:dx typeset::*font-size*
:dy typeset::*font-size*)))
(defmethod typeset::stroke ((box checkbox) x y)
(pdf:with-saved-state
(pdf:set-line-width .5)
(pdf:set-color-stroke :black)
(pdf:set-color-fill :white)
(pdf:circle (+ x 3) (+ y 3) 3)
(pdf:close-fill-and-stroke)))
(defun everyday-checklist (&optional (file #P"/tmp/checklist.pdf"))
(with-document ()
(let ((content
(compile-text ()
(paragraph (:font "Helvetica" :font-size 6)
(table (:col-widths (list* 60 (loop repeat 8 collect (/ 115
8))) :border .1 :background-color '(1 1 1) :cell-padding 0 :padding
0 :splittable-p t)
(row ()
(cell () (put-string "Date"))
(cell () (put-string "M"))
(cell () (put-string "T"))
(cell () (put-string "S"))
(cell () (put-string "S"))
(cell () (put-string "J"))
(cell () (put-string "M"))
(cell () (put-string "R"))
(cell () (put-string "W")))
(dotimes (i 21)
(row ()
(cell () (put-string "2006-09-06"))
(dotimes (i 8)
(cell ()
(checkbox))))))))))
(draw-pages content :size #-(or)(cons (* 3 72) (* 5 72)) #+
(or):letter :margins '(18 18 18 18) :break :always)
(pdf:write-document file)))
(truename file))
--
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