def buildLigGlyph(coords, points): """([500], [4]) --> otTables.LigGlyph; None for empty coords/points""" carets = [] if coords: carets.extend([buildCaretValueForCoord(c) for c in sorted(coords)]) if points: carets.extend([buildCaretValueForPoint(p) for p in sorted(points)]) if not carets: return None self = ot.LigGlyph() self.CaretValue = carets self.CaretCount = len(self.CaretValue) return self
def makeCaretList(carets, font): self = ot.LigCaretList() self.Coverage = makeCoverage(carets.keys(), font) records = [] for glyph in self.Coverage.glyphs: record = ot.LigGlyph() cvs = record.CaretValue = [] for v in carets[glyph]: cv = ot.CaretValue() cv.Format = 1 cv.Coordinate = v cvs.append(cv) record.CaretCount = len(record.CaretValue) records.append(record) self.LigGlyph = records self.LigGlyphCount = len(records) return self