Changing Text Font Size Dynamically

mobile-prototyping

#1

I am working on a prototype for a number pad. I want to change the font size of the text (so as it fits the screen properly) entered when more than say…6 digits are entered. For example:

1st State (4 digits entered) - “7788”

2nd State (a decimal is added) - “7788.00”

So in the 2nd state, Can I dynamically also change the font size of the whole text element? Is there anything under Interactions that can help with this?

Thanks a lot :slight_smile:


#2

You could do that using conditional cases (to check text length) and Set Text actions with Rich Text option selected. Then you can change the text style when you set the text.

At a high level:

If text.length <= 4
Set rich text: [[text]] (large font size)
Else if true
Set rich text: [[text]] (smaller font size)


#3

Damn! I had forgotten about the Rich Text thing! Thanks a lot @nkrisc . It worked :slight_smile:


#5

Hi rishbhar, how did you get this working? Are you using Axure RP8 and did you do this to a text field? I can only see the “rich text” on widgets (eg the text on boxes etc) but it is not available for text fields.


#6

Yes I am using RP8. I did the functionality for a text label widget, not a text field widget. May be that is where it is different. I am not sure.


unlisted #7

closed #8