-
Notifications
You must be signed in to change notification settings - Fork 255
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 spec compliance for generated font #123
Comments
Regarding table order in the directory, per the spec entries in the table directory must be sorted in ascending order by tag. However, some tables depend on data from other tables having been encoded. Perhaps to address this issue we can write all table data, then write the sorted table directory entries. |
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
I'm looking at improving string encoding support but deeper analysis will need to be done to determine the full extent of scenarios need to be handled. Of special note, support for platform 1 is being deferred for now. Primarily because the spec discourages use of this platform:
Will revisit supporting platform 1 as needed since the platform uses legacy Macintosh text encodings:
|
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
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
Might be useful to support encoding conversion (e.g., Big5 to Unicode). Some internal processes rely on a Unicode cmap. Notably, the library writes out the cmap table hard coded to platform ID 3, platform specific ID 1. So without a Unicode map writing the font will fail. Unicode provides a collection of conversion tables: |
A font with a format 2 cmap table will still re-encode with a format 4 cmap table. relates to #123
A font with a format 2 cmap table will still re-encode with a format 4 cmap table. relates to #123
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
A font with a format 2 cmap table will still re-encode with a format 4 cmap table. relates to #123
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
A font with a format 2 cmap table will still re-encode with a format 4 cmap table. relates to #123
When generating a new font file this library currently writes out a significant number of font table data using the values specified in the original font file. The resulting font may have values that do not conform to expectations per the spec because a number of those values are dependent on the font structure, supported characters, and related glyphs.
This is a tracking issue to help identify and track these issues.
The text was updated successfully, but these errors were encountered: