Skip to content

Commit

Permalink
Use getAnchor to get variable ligcarets
Browse files Browse the repository at this point in the history
  • Loading branch information
simoncozens authored and anthrotype committed Jan 10, 2024
1 parent 30b6be6 commit 809324f
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions Lib/ufo2ft/featureWriters/gdefFeatureWriter.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from fontTools.misc.fixedTools import otRound

from ufo2ft.featureWriters import BaseFeatureWriter, ast


Expand Down Expand Up @@ -55,16 +57,21 @@ def _getLigatureCarets(self):
and anchor.name.startswith("caret_")
and anchor.x is not None
):
glyphCarets.add(round(anchor.x))
glyphCarets.add(self._getAnchor(glyphName, anchor.name)[0])
elif (
anchor.name
and anchor.name.startswith("vcaret_")
and anchor.y is not None
):
glyphCarets.add(round(anchor.y))
glyphCarets.add(self._getAnchor(glyphName, anchor.name)[1])

if glyphCarets:
carets[glyphName] = sorted(glyphCarets)
if self.context.isVariable:
carets[glyphName] = sorted(
glyphCarets, key=lambda caret: list(caret.values.values())[0]
)
else:
carets[glyphName] = [otRound(c) for c in sorted(glyphCarets)]

return carets

Expand Down

0 comments on commit 809324f

Please sign in to comment.