From divanov at aha.ru Fri Sep 1 05:38:50 2006 From: divanov at aha.ru (Dmitriy Ivanov) Date: Fri, 1 Sep 2006 09:38:50 +0400 Subject: [cl-typesetting-devel] Re: [cl-pdf-devel] Hyphenation References: <20060831181105.GA25167@dogma.freebsd-uk.eu.org> Message-ID: <000001c6cd8d$dbd9e190$8100a8c0@digo> Hello Jonathon, | Is there any way to turn off hyphenation? I use the following version of typeset:put-string. (defvar *default-language* nil "Default hyphenation language used by put-string.") (defun put-string (string &optional (language *default-language*)) ;;; DI: Check for language (hyphenation pattern is absent for Russian). (when (stringp string) (let ((hyphen-points (when language (hyphenate-string string language)))) (loop with hyphen-point = (pop hyphen-points) for prev-char = #\I then char for char across string for i from 0 for kerning = (* (pdf:get-kerning prev-char char *font* *font-size*) *text-x-scale*) do (when (and hyphen-point (= i hyphen-point)) (setf hyphen-point (pop hyphen-points)) (add-box (make-instance 'hyphen-box :char-box (make-char-box #\-)))) (cond ((white-char-p char) (cond ((white-char-p prev-char) nil) ((punctuation-mark-p prev-char)(add-box (make-punctuation-space-box prev-char))) (t (add-box (make-white-char-box #\Space))))) (t (unless (zerop kerning) (add-box (make-kerning-space kerning))) (add-box (make-char-box char)) (add-box (make-inter-char-glue)))))))) AFAIU, you should not worry about my version of hyphenate-string. -- Sincerely, Dmitriy Ivanov lisp.ystok.ru From peter at gigamonkeys.com Thu Sep 7 03:51:32 2006 From: peter at gigamonkeys.com (Peter Seibel) Date: Wed, 6 Sep 2006 20:51:32 -0700 Subject: [cl-typesetting-devel] Why does this wrap? Message-ID: 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/ From marc.battyani at fractalconcept.com Thu Sep 7 07:26:14 2006 From: marc.battyani at fractalconcept.com (Marc Battyani) Date: Thu, 7 Sep 2006 09:26:14 +0200 Subject: [cl-typesetting-devel] Why does this wrap? References: Message-ID: <3f3201c6d24e$e6b6f5b0$1402a8c0@marcx2> "Peter Seibel" wrote: > 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. Putting the cell content in a paragraph fixes this: BTW each cell is a separate cl-typesetting engine and don't inherit the settings like the font, font-size, etc. (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 () (paragraph (:h-align :left) (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)) Marc From peter at gigamonkeys.com Thu Sep 7 18:36:54 2006 From: peter at gigamonkeys.com (Peter Seibel) Date: Thu, 7 Sep 2006 11:36:54 -0700 Subject: [cl-typesetting-devel] Why does this wrap? In-Reply-To: <3f3201c6d24e$e6b6f5b0$1402a8c0@marcx2> References: <3f3201c6d24e$e6b6f5b0$1402a8c0@marcx2> Message-ID: <2B0C546D-9F47-410A-A127-8248A304F6AE@gigamonkeys.com> On Sep 7, 2006, at 12:26 AM, Marc Battyani wrote: > "Peter Seibel" wrote: > >> 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. > > Putting the cell content in a paragraph fixes this: > BTW each cell is a separate cl-typesetting engine and don't inherit > the settings like the font, font-size, etc. Ah, I see. So is there any way to get the total size of the cell (for instance so I can use it in my STROKE method to figure out where to put the circle within in each cell)? -Peter -- Peter Seibel * peter at gigamonkeys.com Gigamonkeys Consulting * http://www.gigamonkeys.com/ Practical Common Lisp * http://www.gigamonkeys.com/book/