googlefonts / diffenator2

A font comparison tool that will not stop until your fonts are exhaustively compared.
Apache License 2.0
43 stars 6 forks source link

AttributeError: `Glyph` object has no attribute `isVarComposite` #149

Closed RickyDaMa closed 3 months ago

RickyDaMa commented 3 months ago

Guessing an API has shifted under you, or maybe this type wasn't expected to end up here?

Diffenator2 invocation:

diffenator2 diff --fonts-before SomeUrduFont-old.ttf --fonts-after SomeUrduFont-new.ttf --out diffenator_report -s masters

Output:

Traceback (most recent call last):
  File "./venv/bin/_diffenator", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "./venv/lib/python3.11/site-packages/diffenator2/_diffenator.py", line 110, in main
    diff.diff_all()
  File "./venv/lib/python3.11/site-packages/diffenator2/_diffenator.py", line 38, in diff_all
    self.diff_tables()
  File "./venv/lib/python3.11/site-packages/diffenator2/_diffenator.py", line 45, in diff_tables
    self.tables = jfont.Diff(self.old_font.jFont, self.new_font.jFont)
                             ^^^^^^^^^^^^^^^^^^^
  File "./venv/lib/python3.11/site-packages/diffenator2/font.py", line 74, in jFont
    return jfont.TTJ(self.ttFont)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "./venv/lib/python3.11/site-packages/diffenator2/jfont.py", line 204, in TTJ
    return _TTJ(ttFont, root)
           ^^^^^^^^^^^^^^^^^^
  File "./venv/lib/python3.11/site-packages/diffenator2/jfont.py", line 233, in _TTJ
    return {
           ^
  File "./venv/lib/python3.11/site-packages/diffenator2/jfont.py", line 234, in <dictcomp>
    k: _TTJ(obj[k], root)
       ^^^^^^^^^^^^^^^^^^
  File "./venv/lib/python3.11/site-packages/diffenator2/jfont.py", line 243, in _TTJ
    return {k: _TTJ(getattr(obj, k), root, depth=depth + 1) for k in vars(obj)}
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "./venv/lib/python3.11/site-packages/diffenator2/jfont.py", line 243, in <dictcomp>
    return {k: _TTJ(getattr(obj, k), root, depth=depth + 1) for k in vars(obj)}
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "./venv/lib/python3.11/site-packages/diffenator2/jfont.py", line 239, in _TTJ
    return {k: _TTJ(v, root) for k, v in obj.items()}
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "./venv/lib/python3.11/site-packages/diffenator2/jfont.py", line 239, in <dictcomp>
    return {k: _TTJ(v, root) for k, v in obj.items()}
               ^^^^^^^^^^^^^
  File "./venv/lib/python3.11/site-packages/diffenator2/jfont.py", line 228, in _TTJ
    return serialise_glyph(obj, root)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "./venv/lib/python3.11/site-packages/diffenator2/jfont.py", line 169, in serialise_glyph
    elif obj.isVarComposite():
         ^^^^^^^^^^^^^^^^^^
AttributeError: 'Glyph' object has no attribute 'isVarComposite'. Did you mean: 'isComposite'?
m4rc1e commented 3 months ago

Thanks Ricky! I saw the title and wondered if I was suffering from amnesia. Since I have an open pr, https://github.com/googlefonts/diffenator2/pull/147 I guess I am.

m4rc1e commented 3 months ago

Fixed in a new release, https://github.com/googlefonts/diffenator2/releases/tag/v0.4.3

RickyDaMa commented 3 months ago

Cheers Marc!