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

ReemKufiInk crashes pyftsubset #2438

Closed
rsheeter opened this issue Nov 2, 2021 · 5 comments · Fixed by #2439 or #2441
Closed

ReemKufiInk crashes pyftsubset #2438

rsheeter opened this issue Nov 2, 2021 · 5 comments · Fixed by #2439 or #2441

Comments

@rsheeter
Copy link
Collaborator

rsheeter commented Nov 2, 2021

pyftsubset --text=duck --output-file=/tmp/reem.otf ReemKufiInk-Bold.otf

Traceback (most recent call last):
  File "/tmp/venv/bin/pyftsubset", line 8, in <module>
    sys.exit(main())
  File "/tmp/venv/lib/python3.9/site-packages/fontTools/misc/loggingTools.py", line 372, in wrapper
    return func(*args, **kwds)
  File "/tmp/venv/lib/python3.9/site-packages/fontTools/subset/__init__.py", line 3104, in main
    subsetter.subset(font)
  File "/tmp/venv/lib/python3.9/site-packages/fontTools/subset/__init__.py", line 2908, in subset
    self._subset_glyphs(font)
  File "/tmp/venv/lib/python3.9/site-packages/fontTools/subset/__init__.py", line 2846, in _subset_glyphs
    retain = table.subset_glyphs(self)
  File "/tmp/venv/lib/python3.9/site-packages/fontTools/subset/__init__.py", line 2086, in subset_glyphs
    colorGlyphsV1 = unbuildColrV1(self.table.LayerList, self.table.BaseGlyphList)
  File "/tmp/venv/lib/python3.9/site-packages/fontTools/colorLib/unbuilder.py", line 6, in unbuildColrV1
    unbuilder = LayerListUnbuilder(layerV1List.Paint)
AttributeError: 'NoneType' object has no attribute 'Paint'

TTX handles the font just fine. File from https://github.com/aliftype/reem-kufi/commits/colr-v1 at 93d6dcd693ae42bb4295701e88a07cc4d04db73c

@rsheeter
Copy link
Collaborator Author

rsheeter commented Nov 2, 2021

Summon @anthrotype

@anthrotype
Copy link
Member

Oh.. the LayerList is optional so we should check is not None. Strange that the font makes no use of PaintColrLayers, but still valid and subsetter should be fixed

@khaledhosny
Copy link
Collaborator

Strange that the font makes no use of PaintColrLayers

Yes, it is a placeholder font (all COLRv1 layers are single layers with solid colors)

@rsheeter
Copy link
Collaborator Author

rsheeter commented Nov 2, 2021

I love that summoning Cosimo actually worked. And we found a bug, win/win!

rsheeter added a commit to google/fonts that referenced this issue Nov 6, 2021
This reverts commit 9bcdaa5; subsetter
fix now available
rsheeter added a commit to google/fonts that referenced this issue Nov 6, 2021
* Revert "Remove pending fix for subsetter (#3998)"

This reverts commit 1b5032e; subsetter
fix now available

* Revert "Remove ReemKufiInk-Bold due to fonttools/fonttools#2438 (#3997)"

This reverts commit 9bcdaa5; subsetter
fix now available
@rsheeter
Copy link
Collaborator Author

rsheeter commented Nov 6, 2021

Original pyftsubset command does now pass but other use still crashes; reopening.

pyftsubset --output-file=/tmp/reem.ttf --gids=0,128,210,211,218,225,227,232,234,235,237,238,241,244,246,250,251,254,261,264,270,271,277,280,282,284,286,289,295,297,299,307,308,316,317,318,320,327,331,343,345,347,348,349,350,351,357,365,370,371,374,376,378,392,393,398,399 ReemKufiInk-Regular.otf

Traceback (most recent call last):
  File "venv/bin/pyftsubset", line 11, in <module>
    load_entry_point('fonttools', 'console_scripts', 'pyftsubset')()
  File "Lib/fontTools/misc/loggingTools.py", line 372, in wrapper
    return func(*args, **kwds)
  File "Lib/fontTools/subset/__init__.py", line 3106, in main
    subsetter.subset(font)
  File "Lib/fontTools/subset/__init__.py", line 2911, in subset
    self._prune_post_subset(font)
  File "Lib/fontTools/subset/__init__.py", line 2894, in _prune_post_subset
    retain = table.prune_post_subset(font, self.options)
  File "Lib/fontTools/subset/__init__.py", line 2140, in prune_post_subset
    record.Paint.traverse(colr.table, collect_colors_by_index)
  File "Lib/fontTools/ttLib/tables/otTables.py", line 1550, in traverse
    stack.extend(reversed(current.getChildren(colr)))
  File "Lib/fontTools/ttLib/tables/otTables.py", line 1520, in getChildren
    return colr.LayerList.Paint[
AttributeError: 'NoneType' object has no attribute 'Paint'

@rsheeter rsheeter reopened this Nov 6, 2021
@rsheeter rsheeter changed the title ReemKufiInk-Bold crashes pyftsubset ReemKufiInk crashes pyftsubset Nov 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants