Determine SVG Text Height in Python Flask

35 Views Asked by At

I want to determine the height of the svg generated text of my flask app

<svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%">
    <foreignObject class="node" x="0" y="0" width="100%" height="100%">
        <body xmlns="http://www.w3.org/1999/xhtml">
            <style>
              // some stylings like setting font size, font family etc.
            </style>
            <div class="text">{query.replace("&", "&amp;")}</div>
        </body>
    </foreignObject>
</svg>

I take some parameters in the url and style the text accordingly using them like setting font to custom google fonts etc. I want to get the accurate height of the text as it is being used somewhere where pixels height is needed.

0

There are 0 best solutions below