Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support Variable length indexPaths #447

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

schriftgestalt
Copy link
Collaborator

No description provided.

@madig
Copy link
Collaborator

madig commented Nov 13, 2018

What's a variable length indexPath, what's it used for and do you have an example file where it is used?

@schriftgestalt
Copy link
Collaborator Author

Hints can have index paths with two, three (a link to the side bearing) or four (a implicit node at intersection of two segments) indexes.

@madig
Copy link
Collaborator

madig commented Nov 16, 2018

Do you have an example file that exercises the possibilities?

@schriftgestalt
Copy link
Collaborator Author

@jenskutilek
Copy link
Contributor

I just hit the same problem when trying to build a hinted font with fontmake. In case it helps, this is the link to the glyphs file: SudoVariable.glyphs

fontmake -g SudoVariable.glyphs -o variable
[...]
File "/Users/jens/Library/Python/3.7/lib/python/site-packages/glyphsLib/types.py", line 100, in fromString
    return [float(i) for i in self.regex.match(src).groups()]
AttributeError: 'NoneType' object has no attribute 'groups'

@madig
Copy link
Collaborator

madig commented Dec 4, 2018

Noted, but didn't have the time to look at this yet...

@madig
Copy link
Collaborator

madig commented Mar 1, 2019

@schriftgestalt Loading the file you supplied results in

Traceback (most recent call last):
  File "C:\UsersLocal\nikolaus.waxweiler\Envs\glyphsLib\Scripts\glyphs2ufo-script.py", line 11, in <module>
    load_entry_point('glyphsLib', 'console_scripts', 'glyphs2ufo')()
  File "c:\userslocal\nikolaus.waxweiler\development\glyphslib\lib\glyphsLib\cli.py", line 198, in _glyphs2ufo_entry_point
    return main(args)
  File "c:\userslocal\nikolaus.waxweiler\development\glyphslib\lib\glyphsLib\cli.py", line 161, in main
    return options.func(options)
  File "c:\userslocal\nikolaus.waxweiler\development\glyphslib\lib\glyphsLib\cli.py", line 190, in glyphs2ufo
    store_editor_state=not options.no_store_editor_state,
  File "c:\userslocal\nikolaus.waxweiler\development\glyphslib\lib\glyphsLib\__init__.py", line 110, in build_masters
    font = GSFont(filename)
  File "c:\userslocal\nikolaus.waxweiler\development\glyphslib\lib\glyphsLib\classes.py", line 3204, in __init__
    p.parse_into_object(self, fp.read())
  File "c:\userslocal\nikolaus.waxweiler\development\glyphslib\lib\glyphsLib\parser.py", line 63, in parse_into_object
    i = self._parse_dict_into_object(res, text, 1)
  File "c:\userslocal\nikolaus.waxweiler\development\glyphslib\lib\glyphsLib\parser.py", line 164, in _parse_dict_into_object
    result = self._parse(text, i)
  File "c:\userslocal\nikolaus.waxweiler\development\glyphslib\lib\glyphsLib\parser.py", line 101, in _parse
    return self._parse_list(text, i)
  File "c:\userslocal\nikolaus.waxweiler\development\glyphslib\lib\glyphsLib\parser.py", line 191, in _parse_list
    list_item, i = self._parse(text, i)
  File "c:\userslocal\nikolaus.waxweiler\development\glyphslib\lib\glyphsLib\parser.py", line 95, in _parse
    return self._parse_dict(text, i)
  File "c:\userslocal\nikolaus.waxweiler\development\glyphslib\lib\glyphsLib\parser.py", line 148, in _parse_dict
    i = self._parse_dict_into_object(res, text, i)
  File "c:\userslocal\nikolaus.waxweiler\development\glyphslib\lib\glyphsLib\parser.py", line 164, in _parse_dict_into_object
    result = self._parse(text, i)
  File "c:\userslocal\nikolaus.waxweiler\development\glyphslib\lib\glyphsLib\parser.py", line 101, in _parse
    return self._parse_list(text, i)
  File "c:\userslocal\nikolaus.waxweiler\development\glyphslib\lib\glyphsLib\parser.py", line 191, in _parse_list
    list_item, i = self._parse(text, i)
  File "c:\userslocal\nikolaus.waxweiler\development\glyphslib\lib\glyphsLib\parser.py", line 95, in _parse
    return self._parse_dict(text, i)
  File "c:\userslocal\nikolaus.waxweiler\development\glyphslib\lib\glyphsLib\parser.py", line 148, in _parse_dict
    i = self._parse_dict_into_object(res, text, i)
  File "c:\userslocal\nikolaus.waxweiler\development\glyphslib\lib\glyphsLib\parser.py", line 164, in _parse_dict_into_object
    result = self._parse(text, i)
  File "c:\userslocal\nikolaus.waxweiler\development\glyphslib\lib\glyphsLib\parser.py", line 101, in _parse
    return self._parse_list(text, i)
  File "c:\userslocal\nikolaus.waxweiler\development\glyphslib\lib\glyphsLib\parser.py", line 191, in _parse_list
    list_item, i = self._parse(text, i)
  File "c:\userslocal\nikolaus.waxweiler\development\glyphslib\lib\glyphsLib\parser.py", line 95, in _parse
    return self._parse_dict(text, i)
  File "c:\userslocal\nikolaus.waxweiler\development\glyphslib\lib\glyphsLib\parser.py", line 148, in _parse_dict
    i = self._parse_dict_into_object(res, text, i)
  File "c:\userslocal\nikolaus.waxweiler\development\glyphslib\lib\glyphsLib\parser.py", line 164, in _parse_dict_into_object
    result = self._parse(text, i)
  File "c:\userslocal\nikolaus.waxweiler\development\glyphslib\lib\glyphsLib\parser.py", line 123, in _parse
    value = self.current_type(value)
  File "c:\userslocal\nikolaus.waxweiler\development\glyphslib\lib\glyphsLib\types.py", line 50, in __init__
    self.value = self.fromString(value)
  File "c:\userslocal\nikolaus.waxweiler\development\glyphslib\lib\glyphsLib\types.py", line 177, in fromString
    return [int(i) for i in elements]
  File "c:\userslocal\nikolaus.waxweiler\development\glyphslib\lib\glyphsLib\types.py", line 177, in <listcomp>
    return [int(i) for i in elements]
ValueError: invalid literal for int() with base 10: 'lsb'

What else do we need to implement here?

@schriftgestalt
Copy link
Collaborator Author

The hint.originIndex can start be "lsb" or "rsb" instead of an int. I didn't like some obscure int constants. This makes it easier to read for humans but less so for machines it seems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants