Export Excluding CAP/Corner Components

Is there a way to export the font excluding the cap/corner components without manually removing them?
Thanks!

You could write a filter that does that and run it as a Prefilter parameter.

1 Like

I may have expressed myself badly. I would like to remove each of the corner/cap instances within each letter that has them (say removing all smooth corners from each character that’s made using a _corner.XYZ) on export time.

We did understand you. It is not possible with build in methods so you need to write something yourself.

1 Like

Got it Georg. Diving into scripting then, thanks!
Thanks!

I started trying to script something that may fix my issue (TOTAL NEWBIE ALERT), a scripted macro to add Corner Components to all corners of my outlines (would be perfect to not add to overlapping nodes).

`layer = Glyphs.font.selectedLayers[0] # current layer

add a new hint

newHint = GSHint()

change behaviour of hint here, like its attachment nodes

layer.hints.append(newHint)`

I found this in the Documentation and then read GSHint objects and this is as far as I could get.
Maybe with one or two lines of your contribution I can move in the right direction.

Thanks!

This could be the core of your plugin code:

from GlyphsApp import CORNER, CAP

numberOfHints = len(Layer.hints)
if numberOfHints > 0:
	for i in range(numberOfHints)[::-1]:
		if Layer.hints[i].type == CORNER or Layer.hints[i].type == CAP:
			del Layer.hints[i]

Explanation:

  1. import the constants CORNER and CAP so you can check what type the hints are
  2. count hints in the layer, and if there are any, start the for loop
  3. step with iterator i through the index numbers (result of range function)
  4. the [::-1] makes it go from back to front, e.g., 5,4,3,2,1,0 This is necessary because if you delete one hint, the index numbers get resorted, and your iterator would end up with an index number that is not available anymore. If you delete from back to front, this cannot happen.
  5. simply check for the type of hint, and if it is a cap or a corner, delete it.
2 Likes