Re: working with styled text records
Re: working with styled text records
- Subject: Re: working with styled text records
- From: Philip Aker <email@hidden>
- Date: Thu, 19 Sep 2002 04:25:14 -0700
On Wednesday, Sep 18, 2002, at 18:16 US/Pacific, Malcolm Fitzgerald
wrote:
Slightly off-topic because I want to dig a bit deeper than applescript
itself.
With Arthur's help I've been able to generate HTML code from styled
text. The styled text record contains two bits of info, the text class
and the style class. Arthur has used a bit of educated guess work to
analyse the style object and figured out bold/italics/etc. For those
who've never seen one it looks like this:
{+class ktxt;:"ho ho", +class ksty;:+data styl
0001
0000
0000
000F
000B
0003
0100
000B
0000
0000
0000;}
I want to be able to manipulate the style object. Does anyone know
where I can find out what the style data consists of and how I can use
it?
It's probably highly related to this:
struct STElement {
short stCount; /*number of runs in this style*/
short stHeight; /*line height*/
short stAscent; /*font ascent*/
short stFont; /*font (family) number*/
StyleField stFace; /*StyleField occupies 16-bits, but only first
8-bits are used */
short stSize; /*size in points*/
RGBColor stColor; /*absolute (RGB) color*/
};
For instance if the last four bytes are changed the clipboard contains
blue text.
set the clipboard to {<<class ktxt>>:"ho ho", <<class ksty>>:<<data
styl000100000000000F000B00030100000B00000000FFFF>>}
So that would leave two shorts in between 'stCount' and 'stHeight'
which one might be able to safely set to zero or ignore.
What's unreliable these days are the font IDs ('stFont').
You might want to check out Cal Simone's site. I seem to remember there
was an RTF to HTML converter available there.
Cheers,
Philip Aker
http://www.aker.ca
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.