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

Font::units_per_em should not return Option #64

Open
alexheretic opened this issue Aug 26, 2022 · 0 comments
Open

Font::units_per_em should not return Option #64

alexheretic opened this issue Aug 26, 2022 · 0 comments
Labels
breaking-change A change that would require a breaking semver bump

Comments

@alexheretic
Copy link
Owner

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

@alexheretic alexheretic added the breaking-change A change that would require a breaking semver bump label Apr 27, 2023
@alexheretic alexheretic changed the title Font::units_per_em should not return Option (breaking) Font::units_per_em should not return Option Apr 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking-change A change that would require a breaking semver bump
Projects
None yet
Development

No branches or pull requests

1 participant