googlefonts / nanoemoji

A wee tool to build color fonts.
Apache License 2.0
238 stars 20 forks source link

nanoemoji errors out when converting noto color emoji svg folder to COLRv0 format #468

Open folsze opened 5 months ago

folsze commented 5 months ago

There are 3576 emoji SVG files inside this directory:

https://github.com/googlefonts/noto-emoji/tree/main/svg

When I clone the repo locally and inside this svg directory run:

nanoemoji --color_format=glyf_colr_0 ./*.svg

I am running this on MacOS M2 Pro, so a pretty fast computer.

Then nanoemoji get stuck for an extremely long amount of time, but only at the very end of the process, with just two missing "7154/7156".

do note: 7156 is roughly double the svg count (3576 * 2 = 7152)

I0512 12:10:23.731186 8650308288 nanoemoji.py:645] Generating build.ninja
I0512 12:10:24.201722 8650308288 ninja.py:124] ninja -C /Users/felixolszewski/IdeaProjects/emoji-fix/noto-emoji/svg/build
ninja: Entering directory `/Users/felixolszewski/IdeaProjects/emoji-fix/noto-emoji/svg/build'
[7154/7156] /opt/anaconda3/bin/python -m nanoemoji.write_combined_part_files -v 0 --output_file parts-merged.json  @parts-merged.json.rsp

When I reduce the svgs to a count of like 70 SVGs, then the script runs successfully fast, but also gets a bit stuck at the end. But it ends. With 3576 svgs it seems to never finish execution. And then when it does, it errors out, see the next piece of inforation below here:

folsze commented 5 months ago

Update: the process ran through now, after waiting for a long time. This is the error output:

(base) felixolszewski@Felixs-MacBook-Pro-2 svg % nanoemoji --color_format=glyf_colr_0 ./*.svg

I0512 12:10:23.548559 8650308288 nanoemoji.py:639] Proceeding with 1 config(s)
I0512 12:10:23.730973 8650308288 nanoemoji.py:602] Wrote build/Font.toml
I0512 12:10:23.731186 8650308288 nanoemoji.py:645] Generating build.ninja
I0512 12:10:24.201722 8650308288 ninja.py:124] ninja -C /Users/felixolszewski/IdeaProjects/emoji-fix/noto-emoji/svg/build
ninja: Entering directory `/Users/felixolszewski/IdeaProjects/emoji-fix/noto-emoji/svg/build'
[7156/7156] /opt/anaconda3/bin/python -m nanoemoji.write_font -v 0 --config_file Font.toml --fea_file Font.fea --glyphmap_file Font.glyphmap --part_file parts-merged.json 
FAILED: Font.ttf 
/opt/anaconda3/bin/python -m nanoemoji.write_font -v 0 --config_file Font.toml --fea_file Font.fea --glyphmap_file Font.glyphmap --part_file parts-merged.json 
W0512 12:16:43.106477 8650308288 glyph_reuse.py:69] affine_between failed: M476.90625,558.78125 C446.25,572.375 412.6875,535.4375 398.0625,510.1250305175781 C383.4375,484.8125 369.84375,435.125 400.96875,422.46875 C432.09375,409.8125 454.5,431.1875 476.90625,468.21875 C499.3124694824219,505.25 511.96875,543.21875 476.90625,558.78125 Z M487.03125,701.65625 C464.71875,711.59375 440.34375,684.6875 429.6562805175781,666.21875 C419.0625,647.84375 409.125,611.75 431.8125,602.46875 C454.5,593.28125 470.71875,608.84375 487.03125,635.75 C503.34375,662.75 512.53125,690.3125 487.03125,701.65625 Z 
W0512 12:16:46.922793 8650308288 glyph_reuse.py:69] affine_between failed: M1155.449951171875,710.3656005859375 C1157.6343994140625,702.5374755859375 1153.293701171875,694.4937744140625 1145.765625,692.3937377929688 C1138.2281494140625,690.2937622070312 1130.3531494140625,694.9437255859375 1128.1781005859375,702.7718505859375 C1125.9937744140625,710.609375 1130.3343505859375,718.6531372070312 1137.862548828125,720.7531127929688 C1145.4000244140625,722.8531494140625 1153.2750244140625,718.203125 1155.449951171875,710.3656005859375 Z M529.78125,394.4375 C529.78125,368.49737548828125 509.50811767578125,347.46881103515625 484.5,347.46881103515625 C459.49188232421875,347.46881103515625 439.21875,368.49737548828125 439.21875,394.4375 C439.21875,420.37762451171875 459.49188232421875,441.40625 484.5,441.40625 C509.50811767578125,441.40625 529.78125,420.37762451171875 529.78125,394.4375 Z 
W0512 12:16:47.462694 8650308288 glyph_reuse.py:69] affine_between failed: M537.75,714.40625 L537.65625,643.25 L561.65625,643.25 L561.65625,714.40625 Z M199.96875,-79.9375 L200.0625,-164.875 L238.68748474121094,-164.875 L238.68748474121094,-79.75 Z 
W0512 12:16:48.619883 8650308288 glyph_reuse.py:69] affine_between failed: M1166.8125,571.34375 L1043.0625,447.59375 L1166.8125,447.59375 Z M128.53125,739.8125 L280.6875,627.125 L148.3125,607.0625 Z 
W0512 12:16:48.978417 8650308288 glyph_reuse.py:69] affine_between failed: M294.46875,92.69378662109375 L936.6563110351562,757.4749755859375 Q938.2874755859375,759.1624755859375 939.9749755859375,757.53125 Q940.8187255859375,756.7156372070312 940.8281860351562,755.890625 Q940.846923828125,755.0562744140625 940.0311889648438,754.2125244140625 L297.84375,89.4312744140625 Q297.02813720703125,88.58746337890625 296.203125,88.578125 Q295.3687438964844,88.55938720703125 294.5249938964844,89.375 Q292.8374938964844,91.0062255859375 294.46875,92.69378662109375 Z M330.2718811035156,60.237548828125 L966.3656616210938,730.4562377929688 Q967.171875,731.3093872070312 967.9968872070312,731.328125 Q968.8218994140625,731.3468627929688 969.6749877929688,730.5406494140625 Q971.3718872070312,728.9281005859375 969.7593994140625,727.2312622070312 L333.6656188964844,57.01251220703125 Q332.0531311035156,55.31561279296875 330.35626220703125,56.9281005859375 Q329.50311279296875,57.734375 329.484375,58.55938720703125 Q329.4656066894531,59.3843994140625 330.2718811035156,60.237548828125 Z 
W0512 12:16:48.982733 8650308288 glyph_reuse.py:69] affine_between failed: M330.2718811035156,60.237548828125 L966.3656616210938,730.4562377929688 Q967.171875,731.3093872070312 967.9968872070312,731.328125 Q968.8218994140625,731.3468627929688 969.6749877929688,730.5406494140625 Q971.3718872070312,728.9281005859375 969.7593994140625,727.2312622070312 L333.6656188964844,57.01251220703125 Q332.0531311035156,55.31561279296875 330.35626220703125,56.9281005859375 Q329.50311279296875,57.734375 329.484375,58.55938720703125 Q329.4656066894531,59.3843994140625 330.2718811035156,60.237548828125 Z M354.07501220703125,38.4781494140625 L989.0437622070312,713.3843994140625 Q990.6468505859375,715.0906372070312 992.3530883789062,713.4874877929688 Q993.2062377929688,712.6812744140625 993.234375,711.8562622070312 Q993.262451171875,711.03125 992.4562377929688,710.1781005859375 L357.48748779296875,35.27191162109375 Q356.6812744140625,34.418701171875 355.85626220703125,34.390625 Q355.03125,34.36248779296875 354.1781311035156,35.16876220703125 Q352.47186279296875,36.7718505859375 354.07501220703125,38.4781494140625 Z 
W0512 12:16:49.095153 8650308288 glyph_reuse.py:69] affine_between failed: M354.07501220703125,38.4781494140625 L989.0437622070312,713.3843994140625 Q990.6468505859375,715.0906372070312 992.3530883789062,713.4874877929688 Q993.2062377929688,712.6812744140625 993.234375,711.8562622070312 Q993.262451171875,711.03125 992.4562377929688,710.1781005859375 L357.48748779296875,35.27191162109375 Q356.6812744140625,34.418701171875 355.85626220703125,34.390625 Q355.03125,34.36248779296875 354.1781311035156,35.16876220703125 Q352.47186279296875,36.7718505859375 354.07501220703125,38.4781494140625 Z M340.4437561035156,210.378173828125 L909.7874755859375,714.0968627929688 Q911.550048828125,715.6531372070312 913.096923828125,713.9000244140625 Q913.8750610351562,713.0187377929688 913.828125,712.1937255859375 Q913.7719116210938,711.3687744140625 912.9000244140625,710.5906372070312 L343.5562438964844,206.87188720703125 Q342.67498779296875,206.09375 341.8500061035156,206.140625 Q341.0249938964844,206.1968994140625 340.2468566894531,207.0687255859375 Q338.69061279296875,208.83123779296875 340.4437561035156,210.378173828125 Z 
W0512 12:16:49.098068 8650308288 glyph_reuse.py:69] affine_between failed: M340.4437561035156,210.378173828125 L909.7874755859375,714.0968627929688 Q911.550048828125,715.6531372070312 913.096923828125,713.9000244140625 Q913.8750610351562,713.0187377929688 913.828125,712.1937255859375 Q913.7719116210938,711.3687744140625 912.9000244140625,710.5906372070312 L343.5562438964844,206.87188720703125 Q342.67498779296875,206.09375 341.8500061035156,206.140625 Q341.0249938964844,206.1968994140625 340.2468566894531,207.0687255859375 Q338.69061279296875,208.83123779296875 340.4437561035156,210.378173828125 Z M362.6343688964844,197.046875 L918.8531494140625,705.265625 Q919.7249755859375,706.0531005859375 920.5499877929688,706.015625 Q921.375,705.9781494140625 922.171875,705.1156005859375 Q923.746826171875,703.3812255859375 922.0218505859375,701.796875 L365.8031311035156,193.578125 Q364.9312438964844,192.7906494140625 364.10626220703125,192.828125 Q363.28125,192.8656005859375 362.484375,193.7281494140625 Q360.9093933105469,195.46246337890625 362.6343688964844,197.046875 Z 
W0512 12:16:49.101008 8650308288 glyph_reuse.py:69] affine_between failed: M362.6343688964844,197.046875 L918.8531494140625,705.265625 Q919.7249755859375,706.0531005859375 920.5499877929688,706.015625 Q921.375,705.9781494140625 922.171875,705.1156005859375 Q923.746826171875,703.3812255859375 922.0218505859375,701.796875 L365.8031311035156,193.578125 Q364.9312438964844,192.7906494140625 364.10626220703125,192.828125 Q363.28125,192.8656005859375 362.484375,193.7281494140625 Q360.9093933105469,195.46246337890625 362.6343688964844,197.046875 Z M387.82501220703125,182.0093994140625 L927.7312622070312,696.5093994140625 Q929.4281005859375,698.1218872070312 931.0405883789062,696.4249877929688 Q931.846923828125,695.5812377929688 931.8280639648438,694.7562255859375 Q931.809326171875,693.921875 930.956298828125,693.1156005859375 L391.0500183105469,178.61566162109375 Q390.2062683105469,177.80938720703125 389.3812561035156,177.828125 Q388.546875,177.84686279296875 387.7406311035156,178.699951171875 Q386.12811279296875,180.3968505859375 387.82501220703125,182.0093994140625 Z 
W0512 12:16:49.103717 8650308288 glyph_reuse.py:69] affine_between failed: M342.16876220703125,49.36248779296875 L977.6062622070312,722.8624877929688 Q978.4124755859375,723.7062377929688 979.237548828125,723.734375 Q980.0718994140625,723.7625122070312 980.925048828125,722.9562377929688 Q982.6218872070312,721.34375 981.0187377929688,719.6375122070312 L345.58123779296875,46.137451171875 Q343.96875,44.44061279296875 342.2624816894531,46.04376220703125 Q340.56561279296875,47.65625 342.16876220703125,49.36248779296875 Z M404.765625,165.30316162109375 L937.640625,687.7718505859375 Q939.3093872070312,689.4124755859375 940.9594116210938,687.734375 Q941.7750244140625,686.9000244140625 941.765625,686.0656127929688 Q941.7562866210938,685.2406005859375 940.921875,684.4156494140625 L408.046875,161.9468994140625 Q406.37811279296875,160.30621337890625 404.7281494140625,161.984375 Q403.0874938964844,163.65313720703125 404.765625,165.30316162109375 Z 
W0512 12:16:51.620975 8650308288 glyph_reuse.py:69] affine_between failed: M1082.4375,423.59375 C1082.4375,423.59375 1122.28125,508.0625 1158.9375,504.5 C1231.96875,497.28125 1082.4375,423.59375 1082.4375,4

... <lots of similar number failed content omitted>

2.5 C1166.4375,-212.5 1200,-178.9375 1200,-137.5 L1200,837.5 C1200,878.9375 1166.4375,912.5 1125,912.5 Z 
I0512 12:19:14.784570 8650308288 baseCompiler.py:71] Pre-processing glyphs
I0512 12:19:15.787172 8650308288 base.py:201] Running DecomposeComponentsFilter on AnEmojiFamily-Regular
I0512 12:19:15.810917 8650308288 base.py:201] Running CubicToQuadraticFilter on AnEmojiFamily-Regular
I0512 12:19:16.940192 8650308288 cubicToQuadratic.py:46] New spline lengths: 1: 29938, 2: 69052, 3: 25546, 4: 12715, 5: 3594, 6: 1321, 7: 562, 8: 175, 9: 39
I0512 12:19:16.940536 8650308288 baseCompiler.py:62] Building OpenType tables
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/opt/anaconda3/lib/python3.11/site-packages/nanoemoji/write_font.py", line 838, in <module>
    app.run(main)
  File "/opt/anaconda3/lib/python3.11/site-packages/absl/app.py", line 308, in run
    _run_main(main, args)
  File "/opt/anaconda3/lib/python3.11/site-packages/absl/app.py", line 254, in _run_main
    sys.exit(main(argv))
             ^^^^^^^^^^
  File "/opt/anaconda3/lib/python3.11/site-packages/nanoemoji/write_font.py", line 831, in main
    ufo, ttfont = _generate_color_font(font_config, inputs)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/anaconda3/lib/python3.11/site-packages/nanoemoji/write_font.py", line 769, in _generate_color_font
    ttfont = util.load_fully(ttfont)
             ^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/anaconda3/lib/python3.11/site-packages/nanoemoji/util.py", line 115, in load_fully
    font = _reload(font, lazy=False)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/anaconda3/lib/python3.11/site-packages/nanoemoji/util.py", line 103, in _reload
    font.save(tmp)
  File "/opt/anaconda3/lib/python3.11/site-packages/fontTools/ttLib/ttFont.py", line 211, in save
    writer_reordersTables = self._save(tmp)
                            ^^^^^^^^^^^^^^^
  File "/opt/anaconda3/lib/python3.11/site-packages/fontTools/ttLib/ttFont.py", line 258, in _save
    self._writeTable(tag, writer, done, tableCache)
  File "/opt/anaconda3/lib/python3.11/site-packages/fontTools/ttLib/ttFont.py", line 708, in _writeTable
    tabledata = self.getTableData(tag)
                ^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/anaconda3/lib/python3.11/site-packages/fontTools/ttLib/ttFont.py", line 730, in getTableData
    return self.tables[tag].compile(self)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/anaconda3/lib/python3.11/site-packages/fontTools/ttLib/tables/C_O_L_R_.py", line 81, in compile
    table.compile(writer, ttFont)
  File "/opt/anaconda3/lib/python3.11/site-packages/fontTools/ttLib/tables/otBase.py", line 1096, in compile
    conv.write(writer, font, table, value)
  File "/opt/anaconda3/lib/python3.11/site-packages/fontTools/ttLib/tables/otConverters.py", line 754, in write
    value.compile(subWriter, font)
  File "/opt/anaconda3/lib/python3.11/site-packages/fontTools/ttLib/tables/otBase.py", line 1058, in compile
    conv.writeArray(writer, font, table, value)
  File "/opt/anaconda3/lib/python3.11/site-packages/fontTools/ttLib/tables/otConverters.py", line 217, in writeArray
    self.write(writer, font, tableDict, value, i)
  File "/opt/anaconda3/lib/python3.11/site-packages/fontTools/ttLib/tables/otConverters.py", line 635, in write
    value.compile(writer, font)
  File "/opt/anaconda3/lib/python3.11/site-packages/fontTools/ttLib/tables/otBase.py", line 1096, in compile
    conv.write(writer, font, table, value)
  File "/opt/anaconda3/lib/python3.11/site-packages/fontTools/ttLib/tables/otConverters.py", line 350, in write
    writer.writeUShort(value)
  File "/opt/anaconda3/lib/python3.11/site-packages/fontTools/ttLib/tables/otBase.py", line 758, in writeUShort
    assert 0 <= value < 0x10000, value
           ^^^^^^^^^^^^^^^^^^^^
AssertionError: (65565, 'int', 2928, 'BaseGlyphRecord[]', 'BaseGlyphRecordArray')
ninja: build stopped: subcommand failed.
Traceback (most recent call last):
  File "/opt/anaconda3/bin/nanoemoji", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/opt/anaconda3/lib/python3.11/site-packages/nanoemoji/nanoemoji.py", line 761, in main
    app.run(_run)
  File "/opt/anaconda3/lib/python3.11/site-packages/absl/app.py", line 308, in run
    _run_main(main, args)
  File "/opt/anaconda3/lib/python3.11/site-packages/absl/app.py", line 254, in _run_main
    sys.exit(main(argv))
             ^^^^^^^^^^
  File "/opt/anaconda3/lib/python3.11/site-packages/nanoemoji/nanoemoji.py", line 756, in _run
    maybe_run_ninja(build_file)
  File "/opt/anaconda3/lib/python3.11/site-packages/nanoemoji/ninja.py", line 125, in maybe_run_ninja
    subprocess.run(ninja_cmd, check=True)
  File "/opt/anaconda3/lib/python3.11/subprocess.py", line 571, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['ninja', '-C', '/Users/felixolszewski/IdeaProjects/emoji-fix/noto-emoji/svg/build']' returned non-zero exit status 1.
(base) felixolszewski@Felixs-MacBook-Pro-2 svg %