Skip to content

Commit

Permalink
getGlobalPortionOfLocation() must return a full location, not sparse
Browse files Browse the repository at this point in the history
  • Loading branch information
justvanrossum committed Sep 4, 2023
1 parent 8ecddfc commit 7bc46f9
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions src/fontra/backends/designspace.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,9 @@ def _unpackLocalDesignSpace(self, dsDict, defaultLayerName):
)

sourceLocation = {**self.defaultLocation, **source["location"]}
globalLocation = getGlobalPortionOfLocation(sourceLocation, localAxisNames)
globalLocation = self._getGlobalPortionOfLocation(
sourceLocation, localAxisNames
)
dsSource = self.dsSources.findItem(
locationTuple=tuplifyLocation(globalLocation)
)
Expand Down Expand Up @@ -385,7 +387,9 @@ async def putGlyph(self, glyphName, glyph, unicodes):

def _prepareUFOSourceLayer(self, source, localAxisNames, revLayerNameMapping):
sourceLocation = {**self.defaultLocation, **source.location}
globalLocation = getGlobalPortionOfLocation(sourceLocation, localAxisNames)
globalLocation = self._getGlobalPortionOfLocation(
sourceLocation, localAxisNames
)

dsSource = self.dsSources.findItem(
locationTuple=tuplifyLocation(globalLocation)
Expand Down Expand Up @@ -503,6 +507,14 @@ def _newUFOLayer(self, ufoPath, suggestedLayerName):

return ufoLayer

def _getGlobalPortionOfLocation(self, location, localAxisNames):
globalLocation = {
name: value
for name, value in location.items()
if name not in localAxisNames
}
return {**self.defaultLocation, **globalLocation}

async def getGlobalAxes(self):
return self.axes

Expand Down Expand Up @@ -936,9 +948,3 @@ def glyphHasVariableComponents(glyph):
for layer in glyph.layers.values()
for compo in layer.glyph.components
)


def getGlobalPortionOfLocation(location, localAxisNames):
return {
name: value for name, value in location.items() if name not in localAxisNames
}

0 comments on commit 7bc46f9

Please sign in to comment.