And finally, the RTF version, which is maybe a few milliseconds faster,
and has the possible advantage that the lower limit could be < 8 if
necessary.
Worth noting that RTF font size tags are in half-points, hence the
division by 2 in the getRSizes function, and corresponding
multiplication afterwards.
I think I should do something else, now. Obsessive, me?
:)
Mark
on changeTextSizeRTF inc
put the effective textSize of fld 1 into fSize
put the rtftext of fld 1 into ttext
put getRSizes(ttext) into sizeList
if inc > 0 AND MAX(sizeList & comma & fSize)+inc > 48 then exit to top
if inc < 0 AND MIN(sizeList & comma & fSize)+inc < 8 then exit to top
if inc > 0 then
sort items of sizeList numeric descending
else if inc < 0 then
sort items of sizeList numeric ascending
end if
repeat for each item i in sizeList
replace "\fs" & (i*2) with "\fs" & ((i+inc)*2) in ttext
end repeat
set the textSize of fld 1 to fSize+inc
set the rtftext of fld 1 to ttext
end changeTextSizeRTF
function getRSizes tt
put empty into sizeList
replace cr with empty in tt
replace "\fs" with cr & "\fs" in tt
filter tt with "\fs*"
repeat for each line L in tt
get offset(space,L)
put trunc((char 4 to it-1 of L)/2) into sizeVal
if sizeVal is not among the items of sizeList then put sizeVal &
comma after sizeList
end repeat
return char 1 to -2 of sizeList
end getRSizes
_______________________________________________
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