Merge pull request #3373 from fonttools/fix-ds5-diagram

Fix #3369: sources should not allow anisotropic location
This commit is contained in:
Jany Belluz 2023-12-06 13:26:29 +01:00 committed by GitHub
commit 4dbf534bc2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 6 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 267 KiB

After

Width:  |  Height:  |  Size: 283 KiB

View File

@ -112,7 +112,7 @@ class Source {
+ path: str
+ layerName: Optional[str]
+ <color:brown><s><<Deprecated>> location: Location
+ <color:green><b><<New>> designLocation: AnisotropicLocation
+ <color:green><b><<New>> designLocation: SimpleLocation
....
+ font: Optional[Font]
....

View File

@ -312,7 +312,7 @@ class SourceDescriptor(SimpleDescriptor):
return self.designLocation
@location.setter
def location(self, location: Optional[AnisotropicLocationDict]):
def location(self, location: Optional[SimpleLocationDict]):
self.designLocation = location or {}
def setFamilyName(self, familyName, languageCode="en"):
@ -329,15 +329,13 @@ class SourceDescriptor(SimpleDescriptor):
"""
return self.localisedFamilyName.get(languageCode)
def getFullDesignLocation(
self, doc: "DesignSpaceDocument"
) -> AnisotropicLocationDict:
def getFullDesignLocation(self, doc: "DesignSpaceDocument") -> SimpleLocationDict:
"""Get the complete design location of this source, from its
:attr:`designLocation` and the document's axis defaults.
.. versionadded:: 5.0
"""
result: AnisotropicLocationDict = {}
result: SimpleLocationDict = {}
for axis in doc.axes:
if axis.name in self.designLocation:
result[axis.name] = self.designLocation[axis.name]