diff --git a/Lib/glyphsLib/classes.py b/Lib/glyphsLib/classes.py index 4e1daf280..85a30980a 100755 --- a/Lib/glyphsLib/classes.py +++ b/Lib/glyphsLib/classes.py @@ -27,6 +27,7 @@ ValueType, Transform, Point, + IndexPath, Rect, parse_datetime, parse_color, @@ -244,7 +245,7 @@ def parse_hint_target(line=None): if line is None: return None if line[0] == "{": - return Point(line) + return IndexPath(line) else: return line @@ -2145,9 +2146,9 @@ class GSHint(GSBase): _classesForName = { "horizontal": bool, "options": int, # bitfield - "origin": Point, # Index path to node - "other1": Point, # Index path to node for third node - "other2": Point, # Index path to node for fourth node + "origin": IndexPath, # Index path to node + "other1": IndexPath, # Index path to node for third node + "other2": IndexPath, # Index path to node for fourth node "place": Point, # (position, width) "scale": Point, # for corners "stem": int, # index of stem diff --git a/Lib/glyphsLib/types.py b/Lib/glyphsLib/types.py old mode 100644 new mode 100755 index 4f391301e..e2e78f00a --- a/Lib/glyphsLib/types.py +++ b/Lib/glyphsLib/types.py @@ -157,6 +157,17 @@ def y(self, value): self.rect.value[1] = value +class IndexPath(Vector(4)): + def __repr__(self): + return "".format(", ".join([str(i) for i in self.value])) + + def fromString(self, line): + src = line[1:-1] + elements = src.split(", ") + self.dimension = len(elements) + return [int(i) for i in elements] + + class Size(Point): def __repr__(self): return "".format(self.value[0], self.value[1])