Page 1 of 1

Increase font mixed sizes

Posted: Tue Jun 23, 2015 12:49 pm
by paulclaude
Someone knows a quicker way to increase or decrease (+1, -1) the font size of the whole text of a field that contains many different font sizes, rather than increasing textSize char by char?

Code: Select all

set the textsize of char a to (the textsize of char a) + 1
Thanks...

Re: Increase font mixed sizes

Posted: Tue Jun 23, 2015 2:19 pm
by dunbarx
Hi.

I could be wrong, but if a field contains mixed textSizes, or mixed anyTextProperties, I think there is no way to set a single property to change the whole in a "piecemeal" way. If the mixed styles drill down to the char level, then the changes will have to be at that level as well, in a loop. Make sure you do all this in a variable, and not in the field itself, for speed. Use the htmlText to retain style properties.

Craig Newman

Re: Increase font mixed sizes

Posted: Tue Jun 23, 2015 2:33 pm
by paulclaude
Yes, Craig, this is my problem. I would only know if there is a quicker solution.

Re: Increase font mixed sizes

Posted: Tue Jun 23, 2015 2:35 pm
by FourthWorld

Re: Increase font mixed sizes

Posted: Tue Jun 23, 2015 3:16 pm
by paulclaude
Thanks, Richard, I have a range of sizes from 10 to 25, so I've made this simple example script:

Code: Select all

   
put the htmlText of fld "Song" of cd (output&&"Song") of stack "Print" into sg
put "size="&quote&"x"&quote into toSearch
    repeat with w=25 down to 10
               put toSearch into actSearch
               put toSearch into incrSearch
               replace "x" with w in actSearch
               replace "x" with w+1 in incrSearch
               replace actSearch with incrSearch in sg
    end repeat
set the htmlText of fld "Song" of cd (output&&"Song") of stack "Print" to sg