def drawGlyph(glyph):
    if hasattr(glyph, "getRepresentation"):
        path = glyph.getRepresentation("defconAppKit.NSBezierPath")
    else:
        pen = CocoaPen(glyph.getParent())
        glyph.draw(pen)
        path = pen.path
    _drawBotDrawingTool.drawPath(path)
예제 #2
0
def drawGlyph(glyph):
    if hasattr(glyph, "getRepresentation"):
        path = glyph.getRepresentation("defconAppKit.NSBezierPath")
    else:
        pen = CocoaPen(glyph.getParent())
        glyph.draw(pen)
        path = pen.path
    _drawBotDrawingTool.drawPath(path)
def drawGlyph(glyph):
	BezierPath = glyph._layer.bezierPath
	if BezierPath != None:
		BezierPath = BezierPath.copy()
	else:
		BezierPath = NSBezierPath.bezierPath()
	OpenBezierPath = glyph._layer.openBezierPath
	if OpenBezierPath:
		BezierPath.appendBezierPath_(OpenBezierPath)
	for currComponent in glyph._layer.components:
		BezierPath.appendBezierPath_(currComponent.bezierPath)
	_drawBotDrawingTool.drawPath(BezierPath)
예제 #4
0
def drawGlyph(glyph):
	BezierPath = glyph._layer.bezierPath()
	if BezierPath != None:
		BezierPath = BezierPath.copy()
	else:
		BezierPath = NSBezierPath.bezierPath()
	OpenBezierPath = glyph._layer.openBezierPath()
	if OpenBezierPath:
		BezierPath.appendBezierPath_(OpenBezierPath)
	for currComponent in glyph._layer.components:
		BezierPath.appendBezierPath_(currComponent.bezierPath())
	_drawBotDrawingTool.drawPath(BezierPath)
예제 #5
0
 def draw(self):
     have_path = False
     for c, p in self.commands:
         if c == "IN":
             _drawBotDrawingTool.newPage(self.width, self.height)
             _drawBotDrawingTool.fill(None)
             _drawBotDrawingTool.save()
             _drawBotDrawingTool.fill(1, 1, 0, 0.1)
             _drawBotDrawingTool.rect(0, 0, self.width, self.height)
             _drawBotDrawingTool.strokeWidth(1)
             _drawBotDrawingTool.stroke(0)
             _drawBotDrawingTool.restore()
             _drawBotDrawingTool.scale(72/1016)
         elif c == "PU":
             if self.debug:
                 print c, p
             if have_path:
                 if len(p) < 2:
                     if self.debug:
                         print "    endPath"
                     path.endPath()
                     _drawBotDrawingTool.drawPath(path)
                     have_path = False
                 else:
                     if self.debug:
                         print "    endPath"
                     path.endPath()
                     _drawBotDrawingTool.drawPath(path)
                     if self.debug:
                         print "    moveTo", p[-2], p[-1]
                     path.moveTo((p[-2], p[-1]))
             else:
                 if len(p) > 1:
                     if self.debug:
                         print "    moveTo", p[0], p[1]
                     path = _drawBotDrawingTool.BezierPath()
                     path.moveTo((p[-2], p[-1]))
                     have_path = True
                 else:
                     if self.debug:
                         print "    NO-OP"
                     have_path = False
         elif c == "PD":
             if p:
                 pt = [None, None]
                 for i, coord in enumerate(p):
                     pt[i%2] = coord
                     if i%2 == 1:
                         if self.debug:
                             print "    lineTo", pt[0], pt[1]
                         path.lineTo((pt[0], pt[1]))
         #elif c == "SC":
         #    if len(p) == 4:
         #        newPage(p[2], p[3])
         #        fill(None)
         #        save()
         #        fill(1, 1, 0, 0.1)
         #        rect(0, 0, p[2], p[3])
         #        strokeWidth(1)
         #        stroke(0)
         #        restore()
         elif c == "SP":
             if self.debug:
                 print c, p
             if have_path:
                 if self.debug:
                     print "    endPath (due to SP)"
                 path.endPath()
                 _drawBotDrawingTool.drawPath(path)
                 have_path = False
             if len(p) == 1:
                 pen_index = int(p[0])
                 for c, i in HPGLPenColors.items():
                     if i == pen_index:
                         _drawBotDrawingTool.stroke(*c)
                         if self.debug:
                             print "    stroke", c
             else:
                 _drawBotDrawingTool.stroke(None)
                 if self.debug:
                     print "    stroke", None
예제 #6
0
def drawGlyph(glyph):
	pen = CocoaPen(glyph._glyphset)
	glyph.draw(pen)
	path = pen.path
	_drawBotDrawingTool.drawPath(path)
예제 #7
0
def drawGlyph(glyph):
    pen = CocoaPen(glyph._glyphset)
    glyph.draw(pen)
    path = pen.path
    _drawBotDrawingTool.drawPath(path)
예제 #8
0
def drawGlyph(glyph):
    pen = CocoaPen(glyph.getParent())
    glyph.draw(pen)
    path = pen.path
    _drawBotDrawingTool.drawPath(path)