Loading

PtextWidth


processing
Since v1.0.0
Available on all platforms
See also

Calculates and returns the width of any character or text string.

Link to original Processing doc

Signature

Examples

// @preview image 200 200 '2D' PGraphics 255 Pbackground 0xff0000ff Pstroke //blue 0xffff0000 Pfill //red //will draw a box around the text with a 3px margin 'Warp 10' 'mytext' STORE 30 'fontsize' STORE 'CENTER' 'CENTER' PtextAlign 'CENTER' PrectMode $fontsize PtextSize PtextDescent 'a' STORE $mytext 100 100 $a - Ptext $mytext PtextWidth 'w' STORE PnoFill 100 100 $w 6 + $fontsize 6 + Prect Pencode