TEReplaceStyle
TEReplaceStyle Replace style characteristics in currently selected text
#include <TextEdit.h> TextEdit
void TEReplaceStyle(mode, oldStyle, newStyle, redraw, hTE );
short mode ; a bit-coded style-operation mode; a Style Mode
TextStyle *oldStyle ; address of structure with style attributes to change
TextStyle *newStyle ; address of structure with desired attributes
Boolean redraw ; TRUE=redraw selection
TEHandle hTE ; handle of an edit record
TEReplaceStyle modifies specific style characteristics of the
currently-selected text. It may be preferable to TESetStyle, since you can
pick exactly which characteristic-combinations to replace.
mode specifies a style operation mode (see Style Mode). Bits of this
value specify which characteristics of the selected text you wish to
modify. The bits are defined as Text Styles, with the following
changes:
addSize 0x10 (no meaning with this function)
doToggle 0x20 (no meaning with this function)
oldStyle and ...
newStyle are addresses of 12-byte TextStyle structures. Fields in oldStyle
indicate which attribute-combinations to replace; fields of newStyle
specify what to replace them with. Depending upon the value of mode,
some fields of these structures may be ignored.
redraw specifies whether or not to redraw the text (update the screen to
reflect the changes). It is one of:
FALSE (0) don't redraw now; wait for an update event and TEUpdate
TRUE (1) redraw immediately
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.
Returns: none

Notes: TEReplaceStyle has no effect on old-format edit records.
All styles in the current selection range with the exact attribute
combination identified in oldStyle (and specified in mode ) are replaced by
the values in newStyle.
For example, if the selected text is:
some Bold and some ÏUnderlined Bold
then:
TextStyle oldStyle, newStyle;
oldStyle.tsFace = bold;
newStyle.tsFace = outline;
TEReplaceStyle( doFace, &oldStyle, &newStyle, TRUE, hTE );
the text will be redrawn as:
some ÈBold and some ÏUnderlined Bold
Note that this example affected the bold-only text exclusively; it did not
affect the bold-and- underlined text
Use TESetStyle to add or toggle attributes. Use TEGetStyle to get a
TextStyle record describing a specified character. The System 6.0
function, TEContinuousStyle can be used to learn about the variety and
complexity of the style runs in a selection range.
See TextStyle and Style Mode for related information.