You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Improve TrueType spec compliance for generated font #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.
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.
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:
Names with platformID 1 were required by earlier versions of macOS. Its use on modern platforms is discouraged. Use names with platformID 3 instead for maximum compatibility. Some legacy software, however, may still require names with platformID 1, platformSpecificID 0.
Strings for the Macintosh platform (platform ID 1) use platform-specific single- or double-byte encodings according to the specified encoding ID for a given name record.
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.
Activity
bsweeney commentedon Oct 15, 2023
Regarding table order in the directory, per the spec entries in the table directory must be sorted in ascending order by tag.
https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6.html
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.
Do not map 0xFFFF in the cmap table
Set the head table checkSumAdjustment to zero
Re-calculate font header when generating TTF
bsweeney commentedon Oct 27, 2023
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:
Do not map 0xFFFF in the cmap table
Set the head table checkSumAdjustment to zero
Re-calculate font header when generating TTF
Do not map 0xFFFF in the cmap table
Set the head table checkSumAdjustment to zero
Re-calculate font header when generating TTF
bsweeney commentedon Dec 16, 2023
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:
https://github.com/unicode-org/icu-data/blob/main/charset/data/ucm
Add support for parsing cmap subtable format 2
Add support for parsing cmap subtable format 2
Do not map 0xFFFF in the cmap table
Set the head table checkSumAdjustment to zero
Re-calculate font header when generating TTF
Add support for parsing cmap subtable format 2
Do not map 0xFFFF in the cmap table
Set the head table checkSumAdjustment to zero
Re-calculate font header when generating TTF
Add support for parsing cmap subtable format 2