Rules

Note: the rules feature as it is currently implemented in Superpolator has some flaws. It works for simple substitutions, but not, for instance, if that glyph is referenced as a component somewhere else unexpected results will happen. The need for different constructions or shapes in specific parts of the designspace is real though. In variable fonts this is addressed with conditional GPOS and GSUB. The rules are then executed by the OpenType engine. I added some support for conditional swapping of glyphs to MutatorMath that might solve some of the problems.

A feature for Superpolator3: the rules panel lets you define conditions under which the shape of a specific glyph is replaced (in the previews and in the instances, not in the masters) with another glyph. Effectively you will see the glyph change from one design to another at specific areas in the designspace. For instance:

rules_a_with_serif

Using a rule you can switch a glyph from one design to another. These do not have to be compatible. See how in this example the construction of the a changes to grow a serif. There is no magic: the two different designs are two separate glyphs. The rule just switches between them.

different_as

Selecting a glyph in the preview will tell you it has been switched to a different one.

Setting up a rule

conditions

Click the Rules icon in the toolbar to open the Rules sheet. A rule is in charge of one single substitution (the Look for / Replace with names). A rule consists of one or more conditions. When any or all conditions are true for a given location, the rule will execute the substitution.

The rules shown in the picture above: the first rule will replace the contents of glyph a by glyph a.snap, when the value of the width axis is equal to or greater than 750. Or, when the value of the width axis is equal to or greater than 750.

The second rule works when the width < 500 or the weight > 500. Here the names contain a wildcard which will try to match more glyphs. Suppose you’re looking at an s: if the masters contain a glyph s.alt_wide, Superpolator3 will insert the s.alt_wide shapes into the s when generating the instances. The rules are applied in the order in the list. The resulting glyph name of a rule is fed into the next rule so you can chain rules together.

  • Note: it is quite easy to make really complex systems. Better start simple and understand what you’re doing.
  • A rule won’t work if a glyph gets replaced with one that has a component referencing the original. For instance, you can’t replace n by n.alt if n.alt has a component to n.