How to calculate actual Label text bounding box

When I create new Label programatically then it’s contentSize doesn’t reflect the actual text bounding box.
It there a way to update the contentSize to reflect it?

var child_n = new Node()
var child_lbl = child_n.addComponent(Label)
child_lbl.string = 'TestLabel'
child_lbl.fontSize = 25
child_lbl.lineHeight = 30

Then child_n.contentSize is (100,100) instead of actual ‘TestLabel’ bounding box.

You can refer to this post for options.