moi15moi/FontCollector

AttributeError: 'AxisLimits' object has no attribute 'populateDefaults'

Closed this issue · 5 comments

fontcollector -i "01.ass"
ERROR - An unknown error occurred while reading the font "C:\Windows\Fonts\bahnschrift.ttf"
Please open an issue on github, share the font and the following error message:
Traceback (most recent call last):
  File "C:\Users\leah\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Users\leah\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "c:\users\leah\.local\bin\fontcollector.exe\__main__.py", line 7, in <module>
  File "C:\Users\leah\.local\pipx\venvs\fontcollector\lib\site-packages\font_collector\__main__.py", line 26, in main
    font_collection = FontLoader(additional_fonts, use_system_font).fonts
  File "C:\Users\leah\.local\pipx\venvs\fontcollector\lib\site-packages\font_collector\font_loader.py", line 25, in __init__
    self.system_fonts = FontLoader.load_system_fonts()
  File "C:\Users\leah\.local\pipx\venvs\fontcollector\lib\site-packages\font_collector\font_loader.py", line 97, in load_system_fonts
    system_fonts.update(Font.from_font_path(font_path))
  File "C:\Users\leah\.local\pipx\venvs\fontcollector\lib\site-packages\font_collector\font.py", line 76, in from_font_path
    axis_value_tables = FontParser.get_axis_value_from_coordinates(
  File "C:\Users\leah\.local\pipx\venvs\fontcollector\lib\site-packages\font_collector\font_parser.py", line 157, in get_axis_value_from_coordinates
    axisLimits = AxisLimits(coordinates).populateDefaults(font)
AttributeError: 'AxisLimits' object has no attribute 'populateDefaults'

This is cause by the last version of fonttools. 4.39.X

This PR #19 correct this problem, but I still need to test it properly.

@LYS1THEA Could you confirm me that you don't have anymore problem with the last version?

To update it, use this command:

pip install FontCollector -U
fontcollector -i 01.ass
INFO - Loaded successfully 01.ass
INFO - Found 'cabin pl' at 'C:\Users\leah\AppData\Local\Microsoft\Windows\Fonts\Cabin-PL-Bold.ttf'
INFO - Found 'cabin pl' at 'C:\Users\leah\AppData\Local\Microsoft\Windows\Fonts\Cabin-PL-BoldItalic.ttf'
INFO - Found 'averia serif' at 'C:\Users\leah\AppData\Local\Microsoft\Windows\Fonts\AveriaSerif-Bold.ttf'
WARNING - 'averia serif' does not have a bold variant.
WARNING - Used on lines: 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402
INFO - Found 'abelbecker-light' at 'C:\Users\leah\AppData\Local\Microsoft\Windows\Fonts\ABELBECKER-LIGHT.TTF'
INFO - Found 'puritan' at 'C:\Users\leah\AppData\Local\Microsoft\Windows\Fonts\PURIB10.TTF'
WARNING - 'puritan' does not have a bold variant.
WARNING - Used on lines: 451 452 454 455 457 458 460
Traceback (most recent call last):
  File "C:\Users\leah\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Users\leah\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "c:\users\leah\.local\bin\fontcollector.exe\__main__.py", line 7, in <module>
  File "C:\Users\leah\.local\pipx\venvs\fontcollector\lib\site-packages\font_collector\__main__.py", line 62, in main
    missing_glyphs := font_result.font.get_missing_glyphs(
  File "C:\Users\leah\.local\pipx\venvs\fontcollector\lib\site-packages\font_collector\font.py", line 289, in get_missing_glyphs
    if codepoint in cmap_table.cmap:
  File "C:\Users\leah\.local\pipx\venvs\fontcollector\lib\site-packages\fontTools\ttLib\tables\_c_m_a_p.py", line 289, in __getattr__
    self.ensureDecompiled()
  File "C:\Users\leah\.local\pipx\venvs\fontcollector\lib\site-packages\fontTools\ttLib\tables\_c_m_a_p.py", line 278, in ensureDecompiled
    self.decompile(None, None)  # use saved data.
  File "C:\Users\leah\.local\pipx\venvs\fontcollector\lib\site-packages\fontTools\ttLib\tables\_c_m_a_p.py", line 928, in decompile
    self.cmap = _make_map(self.ttFont, charCodes, gids)
  File "C:\Users\leah\.local\pipx\venvs\fontcollector\lib\site-packages\fontTools\ttLib\tables\_c_m_a_p.py", line 17, in _make_map
    glyphNames = font.getGlyphNameMany(gids)
  File "C:\Users\leah\.local\pipx\venvs\fontcollector\lib\site-packages\fontTools\ttLib\ttFont.py", line 649, in getGlyphNameMany
    glyphOrder = self.getGlyphOrder()
  File "C:\Users\leah\.local\pipx\venvs\fontcollector\lib\site-packages\fontTools\ttLib\ttFont.py", line 520, in getGlyphOrder
    glyphOrder = self["post"].getGlyphOrder()
  File "C:\Users\leah\.local\pipx\venvs\fontcollector\lib\site-packages\fontTools\ttLib\ttFont.py", line 442, in __getitem__
    table = self._readTable(tag)
  File "C:\Users\leah\.local\pipx\venvs\fontcollector\lib\site-packages\fontTools\ttLib\ttFont.py", line 459, in _readTable
    table.decompile(data, self)
  File "C:\Users\leah\.local\pipx\venvs\fontcollector\lib\site-packages\fontTools\ttLib\tables\_p_o_s_t.py", line 36, in decompile
    self.decode_format_2_0(data, ttFont)
  File "C:\Users\leah\.local\pipx\venvs\fontcollector\lib\site-packages\fontTools\ttLib\tables\_p_o_s_t.py", line 93, in decode_format_2_0
    maxIndex = max(indices)
ValueError: max() arg is an empty sequence

ass file https://files.catbox.moe/twvqu0.ass

I found your font online.
This issue is caused by fonttools. Currently, there is nothing I can do to correct this behaviour.

I opened an issue on their github: fonttools/fonttools#3060

I will close this issue since the original issue have been resolved.

The "new" issue is caused by fonttools which isn't what this repos is about.