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

Internal stylesheet support? #6

Closed
samizdatco opened this issue Jul 24, 2022 · 4 comments
Closed

Internal stylesheet support? #6

samizdatco opened this issue Jul 24, 2022 · 4 comments

Comments

@samizdatco
Copy link

At the moment SwiftDraw only seems to support style attributes that are set directly on SVG elements. Many tools create SVG files with an embedded stylesheet and rely on the style cascade to apply them to the elements. I can imagine this would be a significant undertaking, but it would be a great compatibility improvement if both types of files could be rendered.

For instance, here are two 'identical' SVGs that differ only in terms of where their styles live:

inline styles

inline

internal stylesheet

internal

SwiftDraw produces very different output when rendering them though:
image

@swhitty
Copy link
Owner

swhitty commented Aug 3, 2022

While SwiftDraw probably can't full support all selectors (e.g. descendents) within stylesheets, would it be useful if a small subset were supported? Simple class and element matching (stylesheet.svg) is probably simple enough to implement.

@samizdatco
Copy link
Author

The use case I have in mind is being able to work with SVG produced by Illustrator, Figma, and the like. As far as I can tell, the embedded stylesheets they produce don't get any fancier than using class- and id-based selectors. So the subset you're considering seems like it would be a huge compatibility boost.

@swhitty
Copy link
Owner

swhitty commented Aug 18, 2022

Great, I will look to implement this in the next version.

@swhitty
Copy link
Owner

swhitty commented Aug 21, 2022

Release 0.12.0 adds basic support for stylesheets.

@swhitty swhitty closed this as completed Aug 25, 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