fonttools icon indicating copy to clipboard operation
fonttools copied to clipboard

pyftmerge: AttributeError: type object 'MathGlyphInfo' has no attribute 'mergeMap'

Open evilpie opened this issue 7 months ago • 2 comments

I am trying to merge a subset of Noto Sans with glyphs from Noto Sans. This produces:

Traceback (most recent call last):
  File "/usr/bin/pyftmerge", line 8, in <module>
    sys.exit(main())
             ~~~~^^
  File "/usr/lib/python3.13/site-packages/fontTools/misc/loggingTools.py", line 375, in wrapper
    return func(*args, **kwds)
  File "/usr/lib/python3.13/site-packages/fontTools/merge/__init__.py", line 238, in main
    font = merger.merge(fontfiles)
  File "/usr/lib/python3.13/site-packages/fontTools/merge/__init__.py", line 117, in merge
    table = clazz(tag).merge(self, tables)
  File "/usr/lib/python3.13/site-packages/fontTools/merge/base.py", line 79, in merge
    return m.mergeObjects(self, self.mergeMap, tables)
           ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.13/site-packages/fontTools/merge/__init__.py", line 155, in mergeObjects
    value = mergeLogic(getattr(table, key, NotImplemented) for table in tables)
  File "/usr/lib/python3.13/site-packages/fontTools/merge/base.py", line 61, in mergeObjects
    value = mergeLogic(getattr(table, key, NotImplemented) for table in lst)
  File "/usr/lib/python3.13/site-packages/fontTools/merge/base.py", line 44, in mergeObjects
    logic = clazz.mergeMap
            ^^^^^^^^^^^^^^
AttributeError: type object 'MathGlyphInfo' has no attribute 'mergeMap'

This might simply not possible, but it would be nice to have a better error message.

Reproduce with:

update-font.sh

wget https://github.com/notofonts/notofonts.github.io/raw/eb3fdd45f361e6ae8bb5e5ac75f90f7482d02c80/fonts/NotoSans/full/ttf/NotoSans-Regular.ttf
wget https://github.com/notofonts/notofonts.github.io/raw/eb3fdd45f361e6ae8bb5e5ac75f90f7482d02c80/fonts/NotoSansMath/full/ttf/NotoSansMath-Regular.ttf

pyftsubset --unicodes-file=unicodes-file.txt NotoSans-Regular.ttf

# 2200-22FF Mathematical Operators
pyftsubset --unicodes=2200-22FF NotoSansMath-Regular.ttf

pyftmerge NotoSans-Regular.subset.ttf NotoSansMath-Regular.subset.ttf

unicodes-file.txt

0000-007F, # Basic Latin
0080-00FF, # Latin-1 Supplement
0100-017F, # Latin Extended-A
0180-024F, # Latin Extended-B
02B0-02FF, # Spacing Modifier Letters
0370-03FF, # Greek and Coptic
0400-04FF, # Cyrillic
2000-206F, # General Punctuation
2070-209F, # Superscripts and Subscripts
20A0-20CF, # Currency Symbols
2100-214F, # Letterlike Symbols
2150-218F, # Number Forms

evilpie avatar May 11 '25 20:05 evilpie