-
Notifications
You must be signed in to change notification settings - Fork 72
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
Continue support COLRv1 table #145
Conversation
@RazrFalcon As far as I can tell, the current way we deal with outlines is not going to be good enough to work with COLRv1 correctly... In particular, filling a shape must also create a clip path, so that if we have nested fills, the clip paths are combined. See also https://learn.microsoft.com/en-us/typography/opentype/spec/colr#filling-shapes. Currently, we only have the My suggestions would be the following: Instead of having a single What do you think? |
Sure. Sounds good. |
Small update: Making decent progress, but some parts of it are a bit tricky, especially dealing with transforms that only apply to a paint and not to an outline... But I'll think of something and make the API a bit nicer while I'm at it. Only major thing missing is variable fonts, not sure how difficult that will be to implement. |
What exactly is the "Explain why" comment referring to? And could we merge all of the |
I already forgot 😄 I would guess this is because rotate to affine transform requires trigonometry functions, which are not available in I don't mind having just the |
@@ -20,7 +20,7 @@ impl<'a> Table<'a> { | |||
let mut s = Stream::new(data); | |||
|
|||
let version = s.read::<u16>()?; | |||
if version != 0 { | |||
if version > 1 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
v0 and v1 are the same?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The first part of the table should be the same. That's why we have an early return in the function if version is 0.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we support v1? Does it even have a useful info for us?
Once again a superb job! The code looks like if I wrote it myself, back in those days when I had time... I guess it was a good introduction into TrueType insanity, especially since you had to deal with variable fonts as well. And with this change I guess Also update the readme. We currently have Have you thought about rasterizing COLRv1 via |
It was indeed. 😄 It's crazy how many different features there are....
Yeah, this would in theory be the next step. The main blocker for this is that we don't have sweep gradients in For now, my basic idea was to port the font2svg part into |
Btw it looks like |
Got it. I will look into adding sweep gradients to tiny-skia somewhere this month and will try to implement a COLRv1 rasterizer as well. Examples are not intended to be running without default features. It's fine. Ready to merge? |
Okay, good luck with that, feel free to ping me if there is a test case you can't get to render properly. Keep in mind that I have a feeling that it will be tricky to get some edge cases to work properly.
From my side yes! |
@RazrFalcon Should I port the "best-effort" solution to usvg? Or do you prefer if |
Sure. Something would be better then nothing. |
I'll wait for the next |
Strange. Will bump You probably have to path |
@LaurenzV I guess something got changed in the variable fonts support. |
Oof... Okay, I will try to look into it. Sorry, maybe I should've tested the integration with |
Bumped |
@RazrFalcon How hard do you think would it be to add sweep gradients to tiny-skia for someone who has never looked at the Skia code base? 😅 If you think it's manageable maybe I'll take a look. |
I think it would be a waster of time. You would have to know how Skia works and what changes I had to do to adapt it to Rust and tiny-skia. Unlike rustybuzz, tiny-skia is very different to Skia. I will try to look into it soon™. |
No description provided.