[cl-typesetting-devel] Reusing bits of code
Marc Battyani
marc.battyani at fractalconcept.com
Fri Jul 8 14:51:47 UTC 2005
Peter Seibel wrote:
> 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?
It's from your original code...
>(typeset::draw-block content 100 (- 792 100) (- 612 (* 2 100))
>100 :v-align :fill :border nil)))
Though I made some constant folding optimization ;-)
Marc
More information about the cl-typesetting-devel
mailing list