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

[skrifa] NamedInstance.postscript_name_id "not present" case #1204

Open
simoncozens opened this issue Oct 24, 2024 · 1 comment
Open

[skrifa] NamedInstance.postscript_name_id "not present" case #1204

simoncozens opened this issue Oct 24, 2024 · 1 comment

Comments

@simoncozens
Copy link
Contributor

In an instance record, the postscript name ID is optional. postscript_name_id is therefore typed as Option<NameId>. All good.

However, in the binary, the "not present" case is represented as binary 0xFFFF. When the postscript name ID is not present, both skrifa NamedInstance.postscript_name_id and read-fonts InstanceRecord.post_script_name_id do not return None but instead return Some(65535) - so in fact this Option always returns Some.

I feel that certainly in skrifa as a "mid-level" library, and possibly also in read-fonts, the "not-present" case should be interpreted from the binary value and returned as a None.

@dfrg
Copy link
Member

dfrg commented Oct 25, 2024

Are you using an older version of read-fonts? This was changed a couple months ago:

(id.to_u16() != 0xFFFF).then_some(id)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants