Skip to content

Regular fonts with italic angle marked as italic #202

@kjarosh

Description

@kjarosh

The following code makes regular fonts to sometimes be considered as italic.

ttf-parser/src/lib.rs

Lines 1451 to 1456 in 7b58ee3

/// Checks that face is marked as *Italic*.
#[inline]
pub fn is_italic(&self) -> bool {
// A face can have a Normal style and a non-zero italic angle, which also makes it italic.
self.style() == Style::Italic || self.italic_angle() != 0.0
}

I'm not sure if that's correct, as I've stumbled upon a font that's regular, but has italic angle set. It's considered as a regular font on my system (and it looks regular, no slant), so it looks like relying on italic angle is not the right approach here.

There's also the question whether oblique fonts are also classified as italic, as in some (usually application-level) contexts they are.

So I guess it depends on what's the definition of "is_italic". The doc doesn't help much in this regard, so I think there's a room for improvement here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions