Merge pull request #2381 from dotCooCoo/feat/type-size-by-five

Type: Cmd/Ctrl+Alt+Shift+. and , step the font size by five increments
This commit is contained in:
BFlat
2026-10-16 15:17:22 +07:00
committed by GitHub
25 changed files with 141 additions and 1 deletions
+18
View File
@@ -85,6 +85,24 @@ pub fn specs() -> Vec<CommandSpec> {
has_selection,
|s, p| type_step(s, &json!({"attribute": "size", "by": -f64_or(p, "by", 1.0)}))
),
cmd!(
"type.size.increaseByFive",
"Increase Font Size by Five Steps",
[],
Some("Cmd+Alt+Shift+."),
"{} type.step {attribute: size, by: 5}: five times the Size/Leading increment (typeSizeIncrement)",
has_selection,
|s, _| type_step(s, &json!({"attribute": "size", "by": 5.0}))
),
cmd!(
"type.size.decreaseByFive",
"Decrease Font Size by Five Steps",
[],
Some("Cmd+Alt+Shift+,"),
"{} type.step {attribute: size, by: -5}: five times the Size/Leading increment (typeSizeIncrement)",
has_selection,
|s, _| type_step(s, &json!({"attribute": "size", "by": -5.0}))
),
cmd!(
"type.resetTracking",
"Reset Tracking and Kerning",
+27
View File
@@ -1024,6 +1024,33 @@ fn type_increments_step_the_type() {
assert_eq!((style_at(&s, id, 0).size, style_at(&s, id, 6).size), (22.0, 25.0));
}
/// Cmd/Ctrl+Alt+Shift+. and , step the font size by five times the Size/Leading increment, on
/// the selected type objects and on the Type tool's selected text.
#[test]
fn font_size_steps_by_five_increments() {
use vectorcraft_tools::PointerKind::{Down, Up};
let mut s = new_doc();
let id = NodeId(s.execute("text.create", &json!({"x": 100, "y": 100, "text": "Hello world", "size": 12})).unwrap()["id"].as_u64().unwrap());
s.execute("select.set", &json!({"ids": [id.0]})).unwrap();
assert_eq!(find_command("type.size.increaseByFive").unwrap().shortcut, Some("Cmd+Alt+Shift+."));
assert_eq!(find_command("type.size.decreaseByFive").unwrap().shortcut, Some("Cmd+Alt+Shift+,"));
s.execute("type.size.increaseByFive", &json!({})).unwrap();
assert_eq!(style_at(&s, id, 0).size, 22.0, "five steps of the 2 pt Size/Leading increment");
s.execute("type.size.decreaseByFive", &json!({})).unwrap();
assert_eq!(style_at(&s, id, 0).size, 12.0);
set_pref(&mut s, "typeSizeIncrement", json!(3));
s.execute("type.size.increaseByFive", &json!({})).unwrap();
assert_eq!(style_at(&s, id, 10).size, 27.0, "the step follows the preference");
// While the Type tool edits, only its selected text steps.
let v = ViewInfo::default();
s.select_tool("type", v).unwrap();
gesture(&mut s, v, &[(Down, 102.0, 95.0), (Up, 102.0, 95.0)]);
assert_eq!(s.tool_options()["editing"], json!(id.0), "editing the text");
s.set_tool_option("select", &json!({"start": 6, "end": 11}));
s.execute("type.size.decreaseByFive", &json!({})).unwrap();
assert_eq!((style_at(&s, id, 0).size, style_at(&s, id, 6).size), (27.0, 12.0));
}
/// Cmd/Ctrl+Alt+Q resets tracking to 0 and kerning to Auto (0 in the Character panel) in every
/// selected type object and in the Type tool's selected text. At a caret it resets only the
/// kerning of the character before it. It is one undo step. Type objects given in `ids` are reset
+24
View File
@@ -1076,6 +1076,30 @@ fn type_preferences_apply_to_agents() {
assert_eq!(style(&mut s, 6), (size + 4.0, tracking + 50.0));
}
/// Cmd+Alt+Shift+. and , reach agents: the placeholder text the Type tool selects steps by five
/// times the Size/Leading increment (2 pt by default) and back.
#[test]
fn cmd_alt_shift_period_steps_the_font_size_by_five_for_agents() {
let mut s = server();
let events = json!([{"kind": "down", "x": 100, "y": 100}, {"kind": "up", "x": 100, "y": 100}]);
let r = call(&mut s, 1, "pointer_gesture", json!({"tool": "type", "events": events}));
assert_eq!(r["isError"], false, "{r}");
let id = serde_json::from_str::<Value>(&text_of(&r)).unwrap()["selection"][0].as_u64().unwrap();
let r = call(&mut s, 2, "run_command", json!({"command": "text.setRangeStyle", "params": {"id": id, "size": 12}}));
assert_eq!(r["isError"], false, "{r}");
let size = |s: &mut Server, n| {
let r = call(s, n, "run_command", json!({"command": "text.getRange", "params": {"id": id, "effective": true}}));
serde_json::from_str::<Value>(&text_of(&r)).unwrap()["runs"][0]["style"]["size"].clone()
};
let r = call(&mut s, 3, "press_key", json!({"key": ".", "mods": {"cmd": true, "alt": true, "shift": true}}));
assert_eq!(r["isError"], false, "{r}");
assert_eq!(serde_json::from_str::<Value>(&text_of(&r)).unwrap()["command"], "type.size.increaseByFive", "{r}");
assert_eq!(size(&mut s, 4), json!(22.0));
let r = call(&mut s, 5, "press_key", json!({"key": ",", "mods": {"cmd": true, "alt": true, "shift": true}}));
assert_eq!(serde_json::from_str::<Value>(&text_of(&r)).unwrap()["command"], "type.size.decreaseByFive", "{r}");
assert_eq!(size(&mut s, 6), json!(12.0));
}
/// Cmd+Alt+Q reaches agents: the placeholder text the Type tool selects goes back to tracking 0
/// and Auto kerning.
#[test]
+2
View File
@@ -1046,7 +1046,9 @@
Fit dashes to corners and ends Напасване на тиретата към ъглите и краищата
Fit Headline Напасване на заглавие
Decrease Font Size Намаляване размера на шрифта
Decrease Font Size by Five Steps Намаляване размера на шрифта с пет стъпки
Increase Font Size Увеличаване размера на шрифта
Increase Font Size by Five Steps Увеличаване размера на шрифта с пет стъпки
Spacing Разстояние
Step Type Тип стъпка
Fit in View Побиране в изгледа
Can't render this file because it contains an unexpected character in line 2 and column 73.
+2
View File
@@ -3481,7 +3481,9 @@ axis Both Obě
Duplicate Artboard Duplikovat pracovní plochu
Area / Path Type Text v oblasti / na cestě
Decrease Font Size Zmenšit velikost písma
Decrease Font Size by Five Steps Zmenšit velikost písma o pět kroků
Increase Font Size Zvětšit velikost písma
Increase Font Size by Five Steps Zvětšit velikost písma o pět kroků
Reset Tracking and Kerning Obnovit prostrkání a vyrovnání párů
Step Type Krokovat text
Get Text Range Získat rozsah textu
Can't render this file because it contains an unexpected character in line 2 and column 73.
+2
View File
@@ -1051,7 +1051,9 @@
Fit dashes to corners and ends Striche an Ecken und Enden anpassen
Fit Headline Überschrift einpassen
Decrease Font Size Schriftgrad verringern
Decrease Font Size by Five Steps Schriftgrad um fünf Schritte verringern
Increase Font Size Schriftgrad erhöhen
Increase Font Size by Five Steps Schriftgrad um fünf Schritte erhöhen
Reset Tracking and Kerning Laufweite und Kerning zurücksetzen
Spacing Abstand
Step Type Text schrittweise ändern
Can't render this file because it contains an unexpected character in line 2 and column 73.
+2
View File
@@ -1012,7 +1012,9 @@
Fit dashes to corners and ends Προσαρμογή παυλών σε γωνίες και άκρα
Fit Headline Προσαρμογή επικεφαλίδας
Decrease Font Size Μείωση μεγέθους γραμματοσειράς
Decrease Font Size by Five Steps Μείωση μεγέθους γραμματοσειράς κατά πέντε βήματα
Increase Font Size Αύξηση μεγέθους γραμματοσειράς
Increase Font Size by Five Steps Αύξηση μεγέθους γραμματοσειράς κατά πέντε βήματα
Spacing Διάστημα
Step Type Σταδιακό κείμενο
Fit in View Προσαρμογή στην προβολή
1 # Ελληνικά (el) — VectorCraft
1012
1013
1014
1015
1016
1017
1018
1019
1020
+2
View File
@@ -1068,7 +1068,9 @@
Fit dashes to corners and ends Ajustar guiones a esquinas y extremos
Fit Headline Ajustar titular
Decrease Font Size Reducir tamaño de fuente
Decrease Font Size by Five Steps Reducir tamaño de fuente en cinco incrementos
Increase Font Size Aumentar tamaño de fuente
Increase Font Size by Five Steps Aumentar tamaño de fuente en cinco incrementos
Reset Tracking and Kerning Restablecer espaciado e interletraje
Spacing Espaciado
Step Type Ajustar texto por incrementos
Can't render this file because it contains an unexpected character in line 2 and column 73.
+2
View File
@@ -3417,7 +3417,9 @@ axis Both Molemmat
Duplicate Artboard Monista piirtoalusta
Area / Path Type Alue- / polkuteksti
Decrease Font Size Pienennä fonttikokoa
Decrease Font Size by Five Steps Pienennä fonttikokoa viisi askelta
Increase Font Size Suurenna fonttikokoa
Increase Font Size by Five Steps Suurenna fonttikokoa viisi askelta
Step Type Porrasta teksti
Get Text Range Hae tekstialue
Punctuation Välimerkit
Can't render this file because it contains an unexpected character in line 2 and column 73.
+2
View File
@@ -1067,7 +1067,9 @@
Fit dashes to corners and ends Ajuster les tirets aux angles et aux extrémités
Fit Headline Ajuster le titre
Decrease Font Size Réduire la taille de police
Decrease Font Size by Five Steps Réduire la taille de police de cinq incréments
Increase Font Size Augmenter la taille de police
Increase Font Size by Five Steps Augmenter la taille de police de cinq incréments
Reset Tracking and Kerning Réinitialiser l’approche et le crénage
Spacing Espacement
Step Type Texte par incréments
Can't render this file because it contains an unexpected character in line 2 and column 73.
+2
View File
@@ -884,6 +884,7 @@
Decimal: Tizedesjegyek:
Decorative Díszítő
Decrease Font Size Betűméret csökkentése
Decrease Font Size by Five Steps Betűméret csökkentése öt lépéssel
Default Alapértelmezett
Default Actions Alapértelmezett műveletek
Default Figure Alapértelmezett számjegyek
@@ -1717,6 +1718,7 @@
Include Swatches for Tints Tónusok színmintáinak felvétele
Include tagged source profiles Címkézett forrásprofilok beágyazása
Increase Font Size Betűméret növelése
Increase Font Size by Five Steps Betűméret növelése öt lépéssel
Inflate… Felfújás…
Info Infó
Ink Festék
Can't render this file because it contains an unexpected character in line 2 and column 73.
+2
View File
@@ -1067,7 +1067,9 @@
Fit dashes to corners and ends Adatta i trattini ad angoli ed estremità
Fit Headline Adatta titolo
Decrease Font Size Riduci dimensione font
Decrease Font Size by Five Steps Riduci dimensione font di cinque incrementi
Increase Font Size Aumenta dimensione font
Increase Font Size by Five Steps Aumenta dimensione font di cinque incrementi
Reset Tracking and Kerning Reimposta spaziatura caratteri e crenatura
Spacing Spaziatura
Step Type Dimensione testo a incrementi
Can't render this file because it contains an unexpected character in line 2 and column 73.
+2
View File
@@ -328,7 +328,9 @@
Remove Threading スレッドを解除
Fit Headline ヘッドラインを合わせる
Decrease Font Size フォントサイズを小さく
Decrease Font Size by Five Steps フォントサイズを5段階小さく
Increase Font Size フォントサイズを大きく
Increase Font Size by Five Steps フォントサイズを5段階大きく
Reset Tracking and Kerning トラッキングとカーニングをリセット
Step Type 文字を段階的に調整
Find Font… フォントの検索と置換…
Can't render this file because it contains an unexpected character in line 2 and column 73.
+2
View File
@@ -324,7 +324,9 @@
Remove Threading 연결 제거
Fit Headline 제목에 맞추기
Decrease Font Size 글꼴 크기 줄이기
Decrease Font Size by Five Steps 글꼴 크기 5단계 줄이기
Increase Font Size 글꼴 크기 키우기
Increase Font Size by Five Steps 글꼴 크기 5단계 키우기
Reset Tracking and Kerning 자간 및 커닝 재설정
Step Type 단계별 문자
Find Font… 글꼴 찾기…
Can't render this file because it contains an unexpected character in line 2 and column 73.
+2
View File
@@ -3314,7 +3314,9 @@ axis Both Obie
Duplicate Artboard Powiel obszar kompozycji
Area / Path Type Tekst akapitowy / na ścieżce
Decrease Font Size Zmniejsz rozmiar czcionki
Decrease Font Size by Five Steps Zmniejsz rozmiar czcionki o pięć kroków
Increase Font Size Zwiększ rozmiar czcionki
Increase Font Size by Five Steps Zwiększ rozmiar czcionki o pięć kroków
Reset Tracking and Kerning Resetuj światło i kerning
Step Type Krok tekstu
Get Text Range Pobierz zakres tekstu
Can't render this file because it contains an unexpected character in line 2 and column 73.
+2
View File
@@ -948,7 +948,9 @@
Fit Artboard in Window Ajustar Mesa de Trabalho na Janela
Fit Headline Ajustar Manchete
Decrease Font Size Diminuir Tamanho da Fonte
Decrease Font Size by Five Steps Diminuir Tamanho da Fonte em Cinco Incrementos
Increase Font Size Aumentar Tamanho da Fonte
Increase Font Size by Five Steps Aumentar Tamanho da Fonte em Cinco Incrementos
Reset Tracking and Kerning Redefinir Rastreamento e Kerning
Step Type Ajustar Texto em Incrementos
Fit dashes to corners and ends Ajustar tracejados aos cantos e extremidades
Can't render this file because it contains an unexpected character in line 6 and column 47.
+2
View File
@@ -1065,7 +1065,9 @@
Fit dashes to corners and ends Подгонять штрихи к углам и концам
Fit Headline Подогнать заголовок
Decrease Font Size Уменьшить размер шрифта
Decrease Font Size by Five Steps Уменьшить размер шрифта на пять шагов
Increase Font Size Увеличить размер шрифта
Increase Font Size by Five Steps Увеличить размер шрифта на пять шагов
Reset Tracking and Kerning Сбросить трекинг и кернинг
Spacing Интервал
Step Type Подгонять текст по шагам
Can't render this file because it contains an unexpected character in line 2 and column 73.
+2
View File
@@ -1048,7 +1048,9 @@
Fit dashes to corners and ends Anpassa streck till hörn och ändar
Fit Headline Anpassa rubrik
Decrease Font Size Minska teckenstorleken
Decrease Font Size by Five Steps Minska teckenstorleken fem steg
Increase Font Size Öka teckenstorleken
Increase Font Size by Five Steps Öka teckenstorleken fem steg
Spacing Avstånd
Step Type Stegtyp
Fit in View Anpassa till vyn
Can't render this file because it contains an unexpected character in line 5 and column 25.
+2
View File
@@ -1061,7 +1061,9 @@
Fit dashes to corners and ends Підганяти штрихи до кутів та кінців
Fit Headline Підігнати заголовок
Decrease Font Size Зменшити розмір шрифту
Decrease Font Size by Five Steps Зменшити розмір шрифту на п’ять кроків
Increase Font Size Збільшити розмір шрифту
Increase Font Size by Five Steps Збільшити розмір шрифту на п’ять кроків
Reset Tracking and Kerning Скинути трекінг і кернінг
Spacing Інтервал
Step Type Підганяти текст кроками
Can't render this file because it contains an unexpected character in line 718 and column 40.
+2
View File
@@ -781,6 +781,7 @@
Decimal: Thập phân:
Decorative Trang trí
Decrease Font Size Giảm cỡ chữ
Decrease Font Size by Five Steps Giảm cỡ chữ năm bước
Default Mặc định
Default Actions Hành động mặc định
Default Figure Chữ số mặc định
@@ -1579,6 +1580,7 @@
Include SVG Code Bao gồm mã SVG
Include Swatches for Tints Bao gồm mẫu màu cho sắc pha
Increase Font Size Tăng cỡ chữ
Increase Font Size by Five Steps Tăng cỡ chữ năm bước
Inflate… Phình…
Info Thông tin
Ink Mực
1 # Vietnamese (vi) catalog. Same format as zh-hant.tsv: context <TAB> source <TAB> translation
781
782
783
784
785
786
787
1580
1581
1582
1583
1584
1585
1586
+2
View File
@@ -1016,7 +1016,9 @@
Fit dashes to corners and ends 让虚线贴合转角与端点
Fit Headline 适合标题
Decrease Font Size 减小字体大小
Decrease Font Size by Five Steps 按五个增量减小字体大小
Increase Font Size 增大字体大小
Increase Font Size by Five Steps 按五个增量增大字体大小
Reset Tracking and Kerning 重置字距和字偶距
Spacing 间距
Step Type 按增量调整文字
Can't render this file because it contains an unexpected character in line 2 and column 73.
+2
View File
@@ -1039,7 +1039,9 @@
Fit dashes to corners and ends 讓虛線貼合轉角與端點
Fit Headline 符合標題
Decrease Font Size 縮小字體大小
Decrease Font Size by Five Steps 按五個增量縮小字體大小
Increase Font Size 放大字體大小
Increase Font Size by Five Steps 按五個增量放大字體大小
Reset Tracking and Kerning 重設字距與字距微調
Spacing 間距
Step Type 依增量調整文字
Can't render this file because it contains an unexpected character in line 6 and column 47.
+30
View File
@@ -1163,6 +1163,36 @@ mod tests {
assert_eq!(app.session.tool_id(), "curvature");
}
/// Cmd/Ctrl+Alt+Shift+. and , step the font size by five Size/Leading increments, and
/// Cmd/Ctrl+Shift+. still steps it by one: the chord with Alt does not reach the one-step
/// command.
#[test]
fn cmd_alt_shift_period_and_comma_step_the_font_size_by_five() {
let mut app = VectorcraftApp::new(vectorcraft_engine::Session::new(), Default::default());
app.session.execute("file.new", &json!({"width": 200, "height": 200})).unwrap();
let id = app.session.execute("text.create", &json!({"x": 20, "y": 50, "text": "One Two", "size": 12})).unwrap()["id"].as_u64().unwrap();
let sizes = |app: &mut VectorcraftApp| {
let r = app.session.execute("text.getRange", &json!({"id": id})).unwrap();
r["runs"].as_array().unwrap().iter().map(|run| (run["text"].clone(), run["style"]["size"].clone())).collect::<Vec<_>>()
};
let press = |key, modifiers| egui::Event::Key { key, physical_key: None, pressed: true, repeat: false, modifiers };
let five = Modifiers::COMMAND | Modifiers::ALT | Modifiers::SHIFT;
app.session.execute("select.set", &json!({"ids": [id]})).unwrap();
frame(&mut app, vec![press(Key::Period, five)]);
assert_eq!(sizes(&mut app), [(json!("One Two"), json!(22.0))]);
frame(&mut app, vec![press(Key::Period, Modifiers::COMMAND | Modifiers::SHIFT)]);
assert_eq!(sizes(&mut app), [(json!("One Two"), json!(24.0))], "one step");
frame(&mut app, vec![press(Key::Comma, five)]);
assert_eq!(sizes(&mut app), [(json!("One Two"), json!(14.0))]);
// While the Type tool edits: only its selection.
app.select_tool("type");
app.session.apply_actions(vec![vectorcraft_tools::Action::Notify("text.editNew".into())]).unwrap();
app.session.set_tool_option("select", &json!({"start": 4, "end": 7}));
assert!(app.session.tool_wants_text());
frame(&mut app, vec![press(Key::Period, five)]);
assert_eq!(sizes(&mut app), [(json!("One "), json!(14.0)), (json!("Two"), json!(24.0))]);
}
/// #793: with a layout without Latin letters the one-key shortcuts go by the key's position:
/// the P key typing Persian `ح` chooses the Pen, the V key typing Russian `м` the Selection
/// tool. A Latin layout keeps the letter typed: AZERTY's A (the Q key's place) is A.
+3 -1
View File
@@ -2019,7 +2019,9 @@ Pen's second anchor at (150, 431), in line with the square's centre.
- `typeSizeIncrement`, `trackingIncrement`, `baselineShiftIncrement`: what `type.step {attribute: "size" | "leading" |
"tracking" | "kerning" | "baselineShift", by?}` steps by, on the text range given, the type objects in `ids`, the
Type tool's selected text or the selected type objects. `type.size.increase` / `type.size.decrease` (Cmd+Shift+. and
Cmd+Shift+,) step the size; the Type tool's Alt+arrows (`press_key {key: "Right", mods: {alt: true}}`) step kerning at
Cmd+Shift+,) step the size. `type.size.increaseByFive` (Cmd+Alt+Shift+., `press_key {key: ".", mods: {cmd: true,
alt: true, shift: true}}`) and `type.size.decreaseByFive` (Cmd+Alt+Shift+,) step it by five times `typeSizeIncrement`.
The Type tool's Alt+arrows (`press_key {key: "Right", mods: {alt: true}}`) step kerning at
a caret or tracking of the selection (←/→), leading (↑/↓) and baseline shift (Shift+↑/↓), five steps with Cmd/Ctrl
too. `type.resetTracking` (Cmd+Alt+Q, `press_key {key: "Q", mods: {cmd: true, alt: true}}`) sets tracking to 0 and
kerning to Auto in the type objects in `ids`, the Type tool's selected text or the selected type objects; at a caret
+1
View File
@@ -450,6 +450,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur
- Shift+Tab (`window.panels`) shows and hides the dock and the floating panels and leaves the toolbar and the Control bar as they are; hiding the panels with Tab or Shift+Tab also closes a panel popped out of the icon column.
- The second Tab (`window.dock`) shows again only the bars the first Tab hid, after a restart too: a Control bar that was off stays off, a toolbar hidden with Window › Tools stays hidden, and panels shown with Shift+Tab in between stay shown.
- Cmd/Ctrl+A follows the keyboard: in a panel, dialog or search field it selects the field's text, while the Type tool edits it selects all of that text (also `select.all` over MCP), and only otherwise every object. On macOS the menu bar's Select All, Cut, Copy and Paste (keys or clicks) act on a focused field too, and elsewhere the in-window menus' do: the field that had the keyboard when the menu opened gets them, with its selection, and the keyboard back (#516). Not yet: Select All across threaded frames (one frame's text is selected).
- Cmd/Ctrl+Alt+Shift+. and , (`type.size.increaseByFive`, `type.size.decreaseByFive`) step the font size of the selected type, or of the text the Type tool has selected, by five times the Size/Leading increment (Preferences › Type); Cmd/Ctrl+Shift+. and , still step it by one increment.
- Cmd/Ctrl+Alt+Q (`type.resetTracking`) sets the tracking of the selected type, or of the text the Type tool has selected, to 0 and its kerning to Auto (0 in the Character panel), in one undo step; at a caret it resets the kerning of the character before it.
- Shortcut sets other apps save as text (`.kys`) open in Import Shortcut Set from File › Open, from Edit › Keyboard Shortcuts › Import… in the desktop app, or from a drop on the window. It matches each entry to a tool, command or panel by name and decodes the file's key and modifier codes where VectorCraft's default shortcuts agree on them; the user answers the rest, and Apply fills the Keyboard Shortcuts dialog's working set. The answers are kept with the preferences for the next import (`shortcutSet.read`, `importMatches.*`).
- On Windows and Linux the app bar is the window's title bar (its own minimize, maximize and close buttons, drag to move, edges to resize), with the dragon app icon as the brand mark; dialogs and menus size to their content. As on a native menu bar, once one menu is open, moving the pointer onto another title opens that one.