-
Notifications
You must be signed in to change notification settings - Fork 80
Open
Description
Hi,
I've been working with variable fonts and noticed that while ttf-parser supports variation axes, it doesn't currently expose the Instance Records (named instances) defined in the fvar table.
Accessing these instances is crucial for retrieving named styles (like "Light", "Bold", etc.) and their corresponding coordinates. As discussed in #129, variable font support is a broad topic, but I believe this specific feature is a key missing piece.
Proposal & Implementation I have already implemented the necessary structures and parsing logic to support this. My implementation adds:
Instancestruct representing an Instance Record.Instancesstruct and iterator to traverse the records.- Parsing logic that handles the optional
postScriptNameIDbased on the record size.
Here is an example of how it works with my changes:
// Example usage
if let Some(fvar) = face.tables().fvar {
for instance in fvar.instances.iter() {
println!("Subfamily Name ID: {}", instance.subfamily_name_id);
// Access coordinates
for coord in instance.coordinates {
println!("Coord: {:?}", coord);
}
}
}
I will open a Pull Request shortly.
Metadata
Metadata
Assignees
Labels
No labels