Friday, 6 July 2012

Vertical text in VID

I'm preparing a big post on VID, so I'm discovering many functions new to me. One very interesting is to obtain vertical text. VID is capable to rotate images of 90° at time, so it's just to convert the text in an image. So I created this function:
vert-text: func [
    {Rotate text, default vertically. Usage: view layout [image (vert-text "Hello!")]}
    the-text [string!]   "Your text"
    /local a
    ] [
        a: to-image layout/origin [ text the-text]   0x0
        a: to-image layout/origin [image   (as-pair   a/size/y a/size/x)   a effect   [rotate 270]] 0x0

Look at this example:

view layout [image red (vert-text "Hello world!" )]

I added the color in order to show you the small size of the image, just exactly the text size.
You can change the text style with any VID style.

No comments:

Post a Comment