Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Foldit: dubious data in HVAR table #6343

@Lorp

Description

@Lorp

Describe the bug
The Foldit variable font has an HVAR table for variable metrics as one would expect. The HVAR table consists primarily of an ItemVariationStore subtable (VarStore in TTX), which itself consists of multiple ItemVariationData subtables (VarData in TTX).

The issue concerns the fact that one of the VarData items has a regionIndexCount (VarRegionCount in TTX) with value 0, which does not make sense in variation math, and results in an empty array in TTX.

I recommend that Font Bakery rejects such fonts, as some parsers may not deal with it cleanly. I have not discovered any special meaning for a regionIndexCount of zero in the HVAR spec or the ItemVariationStore spec.

Here follows the start of the TTX dump of the HVAR table.

<?xml version="1.0" encoding="UTF-8"?>
<ttFont sfntVersion="\x00\x01\x00\x00" ttLibVersion="3.44">

  <HVAR>
    <Version value="0x00010000"/>
    <VarStore Format="1">
      <Format value="1"/>
      <VarRegionList>
        <!-- RegionAxisCount=1 -->
        <!-- RegionCount=1 -->
        <Region index="0">
          <VarRegionAxis index="0">
            <StartCoord value="0.0"/>
            <PeakCoord value="1.0"/>
            <EndCoord value="1.0"/>
          </VarRegionAxis>
        </Region>
      </VarRegionList>
      <!-- VarDataCount=3 -->
      <VarData index="0">
        <!-- ItemCount=1 -->
        <NumShorts value="0"/>
        <!-- VarRegionCount=0 -->
        <Item index="0" value="[]"/>
      </VarData>
      <VarData index="1">
        <!-- ItemCount=3 -->
        <NumShorts value="0"/>
        <!-- VarRegionCount=1 -->
        <VarRegionIndex index="0" value="0"/>
        <Item index="0" value="[44]"/>
        <Item index="1" value="[100]"/>
        <Item index="2" value="[116]"/>
      </VarData>
      <VarData index="2">
        <!-- ItemCount=171 -->
        <NumShorts value="1"/>
        <!-- VarRegionCount=1 -->
        <VarRegionIndex index="0" value="0"/>
        <Item index="0" value="[136]"/>
        <Item index="1" value="[145]"/>
        <Item index="2" value="[154]"/>
        <Item index="3" value="[155]"/>
        <Item index="4" value="[165]"/>
        <Item index="5" value="[174]"/>
        <Item index="6" value="[176]"/>
...

To Reproduce
$ ttx -t HVAR Foldit[wght].ttf

Expected behavior
All VarData items in the .ttx file should have VarRegionCount > 0.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions