designspaceLib: add examples to loadSourceFonts docstring

This commit is contained in:
Cosimo Lupo 2019-05-10 18:43:42 +01:00
parent 338793d055
commit 175399ecbc
No known key found for this signature in database
GPG Key ID: 20D4A261E4A0E642

View File

@ -1272,6 +1272,15 @@ class DesignSpaceDocument(LogMixin, AsDictMixin):
If the font attribute is already not None, it is not loaded again. If the font attribute is already not None, it is not loaded again.
Fonts with the same path are only loaded once and shared among SourceDescriptors. Fonts with the same path are only loaded once and shared among SourceDescriptors.
For example, to load UFO sources using defcon:
designspace = DesignSpaceDocument.fromfile("path/to/my.designspace")
designspace.loadSourceFonts(defcon.Font)
Or to load masters as FontTools binary fonts, including extra options:
designspace.loadSourceFonts(ttLib.TTFont, recalcBBoxes=False)
Args: Args:
opener (Callable): takes one required positional argument, the source.path, opener (Callable): takes one required positional argument, the source.path,
and an optional list of keyword arguments, and returns a new font object and an optional list of keyword arguments, and returns a new font object