/* NSTextChunks implement variable sized arrays of records. Allocation is by the given size (in bytes) -- typically a multiple number of records, say 10. The block of memory never shrinks, and the chunk records the current number of elements. To use the NSTextChunks, you declare a struct w/ NSTextChunks as its first field.
*/
typedef struct _NSTextChunk {
short growby; /* increment to grow by */
int allocated; /* how much is allocated */
int used; /* how much is used */
} NSTextChunk;
typedef struct _NSTextBlock {
struct _NSTextBlock *next; /* next text block in link list */
struct _NSTextBlock *prior; /* previous text block in link list */
struct _tbFlags {
unsigned int malloced:1; /* true if block was malloced */
unsigned int PAD:15;
} tbFlags;
short chars; /* number of chars in this block */
unsigned char *text; /* the text */
} NSTextBlock;
/* NSRun represents a single run of text w/ a given format
*/
typedef struct {
unsigned int underline:1;
unsigned int dummy:1; /* unused */
unsigned int subclassWantsRTF:1;
unsigned int graphic:1;
unsigned int forcedSymbol:1; /* did alt-char force use to use symbol */
unsigned char superscript;/* superscript in points */
unsigned char subscript; /* subscript in points */
id info; /* available for subclasses of Text */
NSRunFlags rFlags;
} NSRun;
/* NSRunArray is a NSTextChunk that holds the set of formats for a Text object
*/
typedef struct _NSRunArray {
NSTextChunk chunk;
NSRun runs[1];
} NSRunArray;
/* NSBreakArray is a NSTextChunk that holds line break information for a Text Object. it is mostly an array of line descriptors. each line descriptor contains 3 fields:
1) line change bit (sign bit), set if this line defines a new height
2) paragraph end bit (next to sign bit), set if the end of this line ends the paragraph
3) numbers of characters in the line (low order 14 bits)
if the line change bit is set, the descriptor is the first field of a NSHeightChange. since this record is bracketed by negative short values, the breaks array can be sequentially accessed backwards and forwards.
*/
#if m68k
typedef short NSLineDesc;
#else
typedef int NSLineDesc;
#endif
typedef struct _NSHeightInfo {
float newHeight; /* line height from here forward */
float oldHeight; /* height before change */
NSLineDesc lineDesc; /* line descriptor */
} NSHeightInfo;
typedef struct _NSHeightChange {
NSLineDesc lineDesc; /* line descriptor */
NSHeightInfo heightInfo;
} NSHeightChange;
typedef struct _NSBreakArray {
NSTextChunk chunk;
NSLineDesc breaks[1];
} NSBreakArray;
/* NSLay represents a single run of text in a line and records everything needed to select or draw that piece.
/* Word tables for various languages. The SmartLeft and SmartRight arrays are suitable as arguments for the messages setPreSelSmartTable: and setPostSelSmartTable. When doing a paste, if the character to the left (right) of the new word is not in the left (right) table, an extra space is added on that side. The CharCats tables define the character classes used in the word wrap or click tables. The BreakTables are finite state machines that determine word wrapping. The ClickTables are finite state machines that determine which characters are selected when the user double clicks.