How about using StringUtils.MeasureTextHeight? In reverse? The following works after a fashion, but needs some polishing.
B4X:
Sub label1_Click
label1.Height = Round(factor * label1.Height)
label1.Width = Round(factor * label1.Width)
Dim h As Int = label1.Height
Do While (su.MeasureMultilineTextHeight(label1, label1.Text) < h)
label1.TextSize = label1.TextSize + 1
Loop
End Sub
Here is a link to a code snippet that auto sizes the text based on the view. It can be applied to your situation and may be what you want. I tested it. I can post my code.
This is based on a nice new feature in Android Support library. It automatically adjusts the view's text size to make it fit. You can call it with any of the following views: Label, Button, CheckBox, RadioButton, ToggleButton Note that the size will change whenever you set the text...