Draws text to the screen. Displays the information specified in the first parameter on the screen in the position specified by the additional parameters. A default font will be used unless a font is set with the PtextFont function and a default size will be used unless a font is set with PtextSize. Change the color of the text with the Pfill function. The text displays in relation to the PtextAlign function, which gives the option to draw to the left, right, and center of the coordinates.

The x2 and y2 parameters define a rectangular area to display within and may only be used with string data. When these parameters are specified, they are interpreted based on the current PrectMode setting. Text that does not fit completely within the rectangle specified will not be drawn to the screen.

Note that Processing now lets you call Ptext without first specifying a PFont with PtextFont. In that case, a generic sans-serif font will be used instead.

Link to original Processing doc

Ptext is available since version 1.0.0.

See also



// @preview image //using default text settings 120 200 '2D' PGraphics 255 Pbackground //white 0xff0000ff Pstroke //blue 0xffff0000 Pfill //red 20 PtextSize 10 20 1 1 Prect //blue dot 'Warp 10' 10 20 Ptext //coordinates = bottom left PnoFill 10 50 50 90 Prect 0xffff0000 Pfill //red 'ncc-1701' 10 50 50 90 Ptext //constrained in a rectangle Pencode