How to reduce the font size of a text according to its length?

Hi all !

My question of the day, how to adapt the size of a text according to the screen?

Let me explain: I don’t want a scrolling screen, and I have random sentences that are generated with a button.

Some sentences are short, so they fit on the screen easily with a defined font size, but when the sentence is longer, it will not fit on the screen. And I would like a solution that allows the font size to be reduced if the sentence is too long.

I don’t know if I am explicit, because I use Google Translate …

If you have ideas for me, I’m interested.

(I tried the Responsive Text Component extension from Srrazmi, but it doesn’t do what I want).

Thanks everyone!

You could allow the user to do it manually.

Create 2 buttons, 1 to increase size of font, and the other to decrease. When one of these buttons is pressed the font size can be increased or decreased correspondingly.

I’m not sure how to do it automatically. You would need to resize the font based on the length of the text but as different phones have different densities and numbers of pixels I don’t know how you would do this.

1 Like

You can create a procedure to check the lenght of the sentence and if it’s longer than a fixed number than it will change font size to a new number. You can set also more than 1 number control, 2 or 3 step

Thanks for your answers, I’ll try all of that!

Use responsive screen extension by @AppHelper_Studio and set lable text font according to screen weight .