Skip to content

[codegen] Add OffsetSource trait #1472

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

cmyr
Copy link
Member

@cmyr cmyr commented Apr 22, 2025

This is a way of encoding the source of offset data in the case where it has to be passed in, which has been a longstanding request.

With this change, the method for getting a Script from a ScriptRecord looks like,

fn script<'a>(&self, data: impl OffsetSource<'a, ScriptList<'a>>)

instead of,

fn script<'a>(&self, data: FontData<'a>)

To avoid breakage (this should break no existing code), FontData can still be passed directly to any method that accepts an OffsetSource argument. This is not publicly documented, though, and it is expected that new code would pass in the tables themselves.

This is a way of encoding the source of offset data in the case where it
has to be passed in.

With this change, the method for getting a `Script` from a
`ScriptRecord` looks like,

```rust
fn script<'a>(&self, data: impl OffsetSource<'a, ScriptList<'a>>)
```

instead of,

```rust
fn script<'a>(&self, data: FontData<'a>)
```

To avoid breakage, `FontData` can still be passed directly to any method
that accepts an `OffsetSource` argument. This is not publically
documented, though, and it is expected that new code would pass in the
tables themselves.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[read-fonts] Stop asking me for FontData! Which one do you even mean?! It's not obvious which FontData to give
1 participant