Add support for tracking (letter-spacing) REDUX #495
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
This is a rework of #492 (thanks @Socolin) that introduces a
Trackingproperty onTextOptions, allowing uniform adjustment of spacing between characters, measured in em units.To support this correctly, fixes were required in
SpanGraphemeEnumeratorto handle Indic conjuncts involving virama correctly. Specifically, a GB9c-style special case was added so sequences such as consonant + virama + consonant are treated as a single grapheme cluster rather than being split into a “dead consonant” followed by a new grapheme. This ensures tracking is applied at the correct cluster boundary instead of being injected inside a shaping unit.Additional fixes were required in vertical layout paths to ensure grapheme boundaries are respected consistently when applying tracking. This includes handling graphemes composed of multiple codepoints correctly in both vertical and vertical-mixed rendering modes, preventing incorrect splitting, misalignment, or over-accumulation when glyphs are rotated or laid out in vertical flow.
Example rendered layout is included in the reference tests.