Skip to content

Commit

Permalink
Fix variable name, add and remove some comments
Browse files Browse the repository at this point in the history
  • Loading branch information
ollimeier committed Jan 22, 2025
1 parent e4e097e commit f1fc7e0
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
7 changes: 3 additions & 4 deletions src/fontra_glyphs/backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,7 @@ async def getGlyph(self, glyphName: str) -> VariableGlyph | None:
gsLayers = sorted(
gsLayers, key=lambda i_gsLayer: masterOrder[i_gsLayer[1].associatedMasterId]
)

seenLocations = []
for i, gsLayer in gsLayers:
braceLocation = self._getBraceLayerLocation(gsLayer)
Expand Down Expand Up @@ -810,9 +811,7 @@ def fontraLayerToGSLayer(layer, gsLayer):
gsLayer.components = [
fontraComponentToGSComponent(component) for component in layer.glyph.components
]
gsLayer.anchors = [
fontraAnchorsToGSAnchor(anchor) for anchor in layer.glyph.anchors
]
gsLayer.anchors = [fontraAnchorToGSAnchor(anchor) for anchor in layer.glyph.anchors]


def fontraComponentToGSComponent(component):
Expand All @@ -824,7 +823,7 @@ def fontraComponentToGSComponent(component):
return gsComponent


def fontraAnchorsToGSAnchor(anchor):
def fontraAnchorToGSAnchor(anchor):
gsAnchor = glyphsLib.classes.GSAnchor()
gsAnchor.name = anchor.name
gsAnchor.position.x = anchor.x
Expand Down
9 changes: 4 additions & 5 deletions src/fontra_glyphs/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,10 @@ def getAssociatedMasterId(gsGlyph, gsLocation):


def gsFormatting(content):
# openstep_plist.dump changes the whole formatting, therefore
# it's very diffucute to see what has changed.
# This function is a very bad try to get close to how the formatting
# looks like for a .glyphs file.
# There must be a better solution, but this is better than nothing.
# TODO: This need a different solution.
# Should be solved in the raw data not via regular expressions.
# The raw data is made out of list. We need to convert some part into tuples.
# For more please see: https://github.com/fonttools/openstep-plist/issues/33

patterns = [
(
Expand Down
2 changes: 2 additions & 0 deletions tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ async def test_getLocationFromSources(testFont):


def test_getAssociatedMasterId(testGSFont):
# TODO: need more complex test with at least two axes,
# then improvement getAssociatedMasterId
gsGlyph = testGSFont.glyphs["a"]
associatedMasterId = getAssociatedMasterId(gsGlyph, [155])
associatedMaster = gsGlyph.layers[associatedMasterId]
Expand Down

0 comments on commit f1fc7e0

Please sign in to comment.