TEGetStyle
TEGetStyle
Obtain style and line height info about a character void TEGetStyle(theOffset, theStyle, lineHeight, ascent, hTE ); short theOffset ; offset in edit text of character of interest
TextStyle *theStyle ; address of a 12-byte record; receives style info short *lineHeight ; receives line height of character
short *ascent ; receives ascent of character
TEGetStyle obtains all existing the style and formatting information for a particular character in the text of an edit record. Use before calling
theOffset is an offset within the data led to by the hText field of hTE. This
identifies a particular character (or start of a sequence of
characters) in the edit record.
theStyle is the address of a 12-byte TextStyle structure. Upon return, it is filled with information (font, face, point size, and color) about the
character associated with theOffset.
lineHeight is the address of a 16-bit short. Upon return, it contains the height
of the line containing the character associated with theOffset.
ascent is the address of a 16-bit short. Upon return, it contains the ascent
(height above the baseline) of the character associated with theOffset.
hTE is a handle obtained via TENew (old style TextEdit record) or TEStylNew (new style TextEdit record). It leads to a variable-length TERec structure and identifies the edit record to be affected by this change.
obtains the global size, font, and style information for the edit record. On
new-format edit records, it obtains information about a particular
character.
Given a mouse point, you may use TEGetOffset to figure out a value to use for theOffset.
A typical operation is to use TEGetStyle to obtain information about a selection range, then change one or more fields of theStyle before calling
TESetStyle to make the changes. With System version 6.0 and later, you may use SetStylScrap to perform "smart" setting and toggling of styles.