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

Rendering SVG in Emacs is broken when only viewBox attribute is given #48308

Open
smartmic opened this issue Jan 20, 2024 · 0 comments
Open

Rendering SVG in Emacs is broken when only viewBox attribute is given #48308

smartmic opened this issue Jan 20, 2024 · 0 comments
Labels
bug Something isn't working needs-testing Testing a PR or reproducing an issue needed

Comments

@smartmic
Copy link

Is this a new report?

Yes

System Info

Void 6.6.11_1 x86_64 AuthenticAMD notuptodate rFF

Package(s) Affected

emacs-gtk3-29.2_1

Does a report exist for this bug with the project's home (upstream) and/or another distro?

No response

Expected behaviour

Rendering SVG images which only have a viewBox specification should work.

Actual behaviour

When I open an SVG file which has only a viewBox attribute and no height or width (perfectly valid SVG, renders fine on any SVG viewer and also with Emacs on other distros/platforms), only a small frame appears and no image is rendered. In buffer *Messages*, this (repeating) message appears:

Invalid image size (see ‘max-image-size’)

I shared more details on Reddit

Steps to reproduce

  1. Try to display this SVG as image:
<svg style="font-family: Sans Serif;" xmlns='http://www.w3.org/2000/svg' viewBox="0 0 112.32 76.32">
<path d="M2.16,74.16L110.16,74.16L110.16,2.16L2.16,2.16Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="56.16" y="38.16" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">Hello</text>
</svg>

It will show only a small empty frame.
2. Change to text mode and add a height attribute with a value to the SVG:

<svg style="font-family: Sans Serif;" xmlns='http://www.w3.org/2000/svg' height="200" viewBox="0 0 112.32 76.32">
<path d="M2.16,74.16L110.16,74.16L110.16,2.16L2.16,2.16Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="56.16" y="38.16" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">Hello</text>
</svg>
  1. Switch back to image mode, it will render fine
@smartmic smartmic added bug Something isn't working needs-testing Testing a PR or reproducing an issue needed labels Jan 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs-testing Testing a PR or reproducing an issue needed
Projects
None yet
Development

No branches or pull requests

1 participant