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

leave generated .notdef glyph unmapped in cmap #428

Merged
merged 1 commit into from
Sep 5, 2023
Merged

Conversation

anthrotype
Copy link
Member

@anthrotype anthrotype commented Sep 5, 2023

.notdef glyph represent the absence of a character, so it should not be explicitly mapped in the cmap. Currently we were adding a no-op map from 0x0000 (the NULL character) to glyph index 0 (.notdef) but this is unnecessary.

https://learn.microsoft.com/en-us/typography/opentype/spec/cmap#overview

Regardless of the encoding scheme, character codes that do not correspond to any glyph in the font should be mapped to glyph index 0. The glyph at this location must be a special glyph representing a missing character, commonly known as .notdef.

NULL is for something else entirely. Basically all character codepoints that are not suppoted in a given font (including NULL in the particular case of the test font as well as most font nowadays) get implicitly mapped to glyph id 0, aka ".notdef" glyph.

https://learn.microsoft.com/en-us/typography/opentype/spec/cmap#overview

'Regardless of the encoding scheme, character codes that do not correspond to any glyph in the font should be mapped to glyph index 0. The glyph at this location must be a special glyph representing a missing character, commonly known as .notdef.'
@anthrotype
Copy link
Member Author

FWIW, I verified with ttx_diff.py that Oswald's cmap is unchanged and matches fontmake even after this PR.

Copy link
Member

@dfrg dfrg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch. Lgtm

@anthrotype anthrotype added this pull request to the merge queue Sep 5, 2023
Merged via the queue into main with commit 0eab689 Sep 5, 2023
10 checks passed
@anthrotype anthrotype deleted the notdef-unmapped branch September 5, 2023 15:48
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

Successfully merging this pull request may close these issues.

2 participants