Exemple #1
0
 def open(cls, path, lazy=True, validate=True):
     reader = UFOReader(path, validate=validate)
     self = cls.read(reader, lazy=lazy)
     self._path = path
     self._fileStructure = reader.fileStructure
     if lazy:
         # keep the reader around so we can close it when done
         self._reader = reader
     else:
         reader.close()
     return self
Exemple #2
0
    def open(cls, path: PathLike, lazy: bool = True, validate: bool = True,) -> "Font":
        """Instantiates a new Font object from a path to a UFO.

        Args:
            path: The path to the UFO to load.
            lazy: If True, load glyphs, data files and images as they are accessed. If
                False, load everything up front.
            validate: If True, enable UFO data model validation during loading. If
                False, load whatever is deserializable.
        """
        reader = UFOReader(path, validate=validate)
        self = cls.read(reader, lazy=lazy)
        self._path = path
        if not lazy:
            reader.close()
        return self