text()

Description
This function will print text of character, strings and numbers to the screen. If the height parameter is used, the default Hershey font (futural) will be used.

Syntax


text("hi", x, y)

or

text(data, x, y)

or

text(stringdata, x, y,  height)

or

text(stringdata, x, y,  width, height)


Parameters

data – char pointer, char, int, or float: the alphanumeric symbols to be displayed

x – int : x-coordinate of the text

y – int: y-coordinate of the text

stringdata – char pointer: letters to be displayed

width – int: width of the text (not implemented)

height – int: height of the text.

Returns

none

Example



/////////////////////////////////////////
//setup
/////////////////////////////////////////
void setup()
{
background(0,0,0);
stroke(255,255,255);
fill(0,0,0);
}

/////////////////////////////////////////
//loop
/////////////////////////////////////////
void loop()
{
text((int)321,5,5); //print the integer 321 at pixel location 5,5
text((double)122.345,50,50); //print the double 122.345 at pixel location 50,50
text((long)7654321,100,100); //print the long 7654321 at pixel location 100,100
text((float)4321.456,150,150); //print the float 4321.456 at pixel location 150,150
text(“no pony!”,200,200); //print the character string “no pony!” at pixel location 200,200
}




Edit History