def drawMedialAxes(self, layer): '''Draw the medial axes (水平垂直轴线).''' # TODO: set vertical and horizontal in dialog vertical = 0.5 horizontal = 0.5 scale = self.getScale() view = Glyphs.font.currentTab.graphicView() visibleRect = view.visibleRect() activePosition = view.activePosition() viewOriginX = (visibleRect.origin.x - activePosition.x) / scale viewOriginY = (visibleRect.origin.y - activePosition.y) / scale viewWidth = visibleRect.size.width / scale viewHeight = visibleRect.size.height / scale height = layer.ascender - layer.descender width = layer.width x = horizontal * width y = layer.descender + vertical * height # TODO: color color = NSColor.systemGreenColor() color.set() path = NSBezierPath.bezierPath() path.moveToPoint_((viewOriginX, y)) path.lineToPoint_((viewOriginX + viewWidth, y)) path.moveToPoint_((x, viewOriginY)) path.lineToPoint_((x, viewOriginY + viewHeight)) path.setLineWidth_(1 / scale) path.stroke()