Ejemplo n.º 1
0
    def addAnchors(self, glyph, base):
        anchors = base.anchors
        glyph.clearAnchors()
        if glyph.name == 'uniE272':
            m = 1
        markAnchors = [
            'markAbove', 'markBelow', 'markAbove_1', 'markAbove_2',
            'markBelow_1', 'markBelow_2', '_markAbove', '_markBelow',
            '_markAbove_1', '_markAbove_2', '_markBelow_1', '_markBelow_2',
            '_hamzaAbove', 'hamzaAbove', '_hamzaBelow', 'hamzaBelow'
            # 'markAboveMark','markBelowMark','_markAboveMark','_markBelowMark'
        ]
        if len(anchors):
            for anchor in anchors:
                if anchor.name in markAnchors:
                    anc = glyph.instantiateAnchor()
                    anc.x = anchor.x
                    anc.y = anchor.y
                    anc.name = anchor.name
                    glyph.appendAnchor(anc)

                    c = Contour()
                    c.addPoint((anchor.x, anchor.y),
                               name=anchor.name,
                               segmentType="move")
                    glyph.appendContour(c)

                else:
                    continue
Ejemplo n.º 2
0
 def createAnchors(self):
     factor = self.getFactorOfUPM()
     for g in self.UFO:
         try:
             sampleGlyph = self.templateUFO[g.name]
             g.anchors = copy.deepcopy(sampleGlyph.anchors)
             for point in g.anchors:
                 point.x *= factor
                 point.y *= factor
             for point in sampleGlyph.anchors:
                 xVal = point.x * factor
                 yVal = point.y * factor
                 c = Contour()
                 c.addPoint((xVal, yVal), name=point.name, segmentType="move")
                 g.appendContour(c)
         except:
             pass