SHIP:Sail:textWidth

From Serious Documentation
Jump to: navigation, search
Function Returns Introduced Description
textWidth Integer v5.1.0 Returns the horizontal pixel width of a string.

See Also:

Prototype

Integer textWidth(String s);

Parameters/Return Value

Parameter Data Type Description
s String String to measure
Return Integer number of horizontal pixels in the string

Detailed Description

The textWidth function returns the number of horizontal pixels in a string. Font size and type can vary the result.

Examples

Example Result Notes
textWidth("hello");
38 20 pt font
textWidth("hello");
58 32 pt font
textWidth("");
0