Using text

One of the advanced commands lets you add text to your drawing. Text can be used to give some information to the user (e.g. on how to interact with you program, or you can simply use it to create nice drawings).

You can find all examples in this lesson here.

Text is drawn in a standard font. (This might be changed in a future version of Drape.) But you can vary the font size using the size commands. Here is a little program that puts some large words on the picture. By using the sleep command after each word and erasing the screen afterwards, the words pop up one at a time. Here is the program (TEXT1.DRP):

You can also draw text in different sizes. Here we draw 10 lines of text, each followed by a small size decrease and a little move upward (TEXT2.DRP):

And, as a third example, here we get some text in a circle (TEXT3.DRP):

The program might look a bit complicated but this is just to get the text started at the right position. (Note that the text itself does not rotate. This might be added in a future version of Drape.) Now try to create a spiral with letters.

I hope this has given you some new ideas on how to make nice Drape programs. Please don’t forget to mail your creations to markov@cs.ruu.nl.


Back to the Lessons Page