Allow invalid coverage tables. #476
Merged
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.
Prerequisites
Description
Fixes #470 Fixes #468
This pull request improves the handling of invalid or unexpected font table formats in the font rendering engine, ensuring better compatibility with real-world fonts and preventing exceptions. It also adds new regression tests for recent issues and minor refactoring in test code for clarity and maintainability.
Robustness and Compatibility Improvements:
CoverageTablenow gracefully handles unknowncoverageFormatvalues by returning an empty table instead of throwing an exception, matching Harfbuzz's behavior and fixing issues with fonts like SofiaSans Condensed. An internalEmptyCoverageTableclass was added for this purpose. [1] [2]AnchorTableuses a more descriptiveEmptyAnchorTableidentifier and continues to treat unknown anchor formats as empty, in line with Harfbuzz and FontKit, improving handling of fonts like NotoSans Regular. [1] [2]Testing and Regression Coverage:
TestFontsutility to include additional font files required for new tests.Test Code Refactoring:
Issues_469test by retrieving font names after adding to the collection, improving clarity and reducing the risk of mismatches. [1] [2]