So this is the best I've come up with, on a 1.5Ghz mac powerbook.
on increaseTextSize inc
lock screen
put the rtfText of fld 1 into ttext
replace "{\fs" with " {\fs " in ttext
--add spaces to make sure tags and their values are separate words
set the textSize of fld 1 to the effective textSize of fld 1 + inc
put 0 into c
repeat
get wordOffset("{\fs",ttext,c)
if it > 0 then
add inc to word it+1+c of ttext
put it+1+c into c
else
exit repeat
end if
end repeat
replace " {\fs " with "{\fs" in ttext
-- remove previously added spaces
set the rtfText of fld 1 to ttext
end increaseTextSize
In a field with 20000 words, 2000 of which were of a different size
than the field as a whole, this took just under 6 seconds to increase
the size of all the words. Not too impressive compared to AppleWorks 6
which did it effectively instantaneously.
In a field with only enough text to more or less fill the screen, it
took a more usable 21 milliseconds.
Cheers,
Mark
On 2 Jul 2005, at 12:49, Mark Smith wrote:
But as I just found, on a field with a real lot of text (a field with
437477 chars), this will be impractically slow....
On 2 Jul 2005, at 12:41, Mark Smith wrote:
I think you should get the 'effective' textSize of char x in the
handler, since if the textSize is inherited from it's owner, which
maybe the field, the card, stack or whatever, it's own textSize will
be zero....
Cheers,
Mark
On 2 Jul 2005, at 11:09, MisterX wrote:
Richard,
Have tried the html way with <font size=+2> by anychance?
set the htmltext of fld "text" to "<font size+2>"&the htmltext of fld
"text"&"</font>"
Nope... that didn't work but it was worth trying ;)
and so here's the taoo's script in draft form ;)
(sorry, html is just so messy and there's no guarantee of there
being a font
size tag anyway... while the field's text does...
This function is now added to the editNO2 palette - thanks for the
ideas
and a few more variants to come.
-- inc is the increment in size (can be negative)
on increasetextsize thisfield, inc
put the length of fld thisfield into lengthtext
repeat with x = 1 to lengthText
get the textsize of char x of fld thisfield
set the textsize of char x of fld thisfield to it + inc
end repeat
-- voila
end increasetextsize
the simpler the script, the easier it is to adapt for other
functions... to
other uses like changing colors, lineheight, grids, etc...
cheers
Xavier
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
Richard Gaskin
Sent: Saturday, July 02, 2005 09:17
To: How to use Revolution
Subject: scripting challenge: Large/Smaller text size
Mr. Canyon and anyone else who enjoys an iterative
optimization exercise:
A common feature in apps that display text are
"Larger"/"Smaller" text size options. It seems simple at
first glance, but in practice it's hard to come up with an
especially fast version, given the need to take into account
any variety of varying sizes in the source text.
If any of you have a script for such a thing, I wonder if the
sort of group review process that was done with the clock
interface would lend itself to optimizing this?
--
Richard Gaskin
Fourth World Media Corporation
___________________________________________________________
[EMAIL PROTECTED] http://www.FourthWorld.com
_______________________________________________
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage
your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
_______________________________________________
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your
subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
_______________________________________________
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your
subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
_______________________________________________
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your
subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
_______________________________________________
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution