[cl-typesetting-devel] Anyway to measure the size of some text
Peter Seibel
peter at javamonkey.com
Tue Oct 5 18:31:32 UTC 2004
Is there any way to determine the "natural" size of some generated
text? For instance I have this function that generates a header:
(defun compile-header (content-width)
(let ((cols 2))
(typeset:table
(:col-widths (loop repeat cols collect (/ content-width cols))
:border 0
:padding 0
:cell-padding 0)
(typeset::row ()
(typeset:cell ()
(typeset::paragraph
(:h-align :left :font "Times-Italic" :font-size 10)
(typeset::put-string
(typeset::get-contextual-variable 'chapter-name))))
(typeset:cell ()
(typeset::paragraph
(:h-align :right :font "Times-Italic" :font-size 10)
(typeset::put-string (format nil "Page ~d of ~d"
pdf:*page-number*
(typeset:find-ref-point-page-number :the-end)))))))))
But I want to layout the table based on the natural widths of the
contents of the cells. In particular in this case I'd like to know the
minimum width of the second cell in order to avoid wrapping the
contents so I can then set :col-widths of the table to make the second
column that wide and give the remainder to the first cell.
-Peter
--
Peter Seibel peter at javamonkey.com
Lisp is the red pill. -- John Fraser, comp.lang.lisp
More information about the cl-typesetting-devel
mailing list