b26: RTF text styles --- underline/underscores

Need help with a script? This is the place to discuss how to get your code running!

b26: RTF text styles --- underline/underscores

Postby komouton » Wed Apr 19, 2017 6:13 am

In RTF editors (e.g. TextEdit.app), the underline style may be single, double, dotted, dashed, wave or other lines.

When RTF text is copied/pasted from a RTF editor into a SC field, single solid underline in RTF is converted to simple underline style in SC. Other styled underlines, however, are converted an certain underscore *and* underline style.

For example, single dotted underline in RTF (/uld) is converted to dot underscore *and* underline in SC, in the other words, two kinds of style being overlapped.

It is reducdant, isn't it?
komouton
 
Posts: 90
Joined: Wed Oct 21, 2009 1:30 pm

Re: b26: RTF text styles --- underline/underscores

Postby codegreen » Wed Apr 19, 2017 9:02 am

What you're seeing is a result of limitations of the underlying mechanisms being used to store text styles.

Underline is one of eight styles (plain, bold, italic, underline, outline, shadow, condense, and extend) recognized by QuickDraw, so in WASTE all underlined text has this attribute.

To represent various underline types (which QD itself doesn't understand) an extended (i.e., text engine-specific) attribute is applied. If present this tells WASTE which underline style to draw.

In RTF however (because its text-based attribute encoding scheme is more flexible/extensible) each underline type is represented as a separate style variant, so there's no need to 'stack' attributes.

HTH,
-Mark
codegreen
 
Posts: 1469
Joined: Mon Jul 14, 2008 11:03 pm

Re: b26: RTF text styles --- underline/underscores

Postby komouton » Thu Apr 20, 2017 11:49 am

To represent various underline types (which QD itself doesn't understand) an extended (i.e., text engine-specific) attribute is applied. If present this tells WASTE which underline style to draw.


So, when underlined text in RTF is transferred into SC field, a QD's flag of "underline" style inevitably puts up.

If I want to transfer dotted underline in RTF into SC field as dotted underscore without QD's underline, I must cancel the QD's underline using "post-editing." I understand.

§ Post-editing: one of my own nomenclatures. Editing contents of a field using SuperTalk after RTF data is transferred into the field. antonym: pre-editing.

§ Pre-editing: one of my own nomenclatures. Editing rtf data using SuperTalk immediately before the data is transferred into a SC field.
komouton
 
Posts: 90
Joined: Wed Oct 21, 2009 1:30 pm


Return to Scripting in SuperTalk

Who is online

Users browsing this forum: No registered users and 2 guests

cron