LettError / glyphNameFormatter

Generate list of glyphnames from unicode names.
BSD 3-Clause "New" or "Revised" License
75 stars 9 forks source link

reader.u2n issue: strange behaviour #90

Closed RafalBuchner closed 2 years ago

RafalBuchner commented 4 years ago

well, this is a mystery:

one of the people that I work with had this output

    if isIdeograph(value):
  File "/Applications/RoboFont.app/Contents/Resources/lib/python3.7/glyphNameFormatter/reader.py", line 57, in isIdeograph
    if a<=value<=b:
TypeError: '<=' not supported between instances of 'int' and 'NoneType'

I used glyphNameFormatter in the RF script that changes glyph names based on their Unicode, using u2n. This script worked on every other computer but mentioned fella's laptop. I tested it with the same ufos etc.

I fixed it by making a custom glyphNameFormatter version, where u2n function looked like this:

def u2n(value):
    """Unicode value to glyphname"""
    global uni2name
    v = uni2name.get(value)
    if v is not None:
        return v
        # I added two lines below to make sure 
        # that u2n returns None if the value is None:
    else:
        return None
    if isIdeograph(value):
        return uniPatternName(value)

any idea what was going on? Before I made this small fix, I made some tests to find what could cause the problem. We tried to uninstalling RF, its custom libraries, all extensions and scripts to make sure that nothing in RF's environment 'special' is influencing the behavior of this library. Then we installed a fresh RF and run the script on the same computer. The same output appeared. Any ideas about what could go wrong?

(RF's embedded version of glyphNameFormatter was 0.4, but the same happened if we installed the last version as an external library). Also, the same happened on few different RF builds.

Cheers

LettError commented 2 years ago