Dynamic Text Size

Is there a way to increase/decrease the font size based on the available space? Like display a text in a certain size unless it would get clipped. Then reduce the size until a set minimum size.

@p0fi I think what you’re looking for is minimumScaleFactor?
API: https://docs.scriptable.app/widgettext/#minimumscalefactor

Usage example:

let w = new ListWidget()

let text = w.addText("Hey, this is a paragraph of text.")
text.font = Font.boldSystemFont(20)
text.minimumScaleFactor = 0.5

The text font-size will be 20pts if there’s enough space available but will eventually shrink to 10pts (0.5) to fit all the text in the UI/Widget.

1 Like

This is absolutely what I was looking for! Thanks a lot!

2 Likes