Ejemplo n.º 1
0
    def build(self):
        st = otTables.MarkLigPos()
        st.Format = 1
        st.MarkCoverage = \
            self.buildCoverage_(self.marks, otTables.MarkCoverage)
        markClasses = self.buildMarkClasses_(self.marks)
        st.ClassCount = len(markClasses)
        self.setMarkArray_(self.marks, markClasses, st)

        st.LigatureCoverage = \
            self.buildCoverage_(self.ligatures, otTables.LigatureCoverage)
        st.LigatureArray = otTables.LigatureArray()
        st.LigatureArray.LigatureCount = len(self.ligatures)
        st.LigatureArray.LigatureAttach = []
        for lig in st.LigatureCoverage.glyphs:
            components = self.ligatures[lig]
            attach = otTables.LigatureAttach()
            attach.ComponentCount = len(components)
            attach.ComponentRecord = []
            for component in components:
                crec = otTables.ComponentRecord()
                attach.ComponentRecord.append(crec)
                crec.LigatureAnchor = []
                for markClass in sorted(markClasses.keys(),
                                        key=markClasses.get):
                    crec.LigatureAnchor.append(component.get(markClass))
            st.LigatureArray.LigatureAttach.append(attach)

        return self.buildLookup_([st])
Ejemplo n.º 2
0
def buildLigatureArray(ligs, numMarkClasses, glyphMap):
    self = ot.LigatureArray()
    self.LigatureAttach = []
    for lig in sorted(ligs, key=glyphMap.__getitem__):
        anchors = []
        for component in ligs[lig]:
            anchors.append([component.get(mc) for mc in range(numMarkClasses)])
        self.LigatureAttach.append(buildLigatureAttach(anchors))
    self.LigatureCount = len(self.LigatureAttach)
    return self