-
Notifications
You must be signed in to change notification settings - Fork 254
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
Improve TrueType specificiation compliance for generated fonts #124
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bsweeney
force-pushed
the
ttf-spec-compliance
branch
from
October 16, 2023 01:08
abe286c
to
c184f1b
Compare
bsweeney
force-pushed
the
ttf-spec-compliance
branch
from
October 16, 2023 01:17
c184f1b
to
c61a738
Compare
Closed
bsweeney
force-pushed
the
ttf-spec-compliance
branch
3 times, most recently
from
December 12, 2023 22:51
84c64a7
to
89d295f
Compare
bsweeney
force-pushed
the
ttf-spec-compliance
branch
2 times, most recently
from
December 29, 2023 22:50
432e04f
to
4294913
Compare
From the TrueType font specification section about the cmap table: > No character code should be mapped to glyph index -1 (0xFFFF), which is a special value reserved in processing to indicate the position of a glyph deleted from the glyph stream. ref #123
...before calculating the head table checksum. Per the head table specification: > checkSumAdjustment: To compute set it to 0, calculate the checksum for the 'head' table and put it in the table directory, sum the entire font as a uint32_t, then store 0xB1B0AFBA - sum. (The checksum for the 'head' table will be wrong as a result. That is OK; do not reset it.) ref #123
The number of tables in the font may change when generating a font file. Because the font header is dependent on the number of tables the values need to be recalculated. ref #123
Per the spec: > Table checksums are the unsigned sum of the longs in a table.
Per the spec: > The length of any table is a multiple of four bytes, or that tables are padded with zero to four byte-aligned offsets. Actual table lengths recorded in the TableDirectory should not include padding. fixes #119
Before this change when the font loca table was using the short format (glyph size / 2), an odd-numbered glyph byte length would be incorrectly record. To prevent this issue, when writing a font we will padd glyphs to align with a 4-byte boundary. Note: Official guidance needed. The 4-byte boundary is based on table requirements, as well as being a multiple of 2.
Most name strings should be encoded with UTF-16BE per the spec, but there are situations where other encodings are required or acceptable. This change only addresses a subset of potential encodings. fixes #70
A font with a format 2 cmap table will still re-encode with a format 4 cmap table. relates to #123
This librarry relies on Unicode data for a number of functions (namely font re-encoding). Without a Unicode-encoded cmap table those functions do not work as expected.
bsweeney
force-pushed
the
ttf-spec-compliance
branch
from
December 30, 2023 16:07
4294913
to
3ef0eed
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.