UFOReader: always expect contents.plist
This commit is contained in:
parent
8d2a3ae6d2
commit
8ca141852d
@ -683,13 +683,7 @@ class UFOReader(_UFOBaseIO):
|
|||||||
# this will already have been raised during __init__
|
# this will already have been raised during __init__
|
||||||
raise UFOLibError("The default layer is not defined in layercontents.plist.")
|
raise UFOLibError("The default layer is not defined in layercontents.plist.")
|
||||||
|
|
||||||
def getGlyphSet(
|
def getGlyphSet(self, layerName=None, validateRead=None, validateWrite=None):
|
||||||
self,
|
|
||||||
layerName=None,
|
|
||||||
validateRead=None,
|
|
||||||
validateWrite=None,
|
|
||||||
expectContentsFile=False
|
|
||||||
):
|
|
||||||
"""
|
"""
|
||||||
Return the GlyphSet associated with the
|
Return the GlyphSet associated with the
|
||||||
glyphs directory mapped to layerName
|
glyphs directory mapped to layerName
|
||||||
@ -701,10 +695,6 @@ class UFOReader(_UFOBaseIO):
|
|||||||
class's validate value, can be overridden.
|
class's validate value, can be overridden.
|
||||||
``validateWrite`` will validate the written data, by default it is set to the
|
``validateWrite`` will validate the written data, by default it is set to the
|
||||||
class's validate value, can be overridden.
|
class's validate value, can be overridden.
|
||||||
``expectContentsFile`` will raise a GlifLibError if a contents.plist file is
|
|
||||||
not found on the glyph set file system. This should be set to ``True`` if you
|
|
||||||
are reading an existing UFO and ``False`` if you use ``getGlyphSet`` to create
|
|
||||||
a fresh glyph set.
|
|
||||||
"""
|
"""
|
||||||
from fontTools.ufoLib.glifLib import GlyphSet
|
from fontTools.ufoLib.glifLib import GlyphSet
|
||||||
|
|
||||||
@ -733,7 +723,7 @@ class UFOReader(_UFOBaseIO):
|
|||||||
ufoFormatVersion=self._formatVersion,
|
ufoFormatVersion=self._formatVersion,
|
||||||
validateRead=validateRead,
|
validateRead=validateRead,
|
||||||
validateWrite=validateWrite,
|
validateWrite=validateWrite,
|
||||||
expectContentsFile=expectContentsFile
|
expectContentsFile=True
|
||||||
)
|
)
|
||||||
|
|
||||||
def getCharacterMapping(self, layerName=None, validate=None):
|
def getCharacterMapping(self, layerName=None, validate=None):
|
||||||
|
@ -3946,7 +3946,7 @@ class UFO3WriteLayersTestCase(unittest.TestCase):
|
|||||||
|
|
||||||
reader = UFOReader(self.ufoPath, validate=True)
|
reader = UFOReader(self.ufoPath, validate=True)
|
||||||
with self.assertRaises(GlifLibError):
|
with self.assertRaises(GlifLibError):
|
||||||
reader.getGlyphSet("layer 1", expectContentsFile=True)
|
reader.getGlyphSet("layer 1")
|
||||||
|
|
||||||
writer = UFOWriter(self.ufoPath, validate=True)
|
writer = UFOWriter(self.ufoPath, validate=True)
|
||||||
with self.assertRaises(GlifLibError):
|
with self.assertRaises(GlifLibError):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user