How to get the width and height from a string

I am creating a genealogy app.
With each person’s record I have their svg string.
The border of the enclosing element is dependent upon the content and so Fred Nerks would be narrower than Wizard Stupid Johnson.
To combine the husband and wife’s svg into a family svg string I need to get the width and height of the husband and wife. It will then be stored in the family records.
Here is a sample person’s string

<svg id = "indi23" class = "indi_node" x = "0", y = "0" width="194" height="60">
<rect class="male" x="0" y="0" rx="5" ry="5" width="100%" height="100%"></rect><text id = "name" x="10" y="20">Dennis James Nolan</text><text id = "info" x="20" y="50">Male [1941]</text></svg>

I just noticed a line break in the string. That will be removed.
Of course all their children will need to have a containing svg element too.

1 Like

getBBox() is going to be your friend.