Char2Pixel
Char2Pixel Find the screen position of carets and selection points
#include <Script.h> Script Manager
short Char2Pixel(textBuf, textLen, slop, offset, direction );
Ptr textBuf ; address of a text buffer
short textLen ; value for text length
short slop ; value for justified text, 0=not justified
short offset ; value for offset from closest character width
SignedByte direction ; value for either location of caret or endpoint for
highlighting
returns a short specifying the screen position of carets and
selection points
Char2Pixel is the inverse of Pixel2Char. It is used to find the screen
position of carets and selection points, given the text and length.
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.
offset is the offset to the closest character in pixels.
direction is a SignedByte that indicates if Char2Pixel is being called to
determine where the caret should appear or to find the endpoints for
highlighting. Uni directional scripts have a value of 1. Use the
following predefined constants to specify direction:
smLeftCaret = 0 place caret for left block
smRightCaret = -1 place caret for right block
smHilite = 1 direction is TESysJust
Returns: a short, whose value indicates the screen position of carets and
selection points, given the text and length.

Notes: For left-to-right scripts, this call works the same as TextWidth. Even
so, the arguments passed are not the same. TextWidth takes a redundant
byteCount argument. The length and offset for Char2Pixel are not
equivalent; the routine needs the context of the complete text in order to
determine the correct value.
When the call is used to blink the insertion, the direction parameter
should depend on the keyboard script. However, since the keyboard script
can change between drawing and erasing the insertion point your application
has to remember where it drew the cursor, and go back and erase that
position again. You do this by telling the application to remember the
keyDirection, the pixel width, or the entire rectangle.