googlefonts / nanoemoji

A wee tool to build color fonts.
Apache License 2.0
239 stars 19 forks source link

Too many Layers? AssertionError in FontTools TTLib #450

Open Graullon opened 1 year ago

Graullon commented 1 year ago

Hello there! I'm trying to build .ttf font from a pretty big amount of .svg (like 3000+, most of them are from Noto Color Emoji) with COLRv0 support. Unfortunately, I'm stuck with build error. Error stack trace you can see in attached .txt file. As far as I understand a situation, nanoemoji generates more than 65536 layers for COLRv0 table that results in error. Similar error and discussion are present at: https://github.com/fonttools/fonttools/issues/2364. Maybe nanoemoji can restrict number of layers or any other suggestions?

COLRv0 Compile Error.txt

anthrotype commented 1 year ago

well, the max 65536 layers is a limitation of the COLR version 0 format, there's nothing we can do about that, you should try passing in less svg inputs that can fit. I believe it will work if you create instead a COLR version 1 font, as that uses 32 bit integers for offsets and lengths. Consider using COLRv1 if that's an option, and maybe use the other nanoemoji's script, maximum_color, to produce an OT-SVG variant of your COLRv1 font for environments that don't support COLRv1.

Graullon commented 1 year ago

Yeah, less input helps. I want to use font with Qt Framework, but current Qt 6.5 LTS supports only COLRv0 on WIndows (through DirectWrite). Use of Freetype helps, windows compatible version works mostly on every OS. Ofc its question for Qt why they don't support more font tables through DirectWrite. Anyway, thanks for help!

Will leave this for future generations: building COLRv0 by nanoemoji and Noto Color Emoji SVG set provides bad results, font works on Windows Qt 6.5. but bad quality, no gradients etc, so no reason to try.