LABELSIZE

Synopsis
LABELSIZE text
Description

Outputs the size (width and height) of the given text if it were rendered with the LABEL command. The input may be a word or a list. The output is a two item list [width height].

The width and height are always output relative to the text, not the turtle's orientation. The width is the length of the text along the direction that words are read. The height is line height of LABELFONT and is independent of the text input.

LABELSIZE's output may vary slightly depending on the turtle's orientation. For the best results, run LABELSIZE when the turtle's heading matches the heading when you run LABEL.

You can use LABELSIZE to build other forms of LABEL, such as CENTERLABEL or VERTICALLABEL. You can also use this information to "prepare" a site for text (for example, frame it or set a background).

Example
SETLABELFONT [[Times New Roman] -24 0 0 400 0 0 0 0 3 2 1 18]
SHOW LABELSIZE "Hello
[44 24]

SourceForge.net Logo