[cl-typesetting-devel] How does rotation work?

Marc Battyani marc.battyani at fractalconcept.com
Wed Jul 20 17:38:26 UTC 2005


Peter Seibel wrote:
> On Jul 20, 2005, at 10:25 AM, Marc Battyani wrote:
>
> > Peter Seibel wrote:
> >
> > Hi Peter,
> >
> > Sorry for the long reply delay, I'm just coming back from
> > backpacking in the
> > Alps :-)
> >
> >> I'm trying to set set a block of text rotated 90 degrees but the
> >> rotation seems to rotate the box right off the page. Around what axis
> >> does pdf:rotate rotate stuff? Or more to the point, what's the
> >> easiest way to draw a block at a particular place but rotated 90
> >> degrees?
> >>
> >
> > You can use the rotation parameter of draw-block. The rotation is
> > around the
> > top left corner of the block IIRC.
>
> Actually I think the rotation is around 0,0. So the trick is to use
> pdf:translate to translate the coordinate system to where you want
> the top left corner of the box to be and then draw-block at 0, 0 with
> whatever rotation you want. But if you draw-block at some x,y with a
> rotation it requires advanced trig to figure out where the box is
> actually going to end up. At least it seems that way to my math
> impaired brain.

No, draw-block already does the translate + rotation:

;;; from top-level.lisp

(defmethod draw-block (content x y dx dy
                       &key border (padding 5) rotation (v-align :top)
special-fn)
  (pdf:with-saved-state
    (pdf:translate x y)
    (when rotation
      (pdf:rotate rotation))
...

Marc





More information about the cl-typesetting-devel mailing list