[cl-typesetting-devel] How does rotation work?
Peter Seibel
peter at gigamonkeys.com
Wed Jul 20 17:47:08 UTC 2005
On Jul 20, 2005, at 10:38 AM, Marc Battyani wrote:
> 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))
> ...
Hmmm. I'll have to look back at my code when I get a chance. I got it
working but I seem to recall having to manage the translation myself.
-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