Advice on fonts with large amounts of nodes?

I have a font that has some glyphs that use a large quantity of nodes. Does anyone have any advice on this, specifically how to deal with exports failing?

Here is one of the errors I get:
“There was a problem converting the PostScript source font. Some glyphs are too complex (too many nodes) (charstring too long)”

Thanks!

Have you read this: https://glyphsapp.com/tutorials/creating-fonts-with-complex-outlines

Thanks I will have a read through this. Subroutines are already disabled. I’ve split the file into separate files using Generate Instances so I can understand which ones are problematic.

Removing hinting solved it for 4 of the 5 problem fonts. The final one has two glyphs in with an absurdly high number of nodes in them. It turns out that a 48 x 56 grid of circles contains 32,256 nodes.

The glyph “fullBlock” contains a lot of nodes (32256). This can’t be exported.
The glyph “at” contains a lot of nodes (20736). This can’t be exported.

Is there a maximum number of nodes that a single glyph can contain and still export to OTF CFF?

There is no fixed number of nodes. Depends on several factors.

If there is no limit to the number of nodes, what might be causing the export to fail? It’s the same if I isolate one of these as a single glyph and try to export it.

There is no FIXED limit. There is a limit on how much data each glyph can hold but it depends on node count and position and structure.

Ah okay. Glyphs is completely fine with it, until export. The affected glyphs consist of only circles laid out in a grid format. There is no overlap between objects as the circles have space between them.

Here is a single Master / single Instance font file with only a single glyph - one of the glyphs that fails due to a high node count. I can’t get this to export.

NO EXPORT.zip (100.7 KB)

If there are too many nodes, you need to remove some.

How many is too many?

I experimented with that file. I eliminated columns of dots until it stopped throwing that error. Then I backed up and started removing the dots one at a time. In this case at least, the threshold was 20,000 nodes. The original has 32,256.


Oops, yes I forgot to remove the OT features.

Thanks for looking into this Russ. It’s useful to know this. I honestly didn’t expect to run into a limitation, but looks like those nodes can add up fast!

Each of those circles counts for 12 nodes. A square only uses 4. If your design allowed it, you could use squares or diamonds and end up with 1/3 as many nodes. Hexagons preserve the overall shape better and end up with half the nodes. Octagons would look even better, but if 20,000 is the threshold, it might be over the limit. I wonder if the limit changes if there are no curves involved.

There is a square version too, which I had no problems with. This has taught me something about these types of fonts. Strange to think that an octagon is more efficient in this scenario. I think it is unlikely I’ll encounter this problem in the future, this is a fairly extreme use of pixel style elements and components.

Honestly, I hadn’t known before this experiment how the nodes were counted. Apparently each handle counts as a node, so each curve point has a total of 3. If there are no bezier handles, the number of nodes is equal to the number of corners. That is how it appears to work anyway.

On-curve nodes can have none, one or two control nodes for a total of one, two or three nodes.

Oncurve nodes never have control points. There can be line segments (counting one point) or curve segments (counting three).

1 Like

The nodes, I believe, are not entirely the limiting factor In glyph complexity. When PS renders, it needs to flatten the contour to segments that have a large but per-glyph limit we have exceeded in the past, forcing a glyph to be divided in two.

In the example presented above, each circle may need to be counted as 64 flattened segments, or something, the total or which cannot exceed 32,000 or something. Hope that helps.

I was curious, so I experimented with octagons in place of circles to see if the absence of curves made any difference to the maximum number of nodes. It didn’t. The maximum number of nodes is exactly 20,000. Anything above 20,000 and it will not export. If it is exactly 20,000 or below, it will export.
19%20AM
48%20AM

1 Like