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

idea: merge consecutive paths with same fill? #162

Open
anthrotype opened this issue Dec 4, 2020 · 2 comments
Open

idea: merge consecutive paths with same fill? #162

anthrotype opened this issue Dec 4, 2020 · 2 comments

Comments

@anthrotype
Copy link
Member

while looking at some waved flags in noto-emoji, I noticed one where there are dozen (perhaps hundreds, I didn't count -- the svg is probably autotraced which may expain the big numbers) of consecutive paths that have the same fill.

Since in nanoemoji we convert each <path> elements to a glyph (to be used as a filled path in COLR PaintGlyph), and the total number of glyphIDs in a font is 65,636, we want to reduce the overall number of layers that each color glyph uses.

What if picosvg makes a single <path> out of two or more <path>s that have the same fill?
We could use skia-pathops to make a union of the paths..

@anthrotype
Copy link
Member Author

I said consecutive (as in Z-order), but in theory they could be interspersed with other paths that have different fill but which do not overlap with the paths we're trying to union. Such that merging the latter while pushing the ones in between after the merged path wouldn't change the way they look.

@anthrotype
Copy link
Member Author

this has become more urgent as we discovered Safar rejects SVG documents in OpenType SVG table if they contain more than 1000 elements in total, or if any element has more than 500 children.

For example, the Ecuador and the El Salvador's flags both contain more than 1000 elements each, but hundreds of them are consecutive <path> elements that share the same fill or stroke properties so they can be merged into single elements.

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

1 participant