googlefonts / nanoemoji

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

colr2svg.py broken by refactor #466

Open narinishi opened 5 months ago

narinishi commented 5 months ago

colr2svg depends on a module called colr_to_svg. This used to reside under the 'tests' directory, however has since been moved to the main source folder, without colr2svg being updated.

After correcting my checked out copy for the above issue, colr2svg was able to begin execution, though failed to process the COLRv1 font I had at hand, so additional changes may be required.

anthrotype commented 5 months ago

failed to process the COLRv1 font I had at hand, so additional changes may be required.

in what way?

anthrotype commented 5 months ago

btw, I fixed the import of colr_to_svg here on main

narinishi commented 5 months ago

font used was https://github.com/googlefonts/color-fonts/blob/main/fonts/noto-glyf_colr_1.ttf

Traceback (most recent call last):
  File "tools\colr2svg.py", line 44, in <module>
    for glyph_name, svg in colr_to_svg(
  File "python-3.8.0-embed-amd64\nanoemoji-main\src\nanoemoji\colr_to_svg.py", line 420, in colr_to_svg
    svgs = _colr_v1_to_svgs(view_box_callback, ttfont)
  File "python-3.8.0-embed-amd64\nanoemoji-main\src\nanoemoji\colr_to_svg.py", line 400, in _colr_v1_to_svgs
    return {
  File "python-3.8.0-embed-amd64\nanoemoji-main\src\nanoemoji\colr_to_svg.py", line 403, in <dictcomp>
    _colr_v1_glyph_to_svg(ttfont, glyph_set, view_box_callback, g)
  File "python-3.8.0-embed-amd64\nanoemoji-main\src\nanoemoji\colr_to_svg.py", line 352, in _colr_v1_glyph_to_svg
    view_box, font_to_vbox = _view_box_and_transform(
  File "python-3.8.0-embed-amd64\nanoemoji-main\src\nanoemoji\colr_to_svg.py", line 340, in _view_box_and_transform
    view_box = view_box_callback(glyph_name)
TypeError: 'Rect' object is not callable