NChar2Pixel
NChar2Pixel
Find screen position of carets and selection points short NChar2Pixel(textBuf, textLen, slop, offset, direction, styleRunPosition, numer, denom );
Ptr textBuf ; address of a text buffer long textLen ; value for text length
Fixed slop ; value indicating extra pixels long offset; nearest character offset
short direction; indicates direction script is written
JustStyleCode styleRunPosition ; the position of a style run within the line
Point denom ; scaling factor NChar2Pixel finds the screen position of carets and selection points, given For left-to-right scripts (including Kanji), this function works the same way
of Char2Pixel that works with intercharacter spacing, lets you indicate the position of a style run within a line for lines with multiple style runs, and
accepts scaling parameters.
textBuf is a text buffer indicated by a pointer.
textLen is the length of the specified string.
slop is the number of pixels to add to a string's width after it has been
scaled. For unjustified text pass 0.
offset is an integer that is the nearest character offset within the text
buffer corresponding to a given pixel width.
direction indicates if the script is written left-to- right, or otherwise. The
following pre defined constants are available for direction:
smLeftCaret = 0 place caret for left block
smRightCaret = -1 place caret for right block
smHilite = 1 direction is TESysJust
styleRunPosition For correct spacing between multiple style runs, you can specify
the position of a style run within the line by using the
styleRunPosition parameter of type JustStyleCode. See below for a
list of the values and meanings for these constants.
numer is a scaling factor denom is a scaling factor
Returns: a short, whose value indicates the screen position of carets and selection points.
Notes: To handle the spacing between multiple style runs on a line correctly, the
new justification routines take a styleRunPosition parameter that specifies
the position of the style run on a line.
The values for styleRunPosition are as follows:
Constant Meaning
smOnlyStyleRun This style run is the only one on the line.
smLeftStyleRun Multiple style runs are on the line, and this is the
leftmost.
smRightStyleRun Multiple style runs are on the line, and this is the
rightmost.
smMiddleStyleRun Multiple style runs are on the line, and this is
neither the leftmost nor the rightmost.
If styleRunPosition has the value smOnlyStyleRun, the justification
routines behave exactly like their earlier versions. For other values of
styleRunPosition, the behavior may depend on the script. The behavior for
routines, the text length should equal the entire visible part of the
style run on a line and should include trailing spaces if and only if
they are displayed. (They may not be displayed for the last style run
in the line, for example.) Otherwise, the results for the last
character on the line may be in valid.