Auto-sizing Text

mark mitchell cowhead at ztv.ne.jp
Sun Jan 20 10:30:01 EST 2002


I'm looking for essentially the opposite of "set the height of field XXX 
to the formattedHeight/width".  I want to keep the fields the same size, 
but resize the text so that it is the maximum size that still fits in a 
given field.  The following script does work (at least most of the time) 
but surely there is a better way?  Thanks in advance!

set the textSize of field wordShower to 200
   put the width of field wordShower into zaWide
   put the height of field wordShower into zaHigh
   put the textSize of field wordShower into mySize
   put the formattedWidth of field wordShower into thisSize

   if thisSize > zaWide then

   repeat until thisSize < zaWide
     subtract 10 from mySize
     set the textSize of field wordShower to mySize
     put the formattedWidth of field wordShower into thisSize
     end repeat
end if

put the formattedHeight of field wordShower into thisSize2
   if thisSize2 > zaHigh then

   repeat until thisSize2 < zaHigh
     subtract 10 from mySize
     set the textSize of field wordShower to mySize
     put the formattedHeight of field wordShower into thisSize2
     end repeat

     end if

    end repeat
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: text/enriched
Size: 1243 bytes
Desc: not available
URL: <http://lists.runrev.com/pipermail/use-livecode/attachments/20020120/e3b95280/attachment.bin>


More information about the use-livecode mailing list