Details
-
Suggestion
-
Resolution: Done
-
Not Evaluated
-
None
-
None
Description
It would be useful to enable setting the height of the font in the text element, in cases where locale would dictate a different font
The idea is that you want to specify the height of the Text element and you want the font to be (automatically) selected so that it fits the height.
Here's one example (qml) implementation of such feature:
Text { property int desiredHeight property real downSizingFactor: 0.8 // Initial guess onDesiredHeightChanged: calculateFontSize() Component.onCompleted: calculateFontSize() function calculateFontSize() { font.pixelSize = downSizingFactor * desiredHeight if (height && desiredHeight > 3) { while (height < desiredHeight) { font.pixelSize++ } while (height > desiredHeight) { font.pixelSize-- } } downSizingFactor = font.pixelSize / height } }