Skip to content

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

Open
@anthrotype

Description

@anthrotype

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]);
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions