Comments (9)
from oksvg.
That is great to hear. Would you mind taking a look at my PR then?
I'm not sure how clean my implementation is, since I basically circumvent the inDefs
check by setting inDefsStyle
without it. But I added a test and top level styles work the way they are supposed to.
from oksvg.
Hi ,have you solved this problem? @giancarlobastos
from oksvg.
Some input on this: I believe this is due to oksvg not supporting style
tags in SVG. I can't say for sure, but I'm having the same problem and removing the style
block and putting the style attributes directly into the path
tags solved the rendering issue for me.
Edit: I've looked at @giancarlobastos SVG and it also uses a style
block to assign fill colors to the paths. I think we are experiencing the same issue.
from oksvg.
I've perused the code and I've found something that confuses me:
style
tags should be handled here
Line 61 in a61f04f
endElement
for the style
tag is found, its text content is parsed and added to the styles here Line 89 in a61f04f
But before the style
tag can be handled, the readStartElement
call here
Line 57 in a61f04f
style
tags are not handled there and not a valid draw function, so this line will fail Line 345 in a61f04f
I'm not that far into the code, so I'm not sure enough on how to fix this to provide a PR. However, my intuition is to handle style
tags before and without calling readStartElement
on them. @srwiley what do you think about this? Can you do anything with this research?
from oksvg.
One more update from me (sorry for the multipost):
After looking at the tests I realize that the style
tag is supported, but only within an enclosing defs
tag. That is understandable, but is probably not how most SVGs look and as far as I know there is nothing in the SVG spec that says that style
tags need to be enclosed in defs
tags. @srwiley would you be fine with changing this requirement?
from oksvg.
@srwiley To me the solution that @yeldiRium came up with looks pretty good. Is there a chance that the according PR gets merged soon?
from oksvg.
from oksvg.
Yes, there are tests to support the code (and given the discussion above it seems as if @yeldiRium did a pretty decent job
from oksvg.
Related Issues (17)
- Test failure? (TestShapes6.svg missing) HOT 2
- Support for clip paths
- Strange colors when trying to convert svg icons to png HOT 11
- Issue with relative path move-to HOT 2
- Rect with missing X or Y crashes HOT 4
- Support for percentage stroke-width
- Announce: SVG Editor HOT 2
- Add support for different renderers
- License disambiguation HOT 1
- Parse error when color is "currentColor" HOT 1
- Long dashed lines break
- support for text? HOT 2
- Request: surpport "class" element
- Dependency text 0.3.6 is vulnerable HOT 2
- Some path based icons do not seem to load correctly HOT 1
- Support for defs HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from oksvg.