def draw(self, info): if not self.calculatePreview: return cur = CurrentGlyph() if cur == None: return scale = info['scale'] layerToConvert = self.layers[self.w.layerPopup.get()] otherLayer = layerToConvert != 'foreground' if (not otherLayer) and ( CurrentFont().lib['com.typemytype.robofont.segmentType'] == 'qcurve'): return if otherLayer: cur.flipLayers('foreground', layerToConvert) copy = cur.copy() if otherLayer: cur.flipLayers('foreground', layerToConvert) convert(copy, self.maxDistanceValue, self.minLengthValue, self.useArcLength) for c in copy: for p in c.points: if p.type == 'offCurve': color = OffColor r = 4 * scale else: color = OnColor r = 6 * scale self.drawDiscAtPoint(r, p.x, p.y, color) save() stroke(0.2, .8, .8, 1) fill(None) strokeWidth(scale) drawGlyph(copy) restore()
def draw(self, info): if not self.calculatePreview: return cur = CurrentGlyph() if cur == None: return; scale = info['scale'] layerToConvert = self.layers[self.w.layerPopup.get()] otherLayer = layerToConvert != 'foreground' if (not otherLayer) and (CurrentFont().lib['com.typemytype.robofont.segmentType'] == 'qcurve'): return if otherLayer: cur.flipLayers('foreground', layerToConvert) copy = cur.copy() if otherLayer: cur.flipLayers('foreground', layerToConvert) convert(copy, self.maxDistanceValue, self.minLengthValue, self.useArcLength) for c in copy: for p in c.points: if p.type == 'offCurve': color = OffColor r = 4*scale else: color = OnColor r = 6*scale self.drawDiscAtPoint(r, p.x, p.y, color) save() stroke(0.2, .8, .8, 1) fill(None) strokeWidth(scale) drawGlyph(copy) restore()
def convertCurrentGlyphCallback(self, sender): g = CurrentGlyph() if None == g: return layerToConvert = self.layers[self.w.layerPopup.get()] if layerToConvert == 'foreground': Message("I can only convert contours from a layer different from 'foreground'.") return g.flipLayers('foreground', layerToConvert) g.copyToLayer(layerToConvert) convert(g, self.maxDistanceValue, self.minLengthValue, self.useArcLength) CurrentFont().changed() UpdateCurrentGlyphView()
def convertCurrentGlyphCallback(self, sender): g = CurrentGlyph() if None == g: return layerToConvert = self.layers[self.w.layerPopup.get()] if layerToConvert == 'foreground': Message( "I can only convert contours from a layer different from 'foreground'." ) return g.flipLayers('foreground', layerToConvert) g.copyToLayer(layerToConvert) convert(g, self.maxDistanceValue, self.minLengthValue, self.useArcLength) CurrentFont().changed() UpdateCurrentGlyphView()