googlefonts / googlefonts/fontations

[codegen] we should specify known versions of tables, and parsing should fail on unknown major versions

Open
#934 0 comments 0 reactions 0 assignees View on GitHub
correctness
Dominant language
Rust
Stars
826
Forks
75
Avg merge
22h 33m
Merged PRs (30d)
75

Description

From [the spec](https://learn.microsoft.com/en-us/typography/opentype/spec/otff#table-version-numbers):

> If the major version is not recognized, the implementation must not read the table as it can make no assumptions regarding interpretation of the binary data. The implementation should treat the table as missing.

we will currently parse any unknown version of a table as if it were the first version, which we treat as the implicit base of all subsequent versions.

To make this work we will need some attribute in codegen to specify the accepted major versions of a given table; to avoid confusion I think it would be easiest if we just specify all the versions we know about and then let codegen figure it out, with an attribute like `#[versions(1.0, 1.1, 2.0)]`.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by locating the codegen handling for table versions and the parser that currently treats unknown versions as version 1. Check the linked OpenType specification, then verify that accepted major versions are explicit and unknown major versions are treated as missing.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.