fonttools / fontbakery

🧁 A font quality assurance tool for everyone
https://fontbakery.readthedocs.io
Apache License 2.0
548 stars 99 forks source link

[com.google.fonts/check/varfont/regular_wght_coord:adobefonts] respect Italic fvar and STAT Axis Value Format 3 #4602

Open mekkablue opened 6 months ago

mekkablue commented 6 months ago

Observed behaviour

When running this check on a separate Italic VF, I get the message: _The variable font 'wght' (Weight) axis coordinate must be 400 on the 'Regular' instance. (derived from com.google.fonts/check/varfont/regular_wghtcoord)

But I do have

    <DesignAxisRecord>
      <Axis index="0">
        <AxisTag value="wght"/>
        <AxisNameID value="256"/>  <!-- Weight -->
        <AxisOrdering value="0"/>
      </Axis>
      <Axis index="1">
        <AxisTag value="ital"/>
        <AxisNameID value="2"/>  <!-- Italic -->
        <AxisOrdering value="1"/>
      </Axis>
    </DesignAxisRecord>

    <AxisValueArray>
     ....
      <AxisValue index="1" Format="3">
        <AxisIndex value="0"/>
        <Flags value="2"/>  <!-- ElidableAxisValueName -->
        <ValueNameID value="270"/>  <!-- Regular -->
        <Value value="400.0"/>
        <LinkedValue value="700.0"/>
      </AxisValue>
   ....
    </AxisValueArray>
    <ElidedFallbackNameID value="2"/>  <!-- Italic -->

So, STAT does have a wght at Value=400, and it is called Regular. I wonder if the check cannot handle Format 3 entries? There is no ‘Regular’ in an Italic fvar of course.

Expected behaviour

Resources and steps needed to reproduce

FontBakery 0.11.2 on macOS Sonoma

simoncozens commented 6 months ago

This test passes on ofl/cabin/Cabin-Italic[wdth,wght].ttf which has a very similar STAT table (ital axis, format 3 regular axisvalue):

  <STAT>
    <Version value="0x00010001"/>
    <DesignAxisRecordSize value="8"/>
    <!-- DesignAxisCount=3 -->
    <DesignAxisRecord>
      <Axis index="0">
        <AxisTag value="wdth"/>
        <AxisNameID value="257"/>  <!-- Width -->
        <AxisOrdering value="0"/>
      </Axis>
      <Axis index="1">
        <AxisTag value="wght"/>
        <AxisNameID value="256"/>  <!-- Weight -->
        <AxisOrdering value="1"/>
      </Axis>
      <Axis index="2">
        <AxisTag value="ital"/>
        <AxisNameID value="258"/>  <!-- Italic -->
        <AxisOrdering value="2"/>
      </Axis>
    </DesignAxisRecord>
    <!-- AxisValueCount=7 -->
    <AxisValueArray>
      <AxisValue index="0" Format="1">
        <AxisIndex value="0"/>
        <Flags value="0"/>
        <ValueNameID value="262"/>  <!-- Condensed -->
        <Value value="75.0"/>
      </AxisValue>
      <AxisValue index="1" Format="1">
        <AxisIndex value="0"/>
        <Flags value="2"/>  <!-- ElidableAxisValueName -->
        <ValueNameID value="263"/>  <!-- Normal -->
        <Value value="100.0"/>
      </AxisValue>
      <AxisValue index="2" Format="3">
        <AxisIndex value="1"/>
        <Flags value="2"/>  <!-- ElidableAxisValueName -->
        <ValueNameID value="264"/>  <!-- Regular -->
        <Value value="400.0"/>
        <LinkedValue value="700.0"/>
      </AxisValue>
      <AxisValue index="3" Format="1">
        <AxisIndex value="1"/>
        <Flags value="0"/>
        <ValueNameID value="265"/>  <!-- Medium -->
        <Value value="500.0"/>
      </AxisValue>
      <AxisValue index="4" Format="1">
        <AxisIndex value="1"/>
        <Flags value="0"/>
        <ValueNameID value="266"/>  <!-- SemiBold -->
        <Value value="600.0"/>
      </AxisValue>
      <AxisValue index="5" Format="1">
        <AxisIndex value="1"/>
        <Flags value="0"/>
        <ValueNameID value="267"/>  <!-- Bold -->
        <Value value="700.0"/>
      </AxisValue>
      <AxisValue index="6" Format="1">
        <AxisIndex value="2"/>
        <Flags value="0"/>
        <ValueNameID value="258"/>  <!-- Italic -->
        <Value value="1.0"/>
      </AxisValue>
    </AxisValueArray>
    <ElidedFallbackNameID value="2"/>  <!-- Italic -->
  </STAT>