In a variable font, I’m trying to move a collection of single-handle nodes such that the nodes sit on top of their handles (handles then having zero length) at a certain axis value. Has anyone had scripting experience with moving nodes while keeping handles stationary?
You can move the node without is handle by holding the Option key.
But you need to understand that currently, variable fonts use TrueType curves. And converting curves that have zero length handles to TrueType can lead to unexpected results.
Hi, I’m new to Glyphs 3 (great software btw), I have a similar situation as to the original poster, but not quite. I’m designing a variable typeface, with one ‘angular’ master and one ‘curvy’ master. I’m using the finalised curved master as a template for the angled master. On the angled master, I am moving every single handle of every single node to be ontop of each of thier respective nodes, making glyphs with no curves at all. This works in an exported test, but I’m wondering if there is a way of automating or scripting such a laborious process. It would save a lot of time if I could ‘snap’ the handles of each node to be ontop of the node itself. Does anything like that exist for Glyphs 3?
Are you familiar/comfortable with Python? The Glyphs scripting API is very well documented.
I would do the following:
For every path:
For every node:
Check whether it’s an offcurve node
Determine the oncurve node attached to it (either the previous or next node)
Copy that position for the oncurve node in question
Heck, here you go (written on mobile, can’t test right now):
for p in Layer.paths:
for n in p.nodes:
if n.type != OFFCURVE:
continue
if n.prevNode.type != OFFCURVE:
pos = n.prevNode.position
elif n.nextNode.type != OFFCURVE:
pos = n.nextNode.position
n.position = pos
I think this should work.
Thankyou, I’m not familiar but based on the fact that you think it should be possible, I will look into it. I just wasn’t sure if there was something out there already.