scripting challenge: Large/Smaller text size

Malte Brill revolution at derbrill.de
Sat Jul 2 17:29:01 EDT 2005


Hi,

Mark, could you please test this script against yours? My machine is 
too slow to get a representative result. Sometimes yours is faster, 
sometimes mine. :-)

on changeSize myChange
   put the htmlText of fld "test" into theHtml
   set the textSize of fld "test" to \
         the effective textSize of fld "test"+1
   replace "size="&quote with "size="&numToChar(1500) in theHTML
   set the itemdel to numToChar(1500)
   if the number of items of theHTML<>1 then
     put 0 into testItem
     repeat for each item theItem in theHTML
       add 1 to testItem
       if testItem<>1 then
       put offset(quote,theitem) into counter
       put char 1 to counter-1 of theItem into theSize
       put theSize+myChange into theSize
       put theSize into char 1 to counter-1 of theItem
       put quote&theItem after newHTML
     else
       put theItem into newHTML
         next repeat
       end if
     end repeat
     set the htmlText of fld "test" to newHTML
   end if
end ChangeSize

Both scripts round about 750 msec on my slobo G4-400 MHz for 10000 
chars with different styles, colors, sizes and fonts in about 600 chars.




More information about the use-livecode mailing list