User Tools

Site Tools


logolib:ttprint

Runs on Terrapin Logo 4

TTPRINT - Formatted text drawing

The TURTLETEXT command makes the turtle draw text using the current turtle font. Along with the TURTLETEXTSIZE, TURTLETEXTBASE and SETFONT commands, the turtle can draw text using all fonts that are installed on the computer.

This sample defines the TTPRINT procedure. The procedure accepts a list as input. Each list element is again a list that contains a chunk of text. The first element of the list is the font to use, which is a three-element list of font name, font size, and font attributes. See the SETFONT command for an explanation of the format of a font list.

The procedure uses the TURTLETEXTSIZE command to define the size of the bounding rectangle around a drawn text chunk. The TURTLETEXTBASE command outputs the offset of the top left corner to the font's baseline. The baseline is the line that children use to write text upon. Letters like “g” fall below the baseline. All chunks need to be aligned on the baseline to make the text appear as being printed.

ttprint.jpg

TTPRINT.lgo
Procedure:
TTPRINT
Description:
Drawing of formatted text
Level:
Intermediate
Compatible:
Logo 4
Tags:
Fonts, Text drawing, Turtle
logolib/ttprint.txt · Last modified: 2018/08/27 03:39 (external edit)