Nested partitions/Tokens in TextEdit [message #526391] |
Sat, 10 April 2010 08:00 |
Mauro Condarelli Messages: 428 Registered: September 2009 |
Senior Member |
|
|
Hi,
I suspect I'm using the wrong approach, so I would like some general advice.
I am building an editor for generic text and I need to highlight (color
and font, possibly) several constructs, including:
- quoted text (direct speech end similar constructs).
- emphasized text (italics, bold, ...)
- keywords (a list of few tens of single words to recognize anywhere).
The first two kind of items are delimited by tags (think <b>..</b>; it
is not that, but equivalent), while the third is just a list of string
to be found.
I tried using partitions, but partitions cannot overlap, while I can
have direct speech in a section which is italicized and keywords in
direct speech, or the other way around. I can even have direct speech
inside direct speech!.
What is the "Right Way" to do this?
Another (related) issue: I can set a certain attribute (font size, for
example) on a certain section of text, but how can I set that
incrementally? I mean: the TextAttribute uses the Font class which holds
all the font characteristics; once set they are carved on stone (or so
it seems to me). If I change the some attribute of the font *before* the
section nothing will change *in* the section.
An example:
<TimesRoman,10>Some text with <quote>quoted section containing
<italics>italicized</italics> words</quote> and other stuff, possibly
<Arial>with other font</Arial> founderies.</TimesRoman,10>
If I change the starting tag to <TimesRoman,12> I would like to have
*all* text to be 12 points. Can I do that easily (i.e.: without scanning
all tags and changing the font size accordingly)?
Thanks in Advance.
Mauro
|
|
|
Powered by
FUDForum. Page generated in 0.03011 seconds