I’d love the ability to convert multiple line segments into curve segments. My habit is to put down all nodes at once first. So for example in a glyph like S
, there is a lot of Option-Clicking to do. Is this a feature that exists somewhere?
That is currently not possible. And there will always be segments (except in an “o”) that doesn’t need curves. So I wonder what is more efficient: Adding all needed segments one by one or converting all and removing the unneeded ones.
There a script which does that.
Will post once I get to my laptop.
#MenuTitle: Curve All Straights
# -*- coding: utf-8 -*-
__doc__="""
Turn corners into smooths (useful when tracing)
"""
import GlyphsApp
from Foundation import NSPoint
def lerp(t, a, b):
return NSPoint(int((1-t)*a.x + t*b.x), int((1-t)*a.y + t*b.y))
Layer = Glyphs.font.selectedLayers[0]
testSelection = len(Layer.selection) > 0
for p in Layer.paths:
if p.closed:
start = -1
else:
start = 0
for idx in range(len(p.nodes) - 1, start, -1):
node = p.nodes[idx]
if testSelection and not node.selected:
continue
if node.type == LINE:
prevNode = p.nodes[idx - 1]
off1 = GSNode(lerp(0.33, prevNode.position, node.position), OFFCURVE)
off2 = GSNode(lerp(0.66, prevNode.position, node.position), OFFCURVE)
p.nodes.insert(idx, off2)
p.nodes.insert(idx, off1)
node.type = CURVE
# node.connection = GSSMOOTH
hope this code is helpful.