[comp.sys.mac.programmer] Super/Subscript codes in MacWrite/Word

g556871349ea@deneb.ucdavis.edu (G556871349ea) (12/14/89)

Does anyone know how to format a TE selection so that super- and subscript
codes are within? I want to write a DA which automatically makes super- and
subscript of certain characters and then be able to paste the string into
Word and MacWrite. There's an article in MacTutor about it but I'm pretty sure
it won't work with Word or MacWrite from within a DA. Any tips or especially
code fragments is greatly appreciated.

Colin Ong
UC Davis
cgong@ucdavis.bitnet

campbell@brahms.berkeley.edu (Robert I. Campbell) (12/14/89)

In article <6264@ucdavis.ucdavis.edu> g556871349ea@deneb.ucdavis.edu (G556871349ea) writes:
>Does anyone know how to format a TE selection so that super- and subscript
>codes are within? I want to write a DA which automatically makes super- and
>subscript of certain characters and then be able to paste the string into
>Word and MacWrite. There's an article in MacTutor about it but I'm pretty sure
>it won't work with Word or MacWrite from within a DA. Any tips or especially
>code fragments is greatly appreciated.
>
>Colin Ong
>UC Davis
>cgong@ucdavis.bitnet

You have several problems. The first problem is that MSWord and MacWrite
use different clipboard formats for formatted text. MSWord4.0 uses the
RTF format (MSWord3.0 is incapable of reading formatted text from the
clipboard in any format). A description of the RTF format is available
from MS for the asking, and I posted a short description of it to the
BMUG BBS several months ago. Old (up to MW5.0) MacWrite uses the MWRT 
clipboard format to read and write formatted text from the clip. This 
format is documented in either TechNote 11 or 13 (I think).

Your second problem is that new MacWriteII cannot read sub or super
scripted text from the clipboard. MacWriteII uses the new brain-dead
(personal opinion, mind you) standard clipboard format for formatted
text - format strings. These are documented in the sections of Inside
Mac vol5 which deals with the Scrap Manager and Text Edit. While it is
nice to have a standard, this standard has no knowledge of sub or
superscripting.

There was an article in MacTutor about how to patch the TE ROM calls
to provide some sub and superscripting, but you would need to rewrite
MSWord and MacWrite to make use of it. While it looks interesting,
it looks like something that will break with the next system update.

					- Robert Campbell -
					campbell@math.berkeley.edu