-
-
Notifications
You must be signed in to change notification settings - Fork 660
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
Color hinting in gradients not recognized #1961
Comments
Hi! Thanks for the report. Color hints have been added in Images Level 4, that’s why they’re not supported yet. The fix is not easy, as it requires to change some code at different places, but it should be possible for people with a solid Python experience, even if they don’t know how WeasyPrint works. I can give hints if anybody is interested! |
(Also related to #1372) |
I think they are actually from Level 3 -- you can see the interpolation algorithm here for instance, and the syntax is included in the level-3 color-stop definitions. Level 4 seems to have added a finer-grained support for interpolation methods, but that doesn't seem like too big a deal. I might take a shot at this myself, actually, since I've been looking at it, but I'm pretty slow so it'll surely be a bit! I'll check in if I have any questions. |
Oh, you’re right! They’ve been added in the 2019 update.
No problem, thanks a lot 💜! Here are some steps you can follow:
If you want to know more about how gradients are stored in PDF, you can get the PDF 2.0 specification and read chapters 7.10 and 8.7.4.5. But you can also just start with steps 1 and 2 (and even 4) and let me fight with the PDF specification! Don’t hesitate to ask, I’ll be happy to help. |
It seems that the parser doesn't recognize the color-hint term in gradient definitions. This is a bare percentage that may be specified between any two adjacent stops to fine-tune the interpolation. See here for a minimal example. It looks to me as though the code anticipates that it can apply parse_color_stop to each comma-separated item of the stop list, and thus throws an error on the color hint.
The text was updated successfully, but these errors were encountered: