googlefonts / googlefonts/fontations

Language agnostic schema

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

Description

Once #84 is done we're getting close to the codegen input being language agnostic. It "just" needs to be a form other than Rust and to only have attributes that make sense beyond Rust. Strawman to incite debate: use https://toml.io/en/, it's simple, widely supported, supports comments, and more than sufficient to capture what we need.

*Today*

```rust
/// [COLR (Color)](https://learn.microsoft.com/en-us/typography/opentype/spec/colr#colr-header) table
table Colr {
/// Table version number - set to 0 or 1.
#[version]
version: u16,
/// Number of BaseGlyph records; may be 0 in a version 1 table.
num_base_glyph_records: u16,
/// Offset to baseGlyphRecords array (may be NULL).
#[nullable]
#[read_offset_with($num_base_glyph_records)]
base_glyph_records_offset: Offset32<[BaseGlyph]>,
```

*Tomorrow*

```toml
tag = "COLR"
root = "Colr"

[table.Colr]
comment = "[COLR (Color)](https://learn.microsoft.com/en-us/typography/opentype/spec/colr#colr-header) table"

[table.Colr.version]
type = "u16"
attrib = ["version"]
comment = "Table version number - set to 0 or 1."

[table.Colr.num_base_glyph_records]
type = "u16"
comment = "Number of BaseGlyph records; may be 0 in a version 1 table."

[table.Colr.base_glyph_records_offset]
type = "Offset32"
attrib = ["nullable"]
comment = "Offset to baseGlyphRecords array (may be NULL)."
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reviewing issue #84 and the current Rust-form schema shown here, then evaluate the proposed TOML representation against the codegen input needs. Done should be a decided language-agnostic schema, including which attributes remain valid beyond Rust, with agreement on how it will replace the current form.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.