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

When font-size declared in rem, text is missing in the exported file. #232

Closed
karolkolodziej opened this issue Oct 12, 2022 · 4 comments
Closed

Comments

@karolkolodziej
Copy link

Describe the bug
When adding the font-size expressed in rem to a text, it is not visible in the exported file.

To Reproduce
See this playground.

Expected behavior
The font-size in rem should be applied similarly to the on in px- which works well.

Desktop (please complete the following information):

  • OS: macOS Monterey 12.4
  • Browser: Chrome
  • Version: 106.0.5249.91 (Official Build) (arm64)
@yGuy
Copy link
Member

yGuy commented Oct 12, 2022

Not sure whether "rem" is officially supported in SVGs, not even SVG2 seems to be clear on this: https://svgwg.org/svg2-draft/types.html#InterfaceSVGLength

And I don't think browsers, agree with the implementation, either: https://bugzilla.mozilla.org/show_bug.cgi?id=1231147

How should the size be determined for an SVG embedded into a PDF? Font sizes relative to what?

@yGuy yGuy added the needs-info This issue is on hold, until more information becomes available. label Oct 12, 2022
@karolkolodziej
Copy link
Author

How should the size be determined for an SVG embedded into a PDF? Font sizes relative to what?

I guess it should work similarly to the em only being relative to the top element - demo.

Indeed the SVG2 documention doesn't mention the rem.
However percentages are there and they also don't work correctly- demo.

@yGuy
Copy link
Member

yGuy commented Oct 12, 2022

OK - the latter should have been fixed in #100 but might not work for the CSS attributes, but only for the "real" SVG attributes.
I don't think that "rem" is something we should support until it's clear how it should behave, i.e. until there is actually a spec other than prior art in existing implementations that use the HTML document root, which really doesn't make sense in the context of svg2pdf, IMHO.

@yGuy yGuy removed the needs-info This issue is on hold, until more information becomes available. label Oct 12, 2022
@yGuy
Copy link
Member

yGuy commented Oct 12, 2022

Let's create another issue for the em case.
I am closing this for the "rem" case until there is a spec for this available. I don't see that this can be an important use-case as long as it only works inside the HTML DOM in a browser.

@yGuy yGuy closed this as not planned Won't fix, can't repro, duplicate, stale Oct 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants