From jcm at FreeBSD-uk.eu.org Tue Jan 16 16:27:55 2007 From: jcm at FreeBSD-uk.eu.org (Jonathon McKitrick) Date: Tue, 16 Jan 2007 16:27:55 +0000 Subject: [cl-typesetting-devel] Multi-page example Message-ID: <20070116162755.GA960@dogma.freebsd-uk.eu.org> I'm working with the multi-page example, and I have some questions. First, why does this code produce no output? (defun test-multi-page () (with-document () (let* ((header (compile-text () (paragraph (:h-align :center :font *font* :font-size *font-size*) "This is our header") (hrule :dy 0.5))) (footer (lambda (pdf:*page*) (compile-text (:font *font* :font-size *font-size*) (hrule :dy 0.5) (hbox (:align :center :adjustable-p t) :hfill (verbatim (format nil "Page ~D" pdf:*page-number*)))))) (content (compile-text (:font *font* :font-size *font-size*) (dotimes (i 40) (paragraph (:font *font* :font-size *font-size*) "Here is some content")) :eop))) (draw-pages content :margins '(72 72 72 72) :header header :footer footer) (pdf:write-document "web/data/test-report.pdf")))) Also, some definitions: Why exactly is an hbox? What is the function of :eop and :break :after? What is the difference between put-string and verbatim? When does finalize-page need to be called? Thanks in advance for your help. Jonathon McKitrick -- My other computer is your Windows box. From marc.battyani at fractalconcept.com Fri Jan 19 21:14:14 2007 From: marc.battyani at fractalconcept.com (Marc Battyani) Date: Fri, 19 Jan 2007 22:14:14 +0100 Subject: [cl-typesetting-devel] Re: [cl-pdf-devel] Can't add link in cl-typesetting References: <20070119192604.GA23359@dogma.freebsd-uk.eu.org> Message-ID: <02a501c73c0e$c5df6870$1402a8c0@marcx2> "Jonathon McKitrick" wrote: > > Here's a snippet that generates the error. OK I tried it and from looking at the error, the problem is that you call a cl-pdf function during the text compilation but the text compilation is like a macro in Common Lisp, it is run at a macro-expansion time before the code is executed. So your add-link is run during the text compilation but that not when you generate the pdf, it's too early and not inside a pdf with-page. So here you have to use a user-drawn box or make your own kind of box in which you can call your function. BTW I think that add-link works with the page coordonates not with the scaled/translated ones so maybe it's not so simple. Marc From rkm101 at mac.com Thu Jan 25 18:59:18 2007 From: rkm101 at mac.com (Ken McKee) Date: Thu, 25 Jan 2007 13:59:18 -0500 Subject: [cl-typesetting-devel] More on laying out sub-boxes Message-ID: <06FBA948-7F64-4CBE-8360-DA845F5676E1@mac.com> I read the thread from Jun 2005 regarding laying out boxes. http://common-lisp.net/pipermail/cl-typesetting-devel/2005-June/ thread.html Peter Seibel inquired about the natural size of content blocks. A better solution was found for his task, but I would like to pursue his original intent. Our documents are comprised of sections, subsections and items. We need, at least, to avoid splitting the items across pages. Is there a way to ask cl-typesetting to keep a content block on the same page, even if means pushing the entire block to the next page? This would satisfy our immediate needs. If not, we can paginate the document ourselves. To do this (without falling back on cl-pdf) we will need to find the size of a block of content (a text-content?). In the end we might want to do this anyway. We have some options to layout an item. For example, they can be vertically or horizontally inclined. I can imagine that we would use cl-typesetting's features to layout the text within each content block, but our layout engine could adjust the options for the items to avoid splitting items and subsections. Thanks, Ken McKee Duke University From marc.battyani at fractalconcept.com Fri Jan 26 12:01:08 2007 From: marc.battyani at fractalconcept.com (Marc Battyani) Date: Fri, 26 Jan 2007 13:01:08 +0100 Subject: [cl-typesetting-devel] More on laying out sub-boxes References: <06FBA948-7F64-4CBE-8360-DA845F5676E1@mac.com> Message-ID: <019601c74141$ad3c2c30$1402a8c0@marcx2> "Ken McKee" wrote: > > I read the thread from Jun 2005 regarding laying out boxes. > http://common-lisp.net/pipermail/cl-typesetting-devel/2005-June/ > thread.html > Peter Seibel inquired about the natural size of content blocks. A better > solution was found for his task, but I would like to pursue his original > intent. > > Our documents are comprised of sections, subsections and items. > We need, at least, to avoid splitting the items across pages. > > Is there a way to ask cl-typesetting to keep a content block on the same > page, even if means pushing the entire block to the next page? > This would satisfy our immediate needs. > > If not, we can paginate the document ourselves. To do this (without > falling back on cl-pdf) we will need to find the size of a block of > content (a text-content?). In the end we might want to do this anyway. We > have some options to layout an item. For example, they can be vertically > or horizontally inclined. I can imagine that we would use > cl-typesetting's features to layout the text within each content block, > but our layout engine could adjust the options for the items to avoid > splitting items and subsections. Right now there is no "keep this as one block" option but you can insert :eop to force a new page. So you just need to compute the sizes of your blocks and then insert :eop where needed. To compute the height of a block something like this should work: (compute-boxes-natural-size (boxes (make-filled-vbox block-content width 10000000 :top)) #'dy) Marc From rkm101 at mac.com Fri Jan 26 20:38:03 2007 From: rkm101 at mac.com (Ken McKee) Date: Fri, 26 Jan 2007 15:38:03 -0500 Subject: [cl-typesetting-devel] More on laying out sub-boxes In-Reply-To: <019601c74141$ad3c2c30$1402a8c0@marcx2> References: <06FBA948-7F64-4CBE-8360-DA845F5676E1@mac.com> <019601c74141$ad3c2c30$1402a8c0@marcx2> Message-ID: Marc Battyani wrote: > "Ken McKee" wrote: >> ... >> If not, we can paginate the document ourselves. To do this >> (without falling back on cl-pdf) we will need to find the size of >> a block of content (a text-content?). In the end we might want to >> do this anyway. We have some options to layout an item. For >> example, they can be vertically or horizontally inclined. I can >> imagine that we would use cl-typesetting's features to layout the >> text within each content block, but our layout engine could >> adjust the options for the items to avoid splitting items and >> subsections. > > Right now there is no "keep this as one block" option but you can > insert :eop to force a new page. So you just need to compute the > sizes of your blocks and then insert :eop where needed. > > To compute the height of a block something like this should work: > (compute-boxes-natural-size (boxes (make-filled-vbox block-content > width 10000000 :top)) #'dy) > > Marc Thanks Marc. That works. Ken From gwking at metabang.com Wed Jan 31 00:08:21 2007 From: gwking at metabang.com (Gary King) Date: Tue, 30 Jan 2007 19:08:21 -0500 Subject: [cl-typesetting-devel] patches Message-ID: <5FC30948-2F1A-4920-9B87-95E77E1D4146@metabang.com> Here are the patches that remove all compiler warnings (at least under Allegro). As in CL-PDF, most of these are (declare (ignore ...)) style things. I will commit these unless I hear otherwise. Index: tables.lisp =================================================================== --- tables.lisp (revision 130) +++ tables.lisp (working copy) @@ -201,6 +201,7 @@ +epsilon+)))) (defmethod v-split ((table table) dx dy) + (declare (ignore dx)) "Factor out rows that fit and return a split table + the table." ;; Treat unsplittable rows as a single unit - for this purpose, ;; group the rows list into the following form: Index: layout.lisp =================================================================== --- layout.lisp (revision 130) +++ layout.lisp (working copy) @@ -15,6 +15,7 @@ box) (defmethod cut-point-p (box) + (declare (ignore box)) nil) (defmethod cut-point-p ((box (eql :eol))) @@ -170,6 +171,7 @@ (return-lines)))) (defmethod do-layout (box) + (declare (ignore box)) ) (defmethod do-layout ((hbox hbox)) Index: kw-extensions.lisp =================================================================== --- kw-extensions.lisp (revision 130) +++ kw-extensions.lisp (working copy) @@ -235,6 +235,7 @@ ((type :accessor mark-type :initform nil :initarg :type))) (defmethod stroke ((mark change-mark) x y) + (declare (ignore x)) ;; "stroking" change marks just records their positions for later ;; rendering in the postprocessing hook (cond ((eq :start-insert (mark-type mark)) Index: boxes.lisp =================================================================== --- boxes.lisp (revision 130) +++ boxes.lisp (working copy) @@ -12,27 +12,35 @@ )) (defmethod dx (box) + (declare (ignore box)) 0) (defmethod (setf dx) (value box) + (declare (ignore box)) value) (defmethod dy (box) + (declare (ignore box)) 0) (defmethod (setf dy) (value box) + (declare (ignore box)) value) (defmethod baseline (box) + (declare (ignore box)) 0) (defmethod (setf baseline) (value box) + (declare (ignore box)) value) (defmethod offset (box) + (declare (ignore box)) 0) (defmethod (setf offset) (value box) + (declare (ignore box)) value) (defclass h-mode-mixin () @@ -42,18 +50,23 @@ ()) (defmethod delta-size (obj) + (declare (ignore obj)) 0) (defmethod max-expansion (obj) + (declare (ignore obj)) 0) (defmethod expansibility (obj) + (declare (ignore obj)) 0) (defmethod max-compression (obj) + (declare (ignore obj)) 0) (defmethod compressibility (obj) + (declare (ignore obj)) 0) (defclass soft-box (box) @@ -65,9 +78,11 @@ (locked :accessor locked :initform nil :initarg :locked))) (defmethod locked (box) + (declare (ignore box)) t) (defmethod (setf locked) (value box) + (declare (ignore box)) value) (defclass container-box (soft-box) @@ -106,30 +121,35 @@ ((trimmable-p :accessor trimmable-p :initform nil :initarg :trimmable-p))) (defmethod soft-box-p (box) + (declare (ignore box)) nil) (defmethod soft-box-p ((box soft-box)) t) (defmethod char-box-p (box) + (declare (ignore box)) nil) (defmethod char-box-p ((box char-box)) t) (defmethod white-char-box-p (box) + (declare (ignore box)) nil) (defmethod white-char-box-p ((box white-char-box)) t) (defmethod trimmable-p (box) + (declare (ignore box)) nil) (defmethod trimmable-p ((box glue)) t) (defmethod white-space-p (box) + (declare (ignore box)) nil) (defmethod white-space-p ((box glue)) @@ -139,18 +159,21 @@ t) (defmethod hmode-p (box) + (declare (ignore box)) nil) (defmethod hmode-p ((box h-mode-mixin)) t) (defmethod vmode-p (box) + (declare (ignore box)) nil) (defmethod vmode-p ((box v-mode-mixin)) t) (defmethod adjust-box-dx (box dx baseline) + (declare (ignore box dx baseline)) nil) (defmethod adjust-box-dx ((box hbox) dx baseline) @@ -164,6 +187,7 @@ (baseline box) baseline))) (defmethod adjust-box-dy (box dy baseline) + (declare (ignore box dy baseline)) nil) (defgeneric v-split (box dx dy) Index: boxes-fn.lisp =================================================================== --- boxes-fn.lisp (revision 130) +++ boxes-fn.lisp (working copy) @@ -34,6 +34,7 @@ finally (return (values (+ max-baseline max-bottom) max-baseline)))) (defmethod compute-natural-box-size (box) + (declare (ignore box)) ) (defmethod compute-natural-box-size ((box hbox)) @@ -44,9 +45,11 @@ (setf (dy box) size (internal-baseline box) baseline)))) (defmethod (setf boxes) :after (value (box container-box)) + (declare (ignore value)) (compute-natural-box-size box)) -(defmethod initialize-instance :after ((box container-box) &key fixed-size &allow-other-keys) +(defmethod initialize-instance :after + ((box container-box) &key fixed-size &allow-other-keys) (unless fixed-size (compute-natural-box-size box))) @@ -57,6 +60,7 @@ (setf (dy box) (compute-boxes-natural-size (boxes box) #'dy))) (defmethod align-baseline (box alignment) + (declare (ignore box alignment)) ) (defmethod align-baseline ((box hbox) alignment) Index: hyphenation-fp.lisp =================================================================== --- hyphenation-fp.lisp (revision 130) +++ hyphenation-fp.lisp (working copy) @@ -53,9 +53,11 @@ ) (defmethod (setf pattern-trie) (value hyphen-trie) + (declare (ignore hyphen-trie)) value) (defmethod (setf exception-trie) (value hyphen-trie) + (declare (ignore hyphen-trie)) value) (defvar *left-hyphen-minimum* 2 Index: typo.lisp =================================================================== --- typo.lisp (revision 130) +++ typo.lisp (working copy) @@ -8,12 +8,14 @@ ((name :accessor name :initform nil))) (defmethod use-style (style) + (declare (ignore style)) ) (defmethod style-p ((style style)) t) (defmethod style-p (obj) + (declare (ignore obj)) nil) (defclass text-style (style) @@ -290,6 +292,7 @@ (defmacro with-text-content ((content &key dont-save-style) &body body) ;; TODO dont-save-style is not used, fix it or delete + (declare (ignore dont-save-style)) (with-gensyms (the-content) `(let* ((,the-content ,content) (*content* ,the-content) Index: stroke.lisp =================================================================== --- stroke.lisp (revision 130) +++ stroke.lisp (working copy) @@ -5,6 +5,7 @@ (in-package #:typeset) (defmethod stroke (box x y) + (declare (ignore box x y)) ) (defmethod stroke :before ((box char-box) x y) @@ -99,6 +100,7 @@ (end-text-chunk)))) (defmethod stroke ((style text-style) x y) + (declare (ignore x y)) (when (font style) (setf *font* (font style))) (when (font-size style) -- Gary Warren King, metabang.com Cell: (413) 885 9127 Fax: (206) 338-4052 gwkkwg on Skype * garethsan on AIM