googlefonts / googlefonts/glyphsLib

Axis mappings may be strings instead of int

Open
#527 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
202
Forks
57
Avg merge
17m
Merged PRs (30d)
1

Description

I got this traceback mailed to me:

Traceback (most recent call last):
  File "/Users/.../bin/fontmake", line 11, in <module>
    sys.exit(main())
  File "/Users/.../lib/python3.6/site-packages/fontmake/__main__.py", line 258, in main
    project.run_from_glyphs(glyphs_path, **args)
  File "/Users/.../lib/python3.6/site-packages/fontmake/font_project.py", line 560, in run_from_glyphs
    mti_source=mti_source)
  File "/Users/.../lib/python3.6/site-packages/fontTools/misc/loggingTools.py", line 375, in wrapper
    return func(*args, **kwds)
  File "/Users/.../lib/python3.6/site-packages/fontmake/font_project.py", line 131, in build_master_ufos
    font, family_name=family_name, instance_dir=instance_dir)
  File "/Users/.../lib/python3.6/site-packages/glyphsLib/builder/__init__.py", line 104, in to_designspace
    return builder.designspace
  File "/Users/.../lib/python3.6/site-packages/glyphsLib/builder/builders.py", line 211, in designspace
    self.to_designspace_axes()
  File "/Users/.../lib/python3.6/site-packages/glyphsLib/builder/axes.py", line 201, in to_designspace_axes
    minimum = min(mapping)
TypeError: '<' not supported between instances of 'str' and 'int'

@MrBrezina: can you please provide a test file? Maybe the one you used, stripped of all glyphs and miscellaneous data.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by inspecting glyphsLib/builder/axes.py around to_designspace_axes, where the traceback reports min(mapping) failing, and obtain the source .glyphs file requested in the issue. Reproduce the conversion with axis mappings containing strings and add coverage showing that the conversion completes with consistent integer mappings.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.