Repository navigation
Type: Optical kerning keeps the space Tsume takes out - #7678
Merged
Merged
Conversation
Tsume narrows a cluster before Optical kerning measures its pairs, so Optical measured the narrowed gap and gave part of the space back. Optical now measures each pair as it would be without the Tsume, as it already does for Insert Aki, and the Tsume stays on top. Tsume records what it took on the glyph for this.
Contributor
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 55 seconds. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
With Noto Sans Arabic the fatha's ink reaches past the first letter's left edge, so that letter's Tsume only narrows its advance and moves no glyph. The test compared glyph positions alone and found no change. It now compares each glyph's position and advance.
Member
|
Merged, thanks @dotCooCoo! It passed its CI checks. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What and why
Follow-up to #7507. Tsume narrows each cluster while it is shaped, and Optical kerning measures the pairs after that. Optical therefore measured the narrowed gap and moved the pair back toward the face's stem spacing, giving back part of the space Tsume took. In the test font, on "HOH" at 100 pt with Tsume 100% on the first H, the O moved back 18 pt without Optical kerning and 12.6 pt with it.
Optical kerning now measures each pair as it would be without the Tsume, the way it already measures pairs without Insert Aki, and the Tsume is subtracted on top of its correction.
tightenrecords the space it took on the glyph (tsume_shift,tsume) sooptical_pairscan measure without it. Pairs without Tsume are spaced as before.How it was tested
New tests, each shown failing without the fix and passing with it:
tests::tsume::optical_kerning_keeps_the_tsume: with Tsume on each character of "HOH", the characters move back as far with Optical kerning as without it.tests::harakat::optical_kerning_keeps_the_tsume_of_a_letter_with_coloured_harakat: the same check right to left, on a word whose harakat are colored apart, with Tsume on either letter.Commands run on the branch:
cargo fmt --all -- --check: clean.cargo clippy -p vectorcraft-text --all-targets -- -D warnings: clean.cargo test -p vectorcraft-text: 784 passed, 1 ignored.cargo check --workspace --tests: clean.Checklist
cargo xtask cipasses (fmt, clippy, tests, assets, brands, layers, wasm).unwrap(),expect(),panic!,unreachable!,todo!orunimplemented!outside tests, and no unchecked indexing on data from files, parameters ormessages. Errors are returned as
Resultand shown to the user(why and how).
ASSETS.md.