-
Notifications
You must be signed in to change notification settings - Fork 8
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
[COLRv2] Paint templates #371
Comments
sorry, what does it mean to "instantiate a template paint"? Can you make an example of how this would work? |
It will draw the That is,
I'll try to add. |
Here's an example. Imagine we want to create "boy" emoji with multiple skin colors. What we can do is to have one template paint for the emoji, which has one variable paint for the face gradient:
|
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
So I went ahead and implemented this in FontTools & HarfBuzz. I also wrote some code to take NotoColorEmoji-Regular.ttf or any other COLRv1 font and extract templates from it and templatize glyphs that can benefit. The savings unfortunately are meager. It saves 2.84% of the COLR table size, which translates to only 0.63% of the total font. This is expected since most glyphs do not templatize in a full emoji repertoire. Here's the tools output:
To summarize: I think this is still worth considering, but the savings would not justify jumping on it just yet. Perhaps when we have more COLRv2 ideas we can sneak this in too. FontTools PR: fonttools/fonttools#3242 |
This may not give you much on its own, but I think the savings of this combined with PaintSelf might be more interesting to look at. |
Motivated by #370, I like to go further and propose what @matthiasclasen and I have been talking about, which is paint templates. This does NOT supersede @simoncozens's proposal in #370 though. That would be separately a good idea.
The way it works is that the
PaintTemplateInstantce
will /instantiate/ thetemplate
paint, with the arguments set inArguments
. The template then can invoke arguments usingPaintTemplateArgument
paints.The text was updated successfully, but these errors were encountered: