From ungil at mac.com Sun Apr 2 23:49:32 2006 From: ungil at mac.com (Carlos Ungil) Date: Mon, 3 Apr 2006 01:49:32 +0200 Subject: [cl-typesetting-devel] sparklines Message-ID: <878FB132-05B5-4214-BF5C-CA3E87F7C874@mac.com> Hello, I've been playing with sparklines [*] using cl-typesetting, and I'd like to share what I've done. It's far from being complete (I should at least reafactor the code, fix some obvious bugs and add a little documentation), but I don't really know if I'll ever work on this again... http://ungil.com/sparklines.lisp contains the extension to cl- typesetting which is used in http://ungil.com/sparklines-example.lisp to produce the following output: http://ungil.com/sparklines.pdf By the way, Marc, do you plan to rewrite cl-pdf in python as well? :-) Regards, Carlos [*] see "Sparklines: theory and practice" in list of links at www.edwardtufte.com (or sparklines.com, which is redirected there) From peter at gigamonkeys.com Mon Apr 3 00:05:59 2006 From: peter at gigamonkeys.com (Peter Seibel) Date: Sun, 2 Apr 2006 17:05:59 -0700 Subject: [cl-typesetting-devel] sparklines In-Reply-To: <878FB132-05B5-4214-BF5C-CA3E87F7C874@mac.com> References: <878FB132-05B5-4214-BF5C-CA3E87F7C874@mac.com> Message-ID: <85A717B6-0D93-404B-ADD8-925A2C2A697D@gigamonkeys.com> On Apr 2, 2006, at 4:49 PM, Carlos Ungil wrote: > Hello, > > I've been playing with sparklines [*] using cl-typesetting, and I'd > like to share what I've done. It's far from being complete (I > should at least reafactor the code, fix some obvious bugs and add a > little documentation), but I don't really know if I'll ever work on > this again... > > http://ungil.com/sparklines.lisp contains the extension to cl- > typesetting which is used in http://ungil.com/sparklines- > example.lisp to produce the following output: http://ungil.com/ > sparklines.pdf Neat! This is something I've been meaning to do for about as long as I've been using cl-pdf but have never gotten around to. (I think Tufte has talked about the notion before--I remember hearing him talk about it several years ago at one of his lectures.) -Peter -- Peter Seibel * peter at gigamonkeys.com Gigamonkeys Consulting * http://www.gigamonkeys.com/ Practical Common Lisp * http://www.gigamonkeys.com/book/ From gwking at metabang.com Mon Apr 3 00:45:01 2006 From: gwking at metabang.com (Gary King) Date: Sun, 2 Apr 2006 20:45:01 -0400 Subject: [cl-typesetting-devel] sparklines In-Reply-To: <878FB132-05B5-4214-BF5C-CA3E87F7C874@mac.com> References: <878FB132-05B5-4214-BF5C-CA3E87F7C874@mac.com> Message-ID: Hi Carlos, I second Peter's comments. This is great! On Apr 2, 2006, at 7:49 PM, Carlos Ungil wrote: > Hello, > > I've been playing with sparklines [*] using cl-typesetting, and I'd > like to share what I've done. It's far from being complete (I > should at least reafactor the code, fix some obvious bugs and add a > little documentation), but I don't really know if I'll ever work on > this again... > > http://ungil.com/sparklines.lisp contains the extension to cl- > typesetting which is used in http://ungil.com/sparklines- > example.lisp to produce the following output: http://ungil.com/ > sparklines.pdf > > By the way, Marc, do you plan to rewrite cl-pdf in python as well? :-) > > Regards, > > Carlos > > [*] see "Sparklines: theory and practice" in list of links at > www.edwardtufte.com (or sparklines.com, which is redirected there) > _______________________________________________ > cl-typesetting-devel site list > cl-typesetting-devel at common-lisp.net > http://common-lisp.net/mailman/listinfo/cl-typesetting-devel -- Gary Warren King metabang.com http://www.metabang.com/ From marc.battyani at fractalconcept.com Mon Apr 3 07:27:17 2006 From: marc.battyani at fractalconcept.com (Marc Battyani) Date: Mon, 3 Apr 2006 09:27:17 +0200 Subject: [cl-typesetting-devel] sparklines References: <878FB132-05B5-4214-BF5C-CA3E87F7C874@mac.com> Message-ID: <1a8401c656f0$09a584e0$1402a8c0@marcx2> "Carlos Ungil" wrote: > I've been playing with sparklines [*] using cl-typesetting, and I'd like > to share what I've done. It's far from being complete (I should at least > reafactor the code, fix some obvious bugs and add a little > documentation), but I don't really know if I'll ever work on this > again... Well no problem with the doc, it will be on the same level than the cl-typesetting one ;-) > http://ungil.com/sparklines.lisp contains the extension to cl- typesetting > which is used in http://ungil.com/sparklines-example.lisp to produce the > following output: http://ungil.com/sparklines.pdf Pretty cool! I will integrate it as is. > By the way, Marc, do you plan to rewrite cl-pdf in python as well? :-) Hehe... For that one I am looking at Ruby. ;-) Marc From peter at gigamonkeys.com Sat Apr 29 04:29:07 2006 From: peter at gigamonkeys.com (Peter Seibel) Date: Fri, 28 Apr 2006 21:29:07 -0700 Subject: [cl-typesetting-devel] Patch to quiet warnings Message-ID: Here's a patch to quiet the warnings from cl-typesetting. -Peter Index: defpackage.lisp =================================================================== --- defpackage.lisp (revision 118) +++ defpackage.lisp (working copy) @@ -23,6 +23,7 @@ #:mark-ref-point #:find-ref-point #:find-ref-point-page-number #:find-ref-point-page-data #:add-contextual-action #:set-contextual-variable #:push- contextual-variable #:pop-contextual-variable #:get-contextual-variable + #:draw-block #:boxes )) Index: tables.lisp =================================================================== --- tables.lisp (revision 118) +++ tables.lisp (working copy) @@ -209,6 +209,7 @@ ;; (group2-height row7) ;; (group3-height row8 row9 ...) ) ;; + (declare (ignore dx)) (if (splittable-p table) (with-slots (header footer border padding cell-padding) table ;(print (rows table)) (loop with fitted-rows = () Index: pprint.lisp =================================================================== --- pprint.lisp (revision 118) +++ pprint.lisp (working copy) @@ -129,6 +129,7 @@ (let* ((margins '(30 50 30 50)) (print-stamp (multiple-value-bind (second minute hour date month year) (get-decoded-time) + (declare (ignore second)) (format nil "Printed on ~4D-~2,'0D-~2,'0D ~2,'0D:~2,'0D" year month date hour minute))) (header (compile-text () Index: layout.lisp =================================================================== --- layout.lisp (revision 118) +++ 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,7 +171,7 @@ (return-lines)))) (defmethod do-layout (box) - ) + (declare (ignore box))) (defmethod do-layout ((hbox hbox)) (loop with dy = (dy hbox) and baseline = (internal-baseline hbox) Index: kw-extensions.lisp =================================================================== --- kw-extensions.lisp (revision 118) +++ 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)) @@ -442,18 +443,21 @@ (pdf:draw-text "D r a f t")))) (defun decoration-random-background (box x y dx dy) + (declare (ignore box)) (pdf:with-saved-state (pdf:set-rgb-fill (random 1.0) (random 1.0) (random 1.0)) (pdf:basic-rect x y dx dy) (pdf:fill-path))) (defun decoration-green-background (box x y dx dy) + (declare (ignore box dy)) (pdf:with-saved-state (pdf:set-rgb-fill 0.7 1.0 0.7) (pdf:basic-rect x (- y 2) dx (- 1 *font-size*)) (pdf:fill-path))) (defun decoration-circles (box x y dx dy) + (declare (ignore box)) (pdf:with-saved-state (pdf:set-color-stroke #xff33cc) (pdf:set-line-width 0.3) @@ -461,6 +465,7 @@ (pdf:stroke))) (defun decoration-gray-box (box x y dx dy) + (declare (ignore box)) (pdf:with-saved-state (pdf:set-gray-stroke 0.5) (pdf:set-line-width 0.5) @@ -468,6 +473,7 @@ (pdf:stroke))) (defun decoration-underline (box x y dx dy) + (declare (ignore box)) (pdf:with-saved-state (pdf:set-gray-stroke 0) (pdf:set-line-width (* 0.06 *font-size*)) @@ -476,6 +482,7 @@ (pdf:stroke))) (defun decoration-strikethrough (box x y dx dy) + (declare (ignore box)) (pdf:with-saved-state (pdf:set-color-stroke :red) (pdf:set-line-width (* 0.06 *font-size*)) @@ -484,6 +491,7 @@ (pdf:stroke))) (defun decoration-crosshatch (box x y dx dy) + (declare (ignore box)) (pdf:with-saved-state (pdf:set-color-stroke :black) (pdf:set-line-width 0.5) @@ -492,6 +500,7 @@ (pdf:stroke))) (defun decoration-nil (box x y dx dy) + (declare (ignore box x y dx dy)) (print "Called nil decoration.") nil) Index: test.lisp =================================================================== --- test.lisp (revision 118) +++ test.lisp (working copy) @@ -122,11 +122,12 @@ ;; user-drawn box (defun user-drawn-demo (box x y) - (draw-block (compile-text () - (paragraph (:h-align :justified :top-margin 5 :first-line- indent 10 - :font "Times-Italic" :font-size 6.5) - *par1*)) - x (- y (dy box)) (- (dy box) 10) (dx box) :rotation 90 :border 0.1)) + (draw-block + (compile-text () + (paragraph (:h-align :justified :top-margin 5 :first-line- indent 10 + :font "Times-Italic" :font-size 6.5) + *par1*)) + x (- y (dy box)) (- (dy box) 10) (dx box) :rotation 90 :border 0.1)) ;; a chart (I will have to change this in cl-pdf: it's a real mess!) @@ -655,40 +656,40 @@ #+nil (defun multi-page-hello (&optional (file #P"/tmp/hello.pdf")) - (pdf:with-document () - (let ((content - (compile-text () - (vspace 100) - (table (:col-widths '(100 200) :splittable-p t) ;;; start Erik changes - (header-row () - (cell () - (paragraph () "Header"))) - (footer-row () - (cell () - (paragraph () "Footer"))) - (dotimes (time 50) - (row () + (pdf:with-document () + (let ((content + (compile-text () + (vspace 100) + (table (:col-widths '(100 200) :splittable-p t) ;;; start Erik changes + (header-row () + (cell () + (paragraph () "Header"))) + (footer-row () + (cell () + (paragraph () "Footer"))) + (dotimes (time 50) + (row () (cell () - (paragraph () (put-string (format nil "test ~d" time))))))) ;;; end Erik changes - (vspace 10) - :eol - (paragraph (:h-align :center :font "Helvetica-Bold" :font-size 50 - :color '(0.0 0 0.8)) - "cl-typesetting" :eol - (vspace 2) - (hrule :dy 1) - (with-style (:font "Times-Italic" :font-size 26) - "The cool Common Lisp typesetting system") - (vspace 50) - (with-style (:font "Times-Italic" :font-size 36 :color '(0.0 0 - 0.8)) - (dotimes (i 100) - (put-string "Hello World!")(new-line))))))) - (loop while (boxes content) do - (pdf:with-page () - (pdf:set-line-width 0.1) - (draw-block content 20 800 545 700)))) - (pdf:write-document file))) + (paragraph () (put-string (format nil "test ~d" time))))))) ;;; end Erik changes + (vspace 10) + :eol + (paragraph (:h-align :center :font "Helvetica-Bold" :font-size 50 + :color '(0.0 0 0.8)) + "cl-typesetting" :eol + (vspace 2) + (hrule :dy 1) + (with-style (:font "Times-Italic" :font-size 26) + "The cool Common Lisp typesetting system") + (vspace 50) + (with-style (:font "Times-Italic" :font-size 36 :color '(0.0 0 + 0.8)) + (dotimes (i 100) + (put-string "Hello World!")(new-line))))))) + (loop while (boxes content) do + (pdf:with-page () + (pdf:set-line-width 0.1) + (draw-block content 20 800 545 700)))) + (pdf:write-document file))) ;;; Unicode test Index: boxes.lisp =================================================================== --- boxes.lisp (revision 118) +++ 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 118) +++ boxes-fn.lisp (working copy) @@ -34,7 +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)) (when (boxes box) @@ -44,6 +44,7 @@ (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) &rest args &key fixed-size &allow-other-keys) @@ -57,7 +58,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) (setf (baseline box) (case alignment Index: hyphenation-fp.lisp =================================================================== --- hyphenation-fp.lisp (revision 118) +++ hyphenation-fp.lisp (working copy) @@ -52,10 +52,14 @@ ) ) +;;; What the heck are these next two methods for? --Peter Seibel + (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 118) +++ typo.lisp (working copy) @@ -8,12 +8,13 @@ ((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) @@ -288,7 +289,7 @@ (defmethod insert-stuff ((obj symbol)) `(put-string (format nil "~a" ,obj))) -(defmacro with-text-content ((content &key dont-save-style) &body body) +(defmacro with-text-content ((content) &body body) (with-gensyms (the-content) `(let* ((,the-content ,content) (*content* ,the-content) @@ -306,7 +307,7 @@ (progn , at body)))) (defmacro compile-text ((&rest args) &body body) - `(with-text-content ((make-instance 'text-content , at args) :dont- save-style t) + `(with-text-content ((make-instance 'text-content , at args)) (add-box (copy-style (text-style *content*))) ,@(mapcar 'insert-stuff body) *content*)) Index: stroke.lisp =================================================================== --- stroke.lisp (revision 118) +++ stroke.lisp (working copy) @@ -5,7 +5,7 @@ (in-package typeset) (defmethod stroke (box x y) - ) + (declare (ignore box x y))) (defmethod stroke :before ((box char-box) x y) (when (functionp *pre-decoration*) @@ -99,6 +99,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) -- Peter Seibel * peter at gigamonkeys.com Gigamonkeys Consulting * http://www.gigamonkeys.com/ Practical Common Lisp * http://www.gigamonkeys.com/book/