[cl-typesetting-devel] Reusing bits of code

Peter Seibel peter at gigamonkeys.com
Fri Jul 8 14:20:59 UTC 2005


On Jul 8, 2005, at 1:31 AM, Marc Battyani wrote:

> "Peter Seibel" <peter at gigamonkeys.com> wrote:
>
> [sorry for the late reply. I hope it's not to late...]

Nope. Thanks. I have one question below.


> Here is how I would do it:
>
> (defun draw-logo (x y scale rotation)
>   (let* ((big-font 48)
>   (small-font 16)
>   (extra-spacing 7)
>   (content
>    (compile-text ()
>             (with-style (:font "helvetica-bold" :font-size big-font)
>        (put-string "gigamonkeys")) :eol
>        (vspace -12)
>        (hspace 69)
>        (with-style (:font "helvetica" :font-size small-font)
>   (loop for char across "CONSULTING" do
>        (put-string (string char))
>        (typeset::add-box
>         (make-instance 'typeset::h-spacing
>          :dx extra-spacing
>          :max-expansion extra-spacing
>          :max-compression extra-spacing
>          :expansibility 1.0
>          :compressibility 1.0)))))))
>     (pdf:with-saved-state
>       (pdf:translate x y)
>       (pdf:scale scale scale)
>       (pdf:rotate rotation)
>       (typeset::draw-block content 0 0 412 100 :v-align :fill :border
> nil))))
>

So how did you arrive at the values 412 and 100? Trial-and-error?

-Peter

-- 
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