googlefonts / fontmake

Compile fonts from sources (UFO, Glyphs) to binary (OpenType, TrueType).
Apache License 2.0
789 stars 94 forks source link

Do we deal with overlapping rule ranges for the same glyph? #899

Open madig opened 2 years ago

madig commented 2 years ago

What does it mean when rule ranges overlap for the same glyph? How should it be handled? an internal bug report prompts me to think there is a behavioral difference between VFs and statics.

anthrotype commented 2 years ago

can you provide an example? How does fontTools.featureVars handle the situation? We should probably match that, provided is the right thing to do

anthrotype commented 2 years ago

How should it be handled?

did the font developer write those on purpose, if so what was the intended behavior?

madig commented 2 years ago

The example was (note the Hbar):

  <rules processing="last">
    <rule name="BRACKET.149.227">
      <conditionset>
        <condition name="Weight" minimum="149" maximum="227"/>
      </conditionset>
      <sub name="Hbar" with="Hbar.BRACKET.149"/>
      <sub name="cent" with="cent.BRACKET.149"/>
      <sub name="dollar" with="dollar.BRACKET.149"/>
    </rule>
    <rule name="BRACKET.186.227">
      <conditionset>
        <condition name="Weight" minimum="186" maximum="227"/>
      </conditionset>
      <sub name="Hbar" with="Hbar.BRACKET.186"/>
    </rule>
  </rules>

I didn't receive word yet whether this was intended, but probably not. In the VF, the last rule wins and in the statics, the first on does IIUC.