mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-11-11 16:33:22 -06:00
Type: Cmd/Ctrl+Alt+Q resets tracking to 0 and kerning to Auto
The reference app resets tracking and kerning to 0 with Cmd/Ctrl+Alt+Q. VectorCraft had no command for it. type.resetTracking (Reset Tracking and Kerning, default Cmd+Alt+Q) sets tracking to 0 and kerning to Auto, which the Character panel shows as 0, in the text the Type tool has selected, or else in all the text of every selected type object. At a caret it resets only the kerning of the character before it, where Alt+Left/Right kerns. It is one undo step. The range logic of type.step moves into a shared type_ranges. When a call gives ids, type.step and type.resetTracking change all the text of those type objects even while the Type tool edits text, as paint.setFill does. Before, type.step changed the Type tool's selected text instead. Docs: docs/mcp.md, docs/target-app-parity.md.
This commit is contained in:
@@ -3456,6 +3456,7 @@ axis Both Obě
|
||||
Area / Path Type Text v oblasti / na cestě
|
||||
Decrease Font Size Zmenšit velikost písma
|
||||
Increase Font Size Zvětšit velikost písma
|
||||
Reset Tracking and Kerning Obnovit prostrkání a vyrovnání párů
|
||||
Step Type Krokovat text
|
||||
Get Text Range Získat rozsah textu
|
||||
Punctuation Interpunkce
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 2 and column 73.
|
@@ -1049,6 +1049,7 @@
|
||||
Fit Headline Überschrift einpassen
|
||||
Decrease Font Size Schriftgrad verringern
|
||||
Increase Font Size Schriftgrad erhöhen
|
||||
Reset Tracking and Kerning Laufweite und Kerning zurücksetzen
|
||||
Spacing Abstand
|
||||
Step Type Text schrittweise ändern
|
||||
Fit in View In Ansicht einpassen
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 2 and column 73.
|
@@ -1066,6 +1066,7 @@
|
||||
Fit Headline Ajustar titular
|
||||
Decrease Font Size Reducir tamaño de fuente
|
||||
Increase Font Size Aumentar tamaño de fuente
|
||||
Reset Tracking and Kerning Restablecer espaciado e interletraje
|
||||
Spacing Espaciado
|
||||
Step Type Ajustar texto por incrementos
|
||||
Fit in View Encajar en la vista
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 2 and column 73.
|
@@ -1065,6 +1065,7 @@
|
||||
Fit Headline Ajuster le titre
|
||||
Decrease Font Size Réduire la taille de police
|
||||
Increase Font Size Augmenter la taille de police
|
||||
Reset Tracking and Kerning Réinitialiser l’approche et le crénage
|
||||
Spacing Espacement
|
||||
Step Type Texte par incréments
|
||||
Fit in View Ajuster à la vue
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 2 and column 73.
|
@@ -2915,6 +2915,7 @@
|
||||
Reset to Defaults Alapértékek visszaállítása
|
||||
Reset to White, Black Visszaállítás fehér–fekete átmenetre
|
||||
Reset Tracing Tracing visszaállítása
|
||||
Reset Tracking and Kerning Betűköz és alávágás visszaállítása
|
||||
Reset Typography Typography visszaállítása
|
||||
Reset Web Web visszaállítása
|
||||
Reset with Mesh Visszaállítás hálóval
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 2 and column 73.
|
@@ -1065,6 +1065,7 @@
|
||||
Fit Headline Adatta titolo
|
||||
Decrease Font Size Riduci dimensione font
|
||||
Increase Font Size Aumenta dimensione font
|
||||
Reset Tracking and Kerning Reimposta spaziatura caratteri e crenatura
|
||||
Spacing Spaziatura
|
||||
Step Type Dimensione testo a incrementi
|
||||
Fit in View Adatta alla vista
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 2 and column 73.
|
@@ -329,6 +329,7 @@
|
||||
Fit Headline ヘッドラインを合わせる
|
||||
Decrease Font Size フォントサイズを小さく
|
||||
Increase Font Size フォントサイズを大きく
|
||||
Reset Tracking and Kerning トラッキングとカーニングをリセット
|
||||
Step Type 文字を段階的に調整
|
||||
Find Font… フォントの検索と置換…
|
||||
Change Case 大文字と小文字の変更
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 2 and column 73.
|
@@ -325,6 +325,7 @@
|
||||
Fit Headline 제목에 맞추기
|
||||
Decrease Font Size 글꼴 크기 줄이기
|
||||
Increase Font Size 글꼴 크기 키우기
|
||||
Reset Tracking and Kerning 자간 및 커닝 재설정
|
||||
Step Type 단계별 문자
|
||||
Find Font… 글꼴 찾기…
|
||||
Change Case 대소문자 변경
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 2 and column 73.
|
@@ -3288,6 +3288,7 @@ axis Both Obie
|
||||
Area / Path Type Tekst akapitowy / na ścieżce
|
||||
Decrease Font Size Zmniejsz rozmiar czcionki
|
||||
Increase Font Size Zwiększ rozmiar czcionki
|
||||
Reset Tracking and Kerning Resetuj światło i kerning
|
||||
Step Type Krok tekstu
|
||||
Get Text Range Pobierz zakres tekstu
|
||||
Punctuation Interpunkcja
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 2 and column 73.
|
@@ -949,6 +949,7 @@
|
||||
Fit Headline Ajustar Manchete
|
||||
Decrease Font Size Diminuir Tamanho da Fonte
|
||||
Increase Font Size Aumentar Tamanho da Fonte
|
||||
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
|
||||
Fit in Window Ajustar na Janela
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 6 and column 47.
|
@@ -1063,6 +1063,7 @@
|
||||
Fit Headline Подогнать заголовок
|
||||
Decrease Font Size Уменьшить размер шрифта
|
||||
Increase Font Size Увеличить размер шрифта
|
||||
Reset Tracking and Kerning Сбросить трекинг и кернинг
|
||||
Spacing Интервал
|
||||
Step Type Подгонять текст по шагам
|
||||
Fit in View Вписать в вид
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 2 and column 73.
|
@@ -1059,6 +1059,7 @@
|
||||
Fit Headline Підігнати заголовок
|
||||
Decrease Font Size Зменшити розмір шрифту
|
||||
Increase Font Size Збільшити розмір шрифту
|
||||
Reset Tracking and Kerning Скинути трекінг і кернінг
|
||||
Spacing Інтервал
|
||||
Step Type Підганяти текст кроками
|
||||
Fit in View Вписати у вигляд
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 715 and column 40.
|
@@ -2660,6 +2660,7 @@
|
||||
Reset to Default Đặt lại về mặc định
|
||||
Reset to default Đặt lại về mặc định
|
||||
Reset to White, Black Đặt lại về Trắng, Đen
|
||||
Reset Tracking and Kerning Đặt lại giãn chữ và kerning
|
||||
Reset with Mesh Đặt lại với lưới
|
||||
Reset with Mesh… Đặt lại với lưới…
|
||||
Reset with Warp Đặt lại với biến dạng
|
||||
|
||||
|
@@ -1018,6 +1018,7 @@
|
||||
Fit Headline 适合标题
|
||||
Decrease Font Size 减小字体大小
|
||||
Increase Font Size 增大字体大小
|
||||
Reset Tracking and Kerning 重置字距和字偶距
|
||||
Spacing 间距
|
||||
Step Type 按增量调整文字
|
||||
Fit in View 适合视图
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 2 and column 73.
|
@@ -1041,6 +1041,7 @@
|
||||
Fit Headline 符合標題
|
||||
Decrease Font Size 縮小字體大小
|
||||
Increase Font Size 放大字體大小
|
||||
Reset Tracking and Kerning 重設字距與字距微調
|
||||
Spacing 間距
|
||||
Step Type 依增量調整文字
|
||||
Fit in View 符合檢視
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 6 and column 47.
|
@@ -662,6 +662,40 @@ mod tests {
|
||||
assert!(!crate::menus::enabled(&app, "type.alignCenter"));
|
||||
}
|
||||
|
||||
/// Cmd+Alt+Q resets the tracking and kerning of the selected type (tracking 0, kerning Auto),
|
||||
/// and of the Type tool's selected text while it edits.
|
||||
#[test]
|
||||
fn cmd_alt_q_resets_tracking_and_kerning() {
|
||||
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"})).unwrap()["id"].as_u64().unwrap();
|
||||
let spaced =
|
||||
|app: &mut VectorcraftApp| app.session.execute("text.setRangeStyle", &json!({"id": id, "tracking": 200, "kerning": -40})).unwrap();
|
||||
let spacing = |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"]["tracking"].clone(), run["style"]["kerning"].clone()))
|
||||
.collect::<Vec<_>>()
|
||||
};
|
||||
let chord =
|
||||
egui::Event::Key { key: Key::Q, physical_key: None, pressed: true, repeat: false, modifiers: Modifiers::COMMAND | Modifiers::ALT };
|
||||
spaced(&mut app);
|
||||
app.session.execute("select.set", &json!({"ids": [id]})).unwrap();
|
||||
frame(&mut app, vec![chord.clone()]);
|
||||
assert_eq!(spacing(&mut app), [(json!("One Two"), json!(0.0), json!(null))]);
|
||||
// While the Type tool edits: only its selection.
|
||||
spaced(&mut app);
|
||||
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![chord]);
|
||||
assert_eq!(spacing(&mut app), [(json!("One "), json!(200.0), json!(-40.0)), (json!("Two"), json!(0.0), json!(null))]);
|
||||
}
|
||||
|
||||
/// Tab shows and hides the panels, and in the Type tool it types a tab, without moving the
|
||||
/// keyboard focus on to a field: the keys after it (a tool letter, the next letter typed) still
|
||||
/// work.
|
||||
|
||||
Reference in New Issue
Block a user