0

I'd like text content from a HTML page (actually, a sentence) and text content within a SVG file and make them visually identical and assemble them perfectly: same font, size, alignment and so on.

Like:

<p>
    This HTML content. <svg><text>And this is SVG text</text></svg>. Both look identical!
</p>

The thing is that I'll never know in advance what will be the size of the SVG text.

I work with Python (I saw here you could tackle the viewbox issue thanks to Pillow) but some JS trick should be more adapted I think.

Is there a way to play with the SVG file parameters or CSS to achieve a near perfect visual match between the vector and html texts?

Thank you.

1 Answers1

0

No. You will need to know the length of text in advance. Or calculate it with Javascript (assuming you are running in a browser).

Paul LeBeau
  • 97,474
  • 9
  • 154
  • 181