LABEL

Synopsis
LABEL text
Description

Prints text on the screen. If text is a list, then any sub-lists are delimited by square brackets, but the entire object is not delimited by brackets. You can print any Logo thing (numbers, lists, strings, etc.). Note that the handle of the string (the origin) is the top-left corner of the string. Another thing to be aware of is that the capabilities of the text changes depending on the device (screen or printer), the size, the turtle heading (direction) and the font. In other words, sometimes the text can be drawn at the turtle heading and sometimes it cannot. Sometimes what is on the screen will not be exactly what you print.

The position of the text is determined by the location of the turtle.

The angle of the text is determined by the heading (direction) of the turtle.

The color of the text will be the value of PENCOLOR, which is set with SETPENCOLOR.

The text will use the font described by LABELFONT, which is set with SETLABELFONT or the Set->Label Font menu item.

The width and height of the text's bounding box can be determined with LABELSIZE.

LABEL can be used in PERSPECTIVE mode but the text will not be on the same plane as the turtle. The text will be placed wherever the turtle is on the screen and oriented according to the turtle's heading.

If you want to flash a message by writing it in one color, then writing the same message in the background color, you should disable anti-aliasing in the LABELFONT by choosing a Quality of 3 when you call SETLABELFONT. Otherwise, you'll end up with a faint outline of the message you wanted to completely erase.

Example
; label the axes of a 3D Cartesian Coordinate System
TO AXIS
  SETLABELFONT [[Courier New] -19 0 0 700 0 0 0 0 3 2 1 49]
  RIGHT 90

  SETY  200
  LABEL "+Y
  SETY  -200
  LABEL "-Y
  SETY 0

  SETX 200
  LABEL "+X
  SETX -200
  LABEL "-X
  SETX 0

  SETZ 200
  LABEL "+Z
  SETZ -200
  LABEL "-Z
  SETZ 0
  LEFT 90
END

PERSPECTIVE
CLEARSCREEN
SETTURTLE -1 ; select the eye position
SETPOSXYZ [600 600 800]
SETTURTLE 0
AXIS
; flash a message
TO FLASH :message
  ; Quality=3 will disable anti-aliasing
  SETLABELFONT [[Arial] -19 0 0 700 0 0 0 0 3 2 3 49]
  PENPAINT
  LABEL :message
  WAIT 180
  PENERASE
  LABEL :message
  PENPAINT
END

TO TELLJOKE
  FLASH [Q: Why did the chicken cross the road?]
  FLASH [A: To get to the other side!]
  FLASH [Ha! ha! ha!]
END

SourceForge.net Logo