Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Text vertically misaligned due to dominant-baseline="hanging" attribute #1000

Open
optimax opened this issue Oct 22, 2024 · 0 comments
Open

Comments

@optimax
Copy link

optimax commented Oct 22, 2024

Description:
A text block appears at the wrong vertical position when there is a dominant-baseline="hanging" attribute on the text element.

To Reproduce
Load the following SVG image into the editor:

<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xml="http://www.w3.org/XML/1998/namespace" viewBox="0 0 1400 1000">
    <rect width="1399" height="998" rx="0" ry="0" id="background" stroke-width="0.5" style="fill:#FFFFFF;stroke:#000000;"/>  
    <g transform="scale(39.63119) translate(17.66286, 1.892448)" id="content">
      <text text-anchor="middle" dominant-baseline="hanging" font-family="Helvetica" font-size="12.5px" font-style="normal" font-weight="normal" style="fill:#231F20;"><tspan x="0px" y="0px">TEXT</tspan><tspan x="0px" y="12.5px">TEXT</tspan></text>
    </g>  
</svg>

The image appears as follows in the editor:

in-svgedit

Expected behavior
The image should appear as follows, where the text block is centered both horizontally and vertically within the bounding rectangle:

Screenshot 2024-10-22 112523

Both Chrome and Edge display it correctly.

SVG-Edit environment:

  • Version: latest from the master branch
  • The file is loaded either via the Open menu item, or via svgEditor.loadFromURL("/url-of-svg-image");, it does not matter as th result is the same.

Environment:

  • OS: Windows 11 64 bit Desktop
  • Browser: Edge 130.0.2849.46, Chrome 130.0.6723.59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant