-
Notifications
You must be signed in to change notification settings - Fork 71
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
Missing instance records in fvar::Table #129
Comments
Yes, it is not implemented. |
@RazrFalcon do you mind if I submit a PR for this? |
Sure. Note that the PostScript name field is optional, making parsing more convoluted, since you cannot use You can check it using:
I guess the only way to implement it is by creating a custom wrapper for InstanceRecords data blob with a |
If an iterator pattern works then something like this is possible: let names = face.tables().name.unwrap().names;
let fvar = face.tables().fvar.unwrap();
for instance in fvar.instances() {
let subfamily = names
.into_iter()
.find(|n| n.name_id == instance.subfamily_name_id && n.is_unicode())
.unwrap()
.to_string()
.unwrap();
let ps_name = instance
.ps_name_id
.and_then(|name_id| {
names
.into_iter()
.find(|n| n.name_id == name_id && n.is_unicode())
})
.and_then(|n| n.to_string());
println!("subfamily: {subfamily}, ps_name: {ps_name:?}");
for (axis, value) in fvar.axes.into_iter().zip(instance.user_tuples) {
let axis_name = axis.tag.to_string();
println!("\t{axis_name} {value:?}")
}
println!();
} e.g.
https://github.com/inferiorhumanorgans/ttf-parser/tree/fvar-instance I'll hold off on a PR until someone who actually wants this feature can chime in with a use case and whether or not this is sufficient. |
related #120.
I think based on the spec, there are instance records in
fvar
. But currently ttf-parser only parses axis record?The text was updated successfully, but these errors were encountered: