Allow null AnchorTable #482
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 #479
This pull request improves the handling of OpenType MarkToBase positioning in the advanced typographic layout code, focusing on safer anchor processing and minor code style updates. The main changes ensure that the code correctly handles the case where a base glyph does not provide an anchor for a mark class, in line with the OpenType specification.
Robust handling of null anchors
ApplyAnchorinAdvancedTypographicUtils.csto accept a nullableAnchorTableand to safely return early if the anchor is null, preventing errors when a base glyph lacks an anchor for a mark class. This matches OpenType's allowance for null anchor offsets.Code style and clarity improvements
LookupType4Format1SubTable.Loadto use explicit types and object initializers for improved readability and consistency.TryUpdatePositionto use a more readable and idiomatic comparison (data.LigatureComponent <= 0instead of negating a greater-than check).