Skip to content

Type: Optical kerning keeps the space Tsume takes out - #7678

Merged
bflatastic merged 3 commits into
storytold:mainfrom
dotCooCoo:fix/optical-keeps-tsume
Nov 15, 2026
Merged

bflatastic merged 3 commits into
storytold:mainfrom
dotCooCoo:fix/optical-keeps-tsume

Conversation

@dotCooCoo

Copy link
Copy Markdown
Contributor

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. tighten records the space it took on the glyph (tsume_shift, tsume) so optical_pairs can 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 ci passes (fmt, clippy, tests, assets, brands, layers, wasm).
  • No panics in shipped code: no unwrap(), expect(), panic!, unreachable!, todo! or
    unimplemented! outside tests, and no unchecked indexing on data from files, parameters or
    messages. Errors are returned as Result and shown to the user
    (why and how).
  • Clean-room: nothing copied from Adobe products or GPL/AGPL code (AGENTS.md).
  • Every new asset has a row in ASSETS.md.

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.
@coderabbitai

coderabbitai Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You'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.

Check out review usage here.

View limit details

Limit details: You’ve used all 10 included reviews currently available.

Learn how review limits work.

Review configuration:

Run configuration

Commits

Reviewing files that changed from the base of the PR and between dafd993 and 1d64e0f.

Files selected for processing: 5

  • crates/text/src/layout.rs
  • crates/text/src/layout/wrapping_tests.rs
  • crates/text/src/shape.rs
  • crates/text/src/tests/harakat.rs
  • crates/text/src/tests/tsume.rs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

Share

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.
@bflatastic
bflatastic merged commit bb2322c into storytold:main Nov 15, 2026
7 checks passed
@bflatastic

Copy link
Copy Markdown
Member

Merged, thanks @dotCooCoo! It passed its CI checks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants