strlen -- determine the width of a string
float strlen ( string string[, array params[, int tabwidth]] )
This function returns the width (in PDF units) that the specified string will be when painted to the page.
The only parameters that affect the calculation are height and font. Other parameters will be ignored, so the same parameter array used to calculate the width can be used to place the string. If unspecified, default values are used.
The optional parameter tabwidth
is used to determine how
to calculate the width of tab characters (ascii 0x09). It specifies the
number of spaces wide that a tab should be. The default is 4.
Many character codes do not have a width associated with them, these characters will cause a 3002 error to be pushed onto the error stack, but the function will return the width of the string as if those characters were zero length.
The strlen
function was added in version 1.13.
Additional error checking was added in 2.8.
The processing of fixed-width (Courier) fonts is approximately twice as fast as variable-width fonts (Helvetica, Times).