TextEdit With Style
TextEdit With Style
Starting with System Version 4.1, and now implemented in the 256K and
512K ROMs, TextEdit supports the use of character-formatting on a
piece-by-piece basis (in older systems, all settings are global to the
edit record). In the new version, you may:
Set or query the font, size, and face (style) of "runs" of text.
Set or query the RGB color for any piece of the text.
Cut-and-Paste style information along with text.
Replace styles and toggle them in a natural, word processor-like, way.
Use automatic line-height calculation or set some lines to a fixed
height.
Note that the word "styles" is now used to refer to a clump of text
attributes, including font, size, face, and color. The word "face" is the
specific characteristic which describes stylistic variations such as bold,
italic, and so forth. The Style data type has not changed names and still
refers to font "face" characteristics.
The low-level implementation of these style features is complicated, but
using them is easy. Everything is backward compatible, so you may use an
"obsolete" version of a function and at worst, lose access to the new features.
Simply use TEStylNew to create the new-format edit record. Use TECut,
TECopy, TEStylPaste, and TEStylInsert for cut-and-paste operations.
Use TEGetStyle to query the attributes ( including font, face, size, color, and
height) of any place in the edit text and use TESetStyle to apply a style to the
current selection range. See Saving Styled Text to see how you can read and
write styled TextEdit records. Other functions are basically window dressing,
since if you need that much complexity, you will probably not be satisfied with
Note that TextEdit still does not support the use of TABs. And the previous
32K maximum data limits apply (along with new maximums on lines and style
runs), described in TextEdit Limits. We are advised not to try to write the
next great word processor using TextEdit as the starting point.