Text height
-
Hi!
The following should work:Rectangle { width: 300 height: 100 Text { text: "Hallo!" font.pixelSize: parent.height anchors.centerIn: parent } }
-
obtained the margin on the top and bottom of the text
That is, the height of the text < the height of the rectangleThis is a bit better as it seems to use
contentHeight
internally:Rectangle { width: 300 height: 100 anchors.centerIn: parent Text { text: "Äp!" anchors.fill: parent fontSizeMode: Text.VerticalFit font.pixelSize: 1000 } }
But still "Hallo!" is not fully scaled up. I think the problem stems from the fact that
contentHeight
doesn't return the actual bounding box of the rendered text but the sum of the cap height and descender height.