[cl-typesetting-devel] Reusing bits of code

Marc Battyani marc.battyani at fractalconcept.com
Fri Jul 8 16:10:14 UTC 2005


Peter Seibel wrote:

> On Jul 8, 2005, at 7:51 AM, Marc Battyani wrote:
>
> > Peter Seibel wrote:
> >>
> >> 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 ;-)
>
> Duh. Okay, so my real question is, how *should* those numbers be
> picked. It seems silly to draw this enormous block (I basically based
> the block size on the paper size (American letter) minus some
> margins. But obviously the logo doesn't actually take that much
> space. But if I make the values too small it complains that it can't
> fit the contents.

You can get the "natural" size on some text content with something like
that:

(compute-boxes-natural-size
   (boxes (compile-text ()
          (with-style (:font "Times-Roman") "foo"))) #'dx)
15.996

Note that this will give the width of the full text before the line
breaking.

Otherwise for trial and error it's useful to draw the block border to
speed-up the convergence process.

Marc





More information about the cl-typesetting-devel mailing list