Inkscape.org
Using Inkscape with Other Programs Text is offset to the right compared to HTML
  1. #1
    grahamegrieve grahamegrieve @grahamegrieve

    Here's an SVG that I generated myself, rendered in a browser (browser.png). Here's the same SVG open in Inkscape (inkscape_TRGjuMi.png). I've attached the SVG as well ( example_XiP4pMZ.svg)

    Inkscape can't read the foreignObject, that's fine, and it's not a party to the staying information found in the html that applies to the SVG, which is also fine. But if you look at the two images, you can see the Inkscape shows the left of the text to be significantly further right than how it shows in the browser. Is there a reason for that? Should I generate the HTML file differently?

     

    Example
    Inkscape
    Browser
  2. #2
    Tyler Durden Tyler Durden @TylerDurden

    Could be that the font is undeclared, so both Inkscape and browsers are substituting their default font which are different..

    Also, the SVG validator shows errors in the file. https://validator.w3.org/check

     

  3. #3
    grahamegrieve grahamegrieve @grahamegrieve

    The browser does have the file from the stylesheet, where Inkscape doesn't - but I expected (hoped?) that the actual offset wouldn't be affected (where as width obviously will be). I will investigate the validation errors

  4. #4
    grahamegrieve grahamegrieve @grahamegrieve

    ok, so I fixed up all the errors in the generated SVG, and I figured out how to install the font for Inkscape, but the metrics error still remains:

    Browser: 

    Inkscape:

     

    Fixed source attached.

    Example Source
  5. #5
    Tyler Durden Tyler Durden @TylerDurden

    Sorry for the delay reply. I gotta pretend to work now.

    I'll punt you over to the devs on the chat: https://chat.inkscape.org/channel/inkscape_user

  6. #6
    grahamegrieve grahamegrieve @grahamegrieve

    well, I discovered the problem: text-anchor. The browsers are defaulting to text-anchor = middle (and as far as I can see, ignoring anything else if I try to set anything else). but Inkscape defaults to text-anchor=start, and does read and pay attention to the setting. 

Inkscape Inkscape.org Inkscape Forum Using Inkscape with Other Programs Text is offset to the right compared to HTML