googlefonts / ufo2ft

A bridge from UFOs to FontTools objects (and therefore, OTFs and TTFs).
MIT License
152 stars 43 forks source link

FlattenComponents filter incorrectly flattens components with a component and path contained within #460

Closed aaronbell closed 3 years ago

aaronbell commented 3 years ago

[Sorry I dug a bit deeper and realized the issue is different, so have modified here]

I am running "flattenComponents" on a font and have encountered a situation where the filter appears to be changing the component being used in a glyph.

In YuseiMagic, the semicolon glyph contains the period and comma glyphs as components. However, when flattened, the end result for the semicolon is:

Screen Shot 2021-02-09 at 3 30 31 PM

It appears that the flattenComponent filter has only grabbed the period component from the comma, and left the path contained in the glyph.

Switching the filter to "decomposeComponents" resolves the issue:

Screen Shot 2021-02-09 at 3 31 15 PM

While workable as a work around, this significantly increases file size, especially for CJK fonts where components are being commonly used.

For test purposes I have attached a glyphs source that shows the glyph structures, as well as output fonts showing the flatten vs decompose outputs. YuseiMagic_flatten.glyphs.zip demo fonts.zip

Additionally, you can take a look at: https://github.com/tanukifont/YuseiMagic for the build process I am using. Do note that I recently submitted a PR that changes flatten over to decompose for the purposes of making the font work properly.

aaronbell commented 3 years ago

Looks like this issue is resolved by #448 but hasn't quite made it to a production release.

Just wanted to let you know that it isn't as edge case as you might think! 😄

anthrotype commented 3 years ago

thanks, sorry about that. There's a few pending PRs (#452, #458) which I haven't had time to fully review and that are currently holding us from cutting a new release. Hopefully before end of this week

anthrotype commented 3 years ago

@aaronbell I just cut a new v2.19.2 release containing the fix

aaronbell commented 3 years ago

Thanks @anthrotype!

moyogo commented 3 years ago

Thanks @anthrotype!