How to increase the textsize of HTMLtext proportional?

Michael Doub mikedoub at gmail.com
Tue Jul 9 13:31:27 EDT 2013


I think this solves the problem.   You want to make sure that there is a ">" but not if it is found after a "<".

on mouseUp
   put the htmlText of fld 1 into theHtml
   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 itemCount
      repeat for each item theItem in theHTML
         add 1 to itemCount
         if itemCount=1 then
            put theItem into newHTML
            next repeat
         end if
         put 1 into counter
         put offset (">", theItem) into tLeft
         put offset ("<" , theItem) into tRight
         if tLeft <> 0 then -- found it
            if tRight <> 0 and tRight > tLeft then-- found "<" and after ">" which is ok
               repeat forever
                  add 1 to counter
                  if char counter of theItem=quote then exit repeat
               end repeat
               put char 1 to counter-1 of theItem into theSize
               put theSize + 1 into theSize
               put theSize into char 1 to counter-1 of theItem
            end if
         end if
         put quote&theItem after newHTML
      end repeat
      set the htmlText of fld "test" to newHTML
   end if
   set the textSize of fld "test" to \
         the effective textSize of fld "test"+1
end mouseUp


On Jul 9, 2013, at 10:20 AM, Mike Bonner <bonnmike at gmail.com> wrote:

> You might look at "styledtext" which returns an array describing all the
> text variations in the field. Very handy.
> 
> 
> On Tue, Jul 9, 2013 at 7:47 AM, Richard Gaskin
> <ambassador at fourthworld.com>wrote:
> 
>> Tiemo Hollmann wrote:
>> 
>>> How would you change the textsize of such a text by keeping the size
>>> relation of the different chunks of text? Should I look up the
>>> HTMLtext and manipulate every "font size attribute" - or is there
>>> a more straight forward approach, I don't see?
>> 
>> I asked this question here a few years back, and there were many good
>> solutions presented, with Malte's being the fastest IIRC:
>> 
>> http://lists.runrev.com/**pipermail/use-livecode/2005-**July/061750.html<http://lists.runrev.com/pipermail/use-livecode/2005-July/061750.html>
>> 
>> 
>> --
>> Richard Gaskin
>> Fourth World
>> LiveCode training and consulting: http://www.fourthworld.com
>> Webzine for LiveCode developers: http://www.LiveCodeJournal.com
>> Follow me on Twitter:  http://twitter.com/**FourthWorldSys<http://twitter.com/FourthWorldSys>
>> 
>> 
>> 
>> ______________________________**_________________
>> use-livecode mailing list
>> use-livecode at lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>> http://lists.runrev.com/**mailman/listinfo/use-livecode<http://lists.runrev.com/mailman/listinfo/use-livecode>
>> 
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode





More information about the use-livecode mailing list