Skip to content

Commit

Permalink
Merge pull request #3373 from fonttools/fix-ds5-diagram
Browse files Browse the repository at this point in the history
Fix #3369: sources should not allow anisotropic location
  • Loading branch information
belluzj committed Dec 6, 2023
2 parents 203346a + 6a16be3 commit 4dbf534
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
Binary file modified Doc/source/designspaceLib/v5_class_diagram.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion Doc/source/designspaceLib/v5_class_diagram.puml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
....
Expand Down
8 changes: 3 additions & 5 deletions Lib/fontTools/designspaceLib/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ def location(self):
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"):
Expand All @@ -329,15 +329,13 @@ def getFamilyName(self, languageCode="en"):
"""
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]
Expand Down

0 comments on commit 4dbf534

Please sign in to comment.