Skip to content

Type: a selected character's alternate glyphs show beside it on the canvas - #7640

Open
dotCooCoo wants to merge 1 commit into
storytold:mainfrom
dotCooCoo:feat/canvas-character-alternates
Open

dotCooCoo wants to merge 1 commit into
storytold:mainfrom
dotCooCoo:feat/canvas-character-alternates

Conversation

@dotCooCoo

Copy link
Copy Markdown
Contributor

What and why

With a Type tool and exactly one character selected, the canvas now shows that character's alternate glyphs in a row beside it. A click on a glyph replaces the character's glyph, as Replace characters with alternate glyphs describes under "Replace a character with on-canvas alternate glyphs". The row shows at most five alternates, and an arrow at its end opens the Glyphs panel on Alternates for Current Selection when the character has more, as the reference manual describes.

  • A click runs the same command as a double-click in the Glyphs panel (text.setRangeStyle {featureChanges}, or text.setGlyphAlternate for a glyph no feature draws there), as one undo step. A letter of a joined Arabic word keeps the word joined.
  • The row is cached per document revision, so the text is laid out once per change and not in every frame.

These rules are VectorCraft's own:

  • The row leaves out the glyph the character is drawn with. A character drawn with an alternate gets its default glyph first.
  • The row stands under a character of horizontal type and on the right of a character of vertical type. It moves to the other side when the canvas ends there or the Contextual Task Bar is there.
  • Preferences › Type › Show Character Alternates (showCharacterAlternates, on by default) turns the row off. prefs.set refuses a value that is not a boolean.

The row has no command of its own: an agent reads the alternates with text.glyphAlternates and applies one with the commands above. docs/mcp.md and the progress doc describe the row and the preference. The two new tooltips and the preference label have rows in every catalog.

How it was tested

New tests:

  • canvas::alternates_bar::tests (5 tests): no row for a caret, two characters, a character without alternates, another tool or the preference turned off; five of six alternates plus the arrow; a click replaces the glyph as one undo step and keeps the text; the default glyph comes first after a pick; the arrow opens the Glyphs panel on Alternates for Current Selection without changing the document; a medial Arabic letter gets its medial alternates and its neighbors keep their joining forms; vertical type puts the row on the right; placement next to the canvas edge and the task bar.
  • prefs_dialog::tests::show_character_alternates_is_a_saved_type_preference and tests::prefs::show_character_alternates_preference_is_on_by_default_and_saved.

The four canvas tests that need the row fail when the row is turned off in the code.

Commands run on 7ff186bd31 (base 676f0524cc; it merges cleanly with main at 67f6d3a50f):

  • cargo fmt --all -- --check
  • cargo check --workspace --tests
  • cargo clippy -p vectorcraft-engine -p vectorcraft-ui-egui --all-targets -- -D warnings
  • cargo test -p vectorcraft-ui-egui --lib -- canvas::alternates_bar prefs_dialog::tests::show_character_alternates i18n panels::glyphs: 148 passed
  • cargo test -p vectorcraft-engine --lib -- tests::prefs: 119 passed
  • cargo xtask brands, layers, assets, wasm

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.

…anvas

With a Type tool and exactly one character selected, the canvas shows up
to five of that character's alternate glyphs in a row beside it. A click
runs the command the Glyphs panel's double-click runs, as one undo step;
an arrow at the end opens the Glyphs panel on Alternates for Current
Selection when the character has more. Preferences > Type > Show
Character Alternates (showCharacterAlternates, on by default) turns the
row off.
@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 6 minutes.

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 67f6d3a and 7ff186b.

Files ignored due to path filters: 28

  • crates/ui-egui/src/i18n/bg.tsv is excluded by !**/*.tsv
  • crates/ui-egui/src/i18n/bs.tsv is excluded by !**/*.tsv
  • crates/ui-egui/src/i18n/ca.tsv is excluded by !**/*.tsv
  • crates/ui-egui/src/i18n/cs.tsv is excluded by !**/*.tsv
  • crates/ui-egui/src/i18n/da.tsv is excluded by !**/*.tsv
  • crates/ui-egui/src/i18n/de.tsv is excluded by !**/*.tsv
  • crates/ui-egui/src/i18n/el.tsv is excluded by !**/*.tsv
  • crates/ui-egui/src/i18n/es.tsv is excluded by !**/*.tsv
  • crates/ui-egui/src/i18n/fi.tsv is excluded by !**/*.tsv
  • crates/ui-egui/src/i18n/fr.tsv is excluded by !**/*.tsv
  • crates/ui-egui/src/i18n/gu.tsv is excluded by !**/*.tsv
  • crates/ui-egui/src/i18n/hi.tsv is excluded by !**/*.tsv
  • crates/ui-egui/src/i18n/hu.tsv is excluded by !**/*.tsv
  • crates/ui-egui/src/i18n/id.tsv is excluded by !**/*.tsv
  • crates/ui-egui/src/i18n/it.tsv is excluded by !**/*.tsv
  • crates/ui-egui/src/i18n/ja.tsv is excluded by !**/*.tsv
  • crates/ui-egui/src/i18n/ka.tsv is excluded by !**/*.tsv
  • crates/ui-egui/src/i18n/ko.tsv is excluded by !**/*.tsv
  • crates/ui-egui/src/i18n/nl.tsv is excluded by !**/*.tsv
  • crates/ui-egui/src/i18n/pl.tsv is excluded by !**/*.tsv
  • crates/ui-egui/src/i18n/pt-br.tsv is excluded by !**/*.tsv
  • crates/ui-egui/src/i18n/ru.tsv is excluded by !**/*.tsv
  • crates/ui-egui/src/i18n/sv.tsv is excluded by !**/*.tsv
  • crates/ui-egui/src/i18n/tr.tsv is excluded by !**/*.tsv
  • crates/ui-egui/src/i18n/uk.tsv is excluded by !**/*.tsv
  • crates/ui-egui/src/i18n/vi.tsv is excluded by !**/*.tsv
  • crates/ui-egui/src/i18n/zh-hans.tsv is excluded by !**/*.tsv
  • crates/ui-egui/src/i18n/zh-hant.tsv is excluded by !**/*.tsv
Files selected for processing: 10

  • crates/engine/src/cmd/prefscmds.rs
  • crates/engine/src/prefs.rs
  • crates/engine/src/tests/prefs.rs
  • crates/ui-egui/src/canvas.rs
  • crates/ui-egui/src/canvas/alternates_bar.rs
  • crates/ui-egui/src/canvas/alternates_bar/tests.rs
  • crates/ui-egui/src/panels/glyphs.rs
  • crates/ui-egui/src/prefs_dialog/tests.rs
  • docs/mcp.md
  • docs/target-app-parity.md
  • 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

This branch has not been deployed

No deployments
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.

1 participant