Hotkey to select *only* off-curve nodes in a marquee selection?

Is there a hotkey/way to select only off-curve nodes in a marquee selection?

E.g. in RoboFont, if I hold option while dragging my mouse to make a marquee selection, I only select offcurves. This is a small thing, but really speeds up my flow.

Thanks!

You could Option-drag to select all on-curve points and then press Command-Option-Shift-I (or choose View → Invert Selection) to only select the off-curve points. This could also be solved in a single step with a script.

Thanks, Florian! That seems close, but not quite what I’m asking for. I don’t want to select all off-curve points – just a way to quickly select the ones I want by dragging a box. But, if oncurve points are in the way of that box, I don’t necessarily want to select them.

Here is a script that reduces the selected points to only off-curve points.

for layer in Font.selectedLayers:
	for path in layer.paths:
		for point in path.nodes:
			point.selected = point.selected and point.type == OFFCURVE

Drag to select and then run this script to reduce the selection.

You can try it by pasting the code into the Macro panel …

… or create a script and assign a shortcut for quick access.

2 Likes

Oh dang, nice!

Hmm, okay, slightly off-topic, but the last line of your script is surprising to me … I would expect that to need an if block first, e.g. something like:

if point.selected and point.type == OFFCURVE:
    point.selected = true

Is that a Python shortcut, or something specific to the Glyphs API?

The thing between the if and the : is evaluates to a boolean True or False. But because point.selected is a boolean, you can assign the expression directly to point.selected.

So

if a and (b == c or d > 5):
    x = True
else:
    x = False

can be written as:

x = a and (b == c or d > 5)

That is super cool! I didn’t realize until just now.

I also tested this in my terminal Python. Nice.

>>> value = 1 == 1 and 3 > 2
>>> print(value)
True

Cheers, Florian!

You can also first drag select with Option key down, then drag select again the same rect with Shift key down.

1 Like

Thanks, @GeorgSeifert! That may take some getting used to, but that is really helpful, and I’ll remember it next time I’m in Glyphs. Just so I’m understanding it properly, it seems that…

  • holding option while dragging selects only on-curve points
  • holding shift while dragging selects all points that aren’t selected, and de-selects points that are

Is that accurate?

Yes.

1 Like