mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-11-27 08:13:22 +00:00
Type: Smart Punctuation replaces ligatures, extra spaces and fractions and reports results
Type > Smart Punctuation... now opens its own dialog in place of the generic parameter form. It has the seven replacement options, Replace In (Selected Text Only or Entire Document) and Report Results, which lists how many of each chosen replacement were made after OK. The dialog opens on the options confirmed last. - type.smartPunctuation takes fiLigatures, flLigatures, spaces and fractions, all off by default, so existing calls behave as before. - Ligatures write U+FB00 to U+FB04, longest match first. Expert Fractions writes the one-character fractions Unicode encodes, and skips one with a digit, a slash or a decimal point next to it, across a change of style too. Either is written only where the run's font has a glyph for it. - Smart Spaces keeps one space after a period, across runs. An inline graphic separates the text on either side of it. - The reply adds a replaced object with a count per kind. Nothing to replace still records no undo step. Docs: docs/mcp.md, docs/type-parity.md.
This commit is contained in:
+27
@@ -8612,6 +8612,33 @@ on again.
|
||||
{"name":"run_command","arguments":{"command":"type.convertToAreaType","params":{"ids":[42]}}}
|
||||
```
|
||||
|
||||
## Smart Punctuation
|
||||
|
||||
`type.smartPunctuation` replaces keyboard characters in the selected type, or in every text object with `scope:
|
||||
"document"` or nothing selected, in one undo step. Each option is a switch:
|
||||
|
||||
- `fiLigatures` (default `false`): ff, fi and ffi become the ligature characters U+FB00, U+FB01 and U+FB03.
|
||||
- `flLigatures` (default `false`): ff, fl and ffl become U+FB00, U+FB02 and U+FB04. The longest match is taken first.
|
||||
- `quotes` (default `true`): straight quotes become the Document Setup quotes.
|
||||
- `spaces` (default `false`): two or more spaces after a period become one.
|
||||
- `dashes` (default `true`): `--` becomes an en dash and `---` an em dash.
|
||||
- `ellipsis` (default `true`): `...` becomes an ellipsis.
|
||||
- `fractions` (default `false`): 1/2, 1/4, 3/4 and the other fractions Unicode encodes as one character (thirds,
|
||||
fifths, sixths, sevenths, eighths, ninths and 1/10) become that character. A fraction with a digit, a slash or a
|
||||
decimal point next to it, as in 1/25, 1/2/26 or 1/2.5, is left as it is, also when a change of style falls inside
|
||||
it. An inline graphic separates the text before it from the text after it, for this option and for `spaces`.
|
||||
|
||||
A ligature or a fraction is written only where the run's font has a glyph for it; elsewhere the letters stay. A value
|
||||
other than true, false or null is refused. The reply gives the number of text objects changed and how many of each
|
||||
replacement were made; with nothing to replace, no undo step is recorded. Type › Smart Punctuation… opens a dialog with
|
||||
these options, Replace In (Selected Text Only or Entire Document) and Report Results, which lists the count of each
|
||||
chosen replacement after OK. The dialog opens on the options confirmed last.
|
||||
|
||||
```json
|
||||
{"name":"run_command","arguments":{"command":"type.smartPunctuation","params":{"fiLigatures":true,"spaces":true,"fractions":true}}}
|
||||
→ {"changed": 1, "replaced": {"fiLigatures": 2, "flLigatures": 0, "quotes": 1, "spaces": 1, "dashes": 0, "ellipses": 0, "fractions": 2}}
|
||||
```
|
||||
|
||||
## Hyphenation options
|
||||
|
||||
`text.setFormat` sets the Paragraph panel menu's Hyphenation… options of the selected type (or `ids`, or the
|
||||
|
||||
+1
-1
@@ -51,7 +51,7 @@ against Illustrator's public documentation; **estimated** unless noted.
|
||||
| Tab stops and leaders; Tabs panel | partial | Tabs panel and stops with leaders in the model (`text.tabs.set`); a stop drags from where the press landed (#1458); leaders fill the tab's gap, repeated on a grid so they line up from line to line (#1877); Ctrl-dragging a stop (Command on macOS) moves all the stops together; in right-aligned area type the text before a line's last tab sits at its stops, from the left edge, and the text after it against the right edge, as Illustrator's own layout in a user's `.ai` sets a price list (evidence: `tests::right_aligned_area_type_sets_the_text_after_its_last_tab_against_the_edge`; centred lines are still aligned as a whole); in justified area type the text up to a line's last tab keeps its spacing and its tabs their stops, and the text after the last tab takes the line's room to the far edge, VectorCraft's own rule (evidence: `tests::justify::a_justified_line_with_a_tab_spreads_the_text_after_it_to_the_edge` and the other tab tests in `crates/text/src/tests/justify.rs`) |
|
||||
| Hidden characters (Show Hidden Characters) | done | `type.hiddenCharacters` |
|
||||
| Spell check (Check Spelling, Auto Spell Check, custom dictionary) | partial | the engine (#4936): `text.spelling.check` lists the unknown words of the document's type, each run in its Language, at the bytes `text.editRange` changes, and `text.spelling.suggest` gives suggestions, both from craft-proof, each paragraph on its own (English from the first dictionary it finds: a Hunspell dictionary in the user's dictionaries folder, the SCOWL dictionary built in from craft-i18n, a system Hunspell dictionary, and last the public-domain Moby word list built into it; other languages from the dictionaries craft-proof finds for them). The custom dictionary commands are done: `text.spelling.addWord`, `removeWord` and `changeWord` (Add, and Edit Custom Dictionary's Add, Delete and Change), and `text.spelling.dictionary` lists the words, saved to `Custom Dictionary.txt` beside the preferences; Ignore All: `text.spelling.ignoreAll` skips a word in the active document while it is open. Auto Spell Check is done: Edit › Spelling › Auto Spell Check (`edit.autoSpellCheck`, off at first, saved with the view settings) draws a red wavy line under the unknown words of the visible type, leaves out type with effects, and follows edits, the custom dictionary and Ignore All. A right-click on an underlined word lists the words its dictionary suggests (each replaces it in one undo step, `text.editRange`), or No Suggestions, then Ignore All and Add to Dictionary, and a right-click on type has Spelling › Auto Spell Check, checked while it is on. Edit › Edit Custom Dictionary… lists the custom dictionary's words, with an Entry field and Add, Delete and Change, applied on Done (Cancel leaves the dictionary as it was). The Check Spelling dialog remains. Evidence: `crates/engine/src/tests/spelling.rs`, `crates/ui-egui/src/canvas/tests.rs` (`auto_spell_check_*`), `crates/ui-egui/src/tests/contextmenu.rs` (the right-click), `crates/ui-egui/src/dialogs/custom_dictionary.rs` (the dialog). |
|
||||
| Smart Punctuation, Change Case, Find & Replace | done | |
|
||||
| Smart Punctuation, Change Case, Find & Replace | done | Type › Smart Punctuation… opens a dialog with the ff, fi, ffi and ff, fl, ffl ligatures, Smart Quotes, Smart Spaces, En, Em Dashes, Ellipses and Expert Fractions, Replace In and Report Results, which lists the count of each replacement; ligatures and fractions are written only where the font has a glyph for them. Evidence: `tests::menucmds::smart_punctuation_ligatures_spaces_and_fractions_are_counted`, `smart_punctuation_skips_ligatures_and_fractions_the_font_lacks`, `smart_spaces_keeps_one_space_after_a_period`, `dialogs::smart_punctuation::tests::menu_item_opens_the_dialog_and_ok_reports_the_counts` |
|
||||
| Alt + numeric-keypad codes while typing (Windows: `Alt+0176` → °) | partial | #5108: on Windows the character Windows posts when Alt comes up after keypad digits is typed at the caret like any other, in the typing's undo step, and the keypad digits typed with Alt run no shortcut. With NumLock off the keypad keys (Insert, End, arrows, Clear, Home, Page Up/Down without the extended-key flag) count as digits too and don't move the caret (`windows_alt_codes` unit tests; neither NumLock on nor off has been tried on a Windows machine yet). `type.insert {code}` (Windows Alt+0 code, Windows-1252 for 128–159) and `{unicode}` (hex code point) insert a character by its code (`menucmds::insert_a_character_by_its_code`). macOS and Linux have no such system convention and egui reports a keypad digit as the top-row digit, so there it does nothing; a floating panel window doesn't receive the character |
|
||||
| Caret: the arrows and Delete step over whole clusters (Thai consonant with its marks, combining accents, emoji); Backspace removes one character | done | in text with right-to-left characters the arrows move in visual order and stop on both sides of a character drawn with no width, such as a zero width non-joiner |
|
||||
| Touch Type tool | done | moves, scales and rotates one character through its kerning, baseline shift, scales and rotation (`text.touchType`); a character with a preceding logical character on the same line can move along the line in either reading direction; the first logical character moves only up and down. Positive `dx` follows reading order. These direction rules are VectorCraft's choices. |
|
||||
|
||||
Reference in New Issue
Block a user