def _load_dcanchor(dcanchor, glyph): anchor = Anchor() anchor._glyph = glyph anchor.name = dcanchor.name anchor.color = dcanchor.color anchor.x = dcanchor.x anchor.y = dcanchor.y return anchor
def _load_gsanchor(gsanchor, glyph): anchor = Anchor() anchor._glyph = glyph anchor.x = gsanchor.position.x anchor.y = gsanchor.position.y anchor.name = gsanchor.name return anchor
def _load_ttanchors(font, ttfont, ff=None): if not "GPOS" in ttfont: return t = ttfont["GPOS"].table # Do cursive first cursives = filter(lambda x: x.LookupType == 3, t.LookupList.Lookup) for c in cursives: for s in c.SubTable: for glyph, record in zip(s.Coverage.glyphs, s.EntryExitRecord): if record.EntryAnchor: entryAnchor = Anchor() entryAnchor._glyph = glyph entryAnchor.x = record.EntryAnchor.XCoordinate entryAnchor.y = record.EntryAnchor.YCoordinate entryAnchor.name = "entry" font[glyph]._anchors.append(entryAnchor) if record.ExitAnchor: exitAnchor = Anchor() exitAnchor._glyph = glyph exitAnchor.x = record.ExitAnchor.XCoordinate exitAnchor.y = record.ExitAnchor.YCoordinate exitAnchor.name = "exit" font[glyph]._anchors.append(exitAnchor)
def _appendAnchor(self, name, **kwargs): self._anchors.append(Anchor(name=name, **kwargs))