Pixel2Char
Pixel2Char Find nearest character offset
#include <Script.h> Script Manager
short Pixel2Char(textBuf, textLen, slop, pixelWidth, leftSide );
Ptr textBuf ; address of a text buffer
short textLen ; value for text length
short slop ; value for justified text, 0=not justified
short pixelWidth ; value for character width
Boolean *leftSide ; use if pixel width falls within character's left side
returns a short specifying the offset of the character closest
to pixelWidth
Pixel2Char is the inverse of Char2Pixel. It is used to find the nearest
character offset within a text buffer for a given pixel width.
textBuf is the address of a text buffer where the character is stored.
textLen is the length of the specified character.
slop designates justified text. It specifies how many extra pixels must be
added to the length of the string. Use 0 if the text is not justified.
pixelWidth is the width of the character in pixels.
leftSide is a Boolean flag that is set if the pixel width falls within the left
side of a character. It can be used for word selection and for
positioning the cursor correctly at the end of lines.
Returns: a short, whose value indicates the offset of the character that
pixelWidth is closest to.

Notes: The leftSide flag is set to indicate word selection and for positioning the
cursor correctly at the end of lines. If the character offset is at the end of a
word and leftSide is on, the double click used for word selection is actually
on the following character and the preceding word should not be selected.