|
This Technical Note describes another limit on the length of a TextEdit record
that was previously undocumented.
[Jun 01 1989]
|
Introduction
The TextEdit chapters in Inside Macintosh document the 32K character
limit on a TextEdit record length. They do not, however, discuss the more
subtle constraint on the size of the destRect . By definition, the
destRect uses integer values for the top-left and bottom-right
boundary points. It is possible to have values too large for the
destRect without reaching the teLength limit.
The nLines field gives the number of lines in the edit record, and the
lineHeight field specifies the vertical distance from the ascent line
from one line of text to the ascent line of the next line. In styled TextEdit,
the lineHeight may vary for each line depending on the font and font
size. These values are entries in the lineHeight table.
Figure 1. LineHeight
The product of the lineHeight (or the largest lineHeight
value in styled TextEdit) and nLines gives a good approximation, in
pixels, of the vertical dimension of the destRect of the
TERec used. If this value is greater than 32,768, then unpredictable
and erratic behavior may result.
For example:
2,400 lines of Chicago 12 point yields nLines = 2,400 and
lineHeight = 16.
nLines * lineHeight = 2400 * 16 = 38,400. This is above the
32K limit.
1,200 lines of Times 24 point yields nLines = 1,200 and
lineHeight = 30.
nLines * lineHeight = 1200 * 30 = 36,000. This is above the
32K limit.
In both of the examples above, the number of characters in the edit record was
less than 32,768.
Back to top
Check All Constraints
Both TELength and the size of the destRect must be under the
32K limit. You can compute an approximate vertical height of the
destRect by finding the product of nLines and
lineHeight (or the largest lineHeight value in styled
TextEdit).
Back to top
References
Inside Macintosh, Volumes I-371 & V-259, TextEdit
M.OV.ManagerAbuse
Back to top
Downloadables
|
Acrobat version of this Note (68K).
|
Download
|
|