Editing the style(s) of text in a field.
Alex Tweedly
alex at tweedly.net
Sun Mar 2 18:44:37 EST 2014
Thanks Peter, I hadn't remember seeing that one.
While it is a useful handler, it's hard to see how to extend it to
operate on chunks, because ...
1. it depends on setting the textsize of the field (to handle any
characters not already within a <size> tag). You can't do that if you're
operating just on a chunk, so you need to go through adding <size> tags
to all such character runs within the chunk - not easy.
2. there isn't any easy way to correlate char position in the field
with a position in the htmlText of the field, so you finish up having to
count your way through the chars of the htmlText, converting and
allowing for the special cases in html
3. You need to do non-trivial changes if the chunk begins or ends
part-way through an existing run of text of the same size).
So while it may be possible to extend this method to operate on chunks,
I think its beyond me. I would find it easier to start with either
textStyle of the chunk, or the styledtext array.
(update - using the textstyle of each sub-chunk is too slow for the
"worst case" - i.e. if each character is a different size from the
previous character, then even medium-sized field (some thousand of
chars) takes multiple seconds. I'm going to try the other way, and let
you know how it goes).
-- Alex.
On 28/02/2014 17:51, Peter M. Brigham wrote:
> There was a handler posted here not too long ago to increase or decrease the textsize of a field. It could be adapted to operate on chunks of a field.
>
> -- Peter
>
More information about the use-livecode
mailing list