Skip to content
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

components in Glyphs3 sources can have a 'slant' attribute, in addition to 'pos', 'scale' and 'angle' #1127

Open
anthrotype opened this issue Nov 18, 2024 · 2 comments
Labels
bug Something isn't working
Milestone

Comments

@anthrotype
Copy link
Member

As seen in googlefonts/glyphsLib#1047

apparently this wasn't supported in glyphsLib either (and thus fontmake)

fontc should match Glyphs.app and support slanted components (and glyphsLib will need fixing at the same time).

The above linked issue documents the expected order of the partial transformations comprising the full affine:

translate * slant * rotate * scale

Currently fontc (and glyphLib) only does:

translate * rotate * scale

here:

// Glyphs 3 gives us {angle, pos, scale}. Glyphs 2 gives us the standard 2x3 matrix.
// The matrix is more general and less ambiguous (what order do you apply the angle, pos, scale?)
// so convert Glyphs 3 to that. Order based on saving the same transformed comonent as
// Glyphs 2 and Glyphs 3 then trying to convert one to the other.
if !from.pos.is_empty() {
if from.pos.len() != 2 {
return Err(Error::StructuralError(format!("Bad pos: {:?}", from.pos)));
}
transform *= Affine::translate((from.pos[0], from.pos[1]));
}
if let Some(angle) = from.angle {
transform *= Affine::rotate(angle.to_radians());
}
if !from.scale.is_empty() {
if from.scale.len() != 2 {
return Err(Error::StructuralError(format!(
"Bad scale: {:?}",
from.scale
)));
}
transform *= Affine::scale_non_uniform(from.scale[0], from.scale[1]);
}

@anthrotype
Copy link
Member Author

the test file from the above linked issue example.glyphs can be used to reproduce this.

Exporting a static TTF directly from Glyphs.app (v3.3 3326) and building one with fontc, then comparing the result shows that ours is misisng the (back)slant

@rsheeter
Copy link
Contributor

Good catch!

@rsheeter rsheeter added the bug Something isn't working label Nov 18, 2024
@rsheeter rsheeter added this to the fontc 1.0 milestone Jan 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants