Skip to content

Font::units_per_em should not return Option #64

@alexheretic

Description

@alexheretic

This method returns None in the case of an invalid font, currently in the same way ttf-parser provides this. This also means Font::pt_to_px_scale returns Option.

However, I don't think there is much of a way to handle invalid fonts at the point of using this method. I think it would be better to either just panic for invalid fonts in the method call, or check when initializing a font and return an Err if units_per_em is none immediately, which will allow us to unwrap it later.

Having to handle the option makes using point sizes harder than it should be, related #15

Metadata

Metadata

Assignees

No one assigned

    Labels

    breaking-changeA change that would require a breaking semver bump

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions