Type: Size › Other… gives the Character panel's Font Size field the focus

Type › Size ends with a separator and Other…, which runs the new UI
command type.highlightFontSize. It shows the Character panel and gives
its Font Size field the keyboard focus with the value selected, so a
size the list does not hold can be typed and applied with Enter.
Without selected type it fails with the existing error, as Highlight
Kerning does, and the menu item is dimmed, as Bold and Italic are.

The Font Size field now takes an armed focus: unit_field_from selects
and focuses the field as bounded_field_reading already does.

Docs: docs/mcp.md, docs/target-app-parity.md.
This commit is contained in:
dotCooCoo
2026-11-16 04:49:31 -08:00
parent 7452b6f383
commit cc6721f2d0
40 changed files with 190 additions and 12 deletions
+6
View File
@@ -376,6 +376,12 @@ pub const UI_COMMANDS: &[(&str, &str, &str, &str)] = &[
"Cmd+Alt+Shift+F",
"{} show the Character panel if it is hidden and open its font family menu, whose search field takes the keyboard focus: type to search, Enter applies the highlighted font → {field: \"fontName\"}. Without selected type (or text the Type tool edits) the panel shows, and the error says to select type first",
),
(
"type.highlightFontSize",
"Highlight Font Size",
"",
"{} (Type › Size › Other…) show the Character panel if it is hidden and give its Font Size field the keyboard focus with its value selected (blank where the selected sizes differ): type a size and press Enter → {field: \"fontSize\"}. Without selected type (or text the Type tool edits) the panel shows, and the error says to select type first",
),
(
"type.highlightKerning",
"Highlight Kerning",
+2
View File
@@ -5936,6 +5936,8 @@ theme Appearance Външен вид
Reset Tracking and Kerning Нулиране на разредката и кернинга
Reset Horizontal Scale Нулиране на хоризонталния мащаб
Highlight Font Name Маркиране на името на шрифта
Highlight Font Size Маркиране на размера на шрифта
Other… Друг…
Highlight Kerning Маркиране на кернинга
Highlight Tracking Маркиране на разредката
@msg span must be "object" or "selection", got {v} span трябва да е "object" или "selection", а не {v}
Can't render this file because it is too large.
+2
View File
@@ -4249,6 +4249,8 @@ axis Both Obje
Reset Tracking and Kerning Vrati razmak slova i podrezivanje na početno
Reset Horizontal Scale Vrati vodoravnu skalu na početno
Highlight Font Name Istakni naziv fonta
Highlight Font Size Istakni veličinu fonta
Other… Druga…
Highlight Kerning Istakni podrezivanje
Highlight Tracking Istakni razmak slova
Step Type Vrsta koraka
Can't render this file because it contains an unexpected character in line 2 and column 73.
+2
View File
@@ -1809,6 +1809,8 @@ digits Malayalam Malaiàlam
Clear Similar Fonts Esborra els tipus de lletra semblants
Font Preview Size Mida de previsualització del tipus de lletra
Font Size Mida del tipus de lletra
Highlight Font Size Ressalta la mida del tipus de lletra
Other… Una altra…
Font Style: Estil de tipus de lletra:
Font Technology Tecnologia del tipus de lletra
Font: Tipus de lletra:
Can't render this file because it contains an unexpected character in line 2 and column 73.
+2
View File
@@ -4354,6 +4354,8 @@ axis Both Obě
Reset Tracking and Kerning Obnovit prostrkání a vyrovnání párů
Reset Horizontal Scale Obnovit vodorovnou změnu velikosti
Highlight Font Name Zvýraznit název písma
Highlight Font Size Zvýraznit velikost písma
Other… Jiná…
Highlight Kerning Zvýraznit vyrovnání párů
Highlight Tracking Zvýraznit prostrkání
Step Type Krokovat text
Can't render this file because it is too large.
+2
View File
@@ -8409,6 +8409,8 @@ mark-style Japanese Japansk
Reset Tracking and Kerning Nulstil sporing og kerning
Reset Horizontal Scale Nulstil vandret skalering
Highlight Font Name Fremhæv skrifttypenavn
Highlight Font Size Fremhæv skriftstørrelse
Other… Anden…
Highlight Kerning Fremhæv kerning
Highlight Tracking Fremhæv sporing
@msg span must be "object" or "selection", got {v} span skal være "object" eller "selection", fik {v}
Can't render this file because it is too large.
+2
View File
@@ -1272,6 +1272,8 @@ font-technology Variable Variabel
Reset Tracking and Kerning Laufweite und Kerning zurücksetzen
Reset Horizontal Scale Horizontale Skalierung zurücksetzen
Highlight Font Name Schriftname hervorheben
Highlight Font Size Schriftgrad hervorheben
Other… Andere…
Highlight Kerning Kerning hervorheben
Highlight Tracking Laufweite hervorheben
Spacing Abstand
Can't render this file because it is too large.
+2
View File
@@ -6310,6 +6310,8 @@ effect Points Σημεία
Reset Horizontal Scale Επαναφορά οριζόντιας κλίμακας
Reset Tracking and Kerning Επαναφορά απόστασης χαρακτήρων και διαγραμμάτωσης
Highlight Font Name Επισήμανση ονόματος γραμματοσειράς
Highlight Font Size Επισήμανση μεγέθους γραμματοσειράς
Other… Άλλο…
Highlight Kerning Επισήμανση διαγραμμάτωσης
Highlight Tracking Επισήμανση απόστασης χαρακτήρων
Sample Color from Screen Δειγματοληψία χρώματος από την οθόνη
Can't render this file because it is too large.
+2
View File
@@ -1299,6 +1299,8 @@ font-technology Variable Variables
Reset Tracking and Kerning Restablecer espaciado e interletraje
Reset Horizontal Scale Restablecer escala horizontal
Highlight Font Name Resaltar nombre de fuente
Highlight Font Size Resaltar tamaño de fuente
Other… Otro…
Highlight Kerning Resaltar interletraje
Highlight Tracking Resaltar espaciado
Spacing Espaciado
Can't render this file because it contains an unexpected character in line 2 and column 73.
+2
View File
@@ -6320,6 +6320,8 @@ mark-style Japanese Japanilainen
Reset Horizontal Scale Palauta vaakaskaalaus
Reset Tracking and Kerning Palauta merkkiväli ja parivälistys
Highlight Font Name Korosta fontin nimi
Highlight Font Size Korosta fonttikoko
Other… Muu…
Highlight Kerning Korosta parivälistys
Highlight Tracking Korosta merkkiväli
Sample Color from Screen Poimi väri näytöltä
Can't render this file because it contains an unexpected character in line 2 and column 73.
+2
View File
@@ -1289,6 +1289,8 @@ font-technology Variable Variables
Reset Tracking and Kerning Réinitialiser l’approche et le crénage
Reset Horizontal Scale Réinitialiser la mise à l’échelle horizontale
Highlight Font Name Surligner le nom de la police
Highlight Font Size Surligner la taille de police
Other… Autre…
Highlight Kerning Surligner le crénage
Highlight Tracking Surligner l’approche
Spacing Espacement
Can't render this file because it is too large.
+2
View File
@@ -1691,6 +1691,8 @@
Highlight Alternate Glyphs વૈકલ્પિક ગ્લિફ હાઇલાઇટ કરો
Highlight Area વિસ્તાર હાઇલાઇટ કરો
Highlight Font Name ફોન્ટનું નામ હાઇલાઇટ કરો
Highlight Font Size ફોન્ટ સાઇઝ હાઇલાઇટ કરો
Other… અન્ય…
Highlight Intensity હાઇલાઇટ તીવ્રતા
Highlight Kerning કર્નિંગ હાઇલાઇટ કરો
Highlight Rows પંક્તિઓ હાઇલાઇટ કરો
Can't render this file because it contains an unexpected character in line 72 and column 5.
+2
View File
@@ -2328,6 +2328,8 @@ antiAlias Sharp शार्प
Highlight anchors on mouse over माउस ओवर पर हाइलाइट एंकर
Highlight Area हाइलाइट क्षेत्र
Highlight Font Name हाइलाइट फ़ॉन्ट नाम
Highlight Font Size हाइलाइट फ़ॉन्ट साइज़
Other… अन्य…
Highlight Kerning हाइलाइट कर्निंग
Highlight Rows हाइलाइट पंक्तियाँ
Highlight Substituted Fonts हाईलाइट सबस्टिट्यूटेड फ़ॉन्ट
Can't render this file because it is too large.
+2
View File
@@ -3611,6 +3611,8 @@ mark-style Japanese Japán
Reset Tracing Tracing visszaállítása
Reset Tracking and Kerning Betűköz és alávágás visszaállítása
Highlight Font Name Betűtípusnév kiemelése
Highlight Font Size Betűméret kiemelése
Other… Egyéb…
Highlight Kerning Alávágás kiemelése
Highlight Tracking Betűköz kiemelése
Reset Typography Typography visszaállítása
Can't render this file because it is too large.
+2
View File
@@ -5681,6 +5681,8 @@ mark-style Japanese Jepang
Reset Tracking and Kerning Atur ulang tracking dan kerning
Reset Horizontal Scale Atur ulang skala horizontal
Highlight Font Name Sorot nama font
Highlight Font Size Sorot ukuran font
Other… Lainnya…
Highlight Kerning Sorot kerning
Highlight Tracking Sorot tracking
@msg span must be "object" or "selection", got {v} span harus "object" atau "selection", diterima {v}
Can't render this file because it contains an unexpected character in line 2490 and column 5.
+2
View File
@@ -1306,6 +1306,8 @@ font-technology Variable Variabili
Reset Tracking and Kerning Reimposta spaziatura caratteri e crenatura
Reset Horizontal Scale Reimposta scala orizzontale
Highlight Font Name Evidenzia nome del font
Highlight Font Size Evidenzia dimensione font
Other… Altro…
Highlight Kerning Evidenzia crenatura
Highlight Tracking Evidenzia spaziatura caratteri
Spacing Spaziatura
Can't render this file because it is too large.
+2
View File
@@ -461,6 +461,8 @@ digits Malayalam マラヤーラム数字
Reset Tracking and Kerning トラッキングとカーニングをリセット
Reset Horizontal Scale 水平比率をリセット
Highlight Font Name フォント名をハイライト
Highlight Font Size フォントサイズをハイライト
Other… その他…
Highlight Kerning カーニングをハイライト
Highlight Tracking トラッキングをハイライト
Step Type 文字を段階的に調整
Can't render this file because it is too large.
+2
View File
@@ -7998,6 +7998,8 @@ liquify-list-end {0}, {1} {0} და {1}
Keep selected მონიშნულად დატოვება
Reset Tracking and Kerning ტრეკინგისა და კერნინგის ჩამოყრა
Highlight Font Name შრიფტის სახელის გამოკვეთა
Highlight Font Size შრიფტის ზომის გამოკვეთა
Other… სხვა…
Highlight Kerning კერნინგის გამოკვეთა
Highlight Tracking ტრეკინგის გამოკვეთა
Legacy (version 7) ძველი (ვერსია 7)
Can't render this file because it is too large.
+2
View File
@@ -454,6 +454,8 @@ digits Malayalam 말라얄람어
Reset Tracking and Kerning 자간 및 커닝 재설정
Reset Horizontal Scale 가로 비율 재설정
Highlight Font Name 글꼴 이름 강조 표시
Highlight Font Size 글꼴 크기 강조 표시
Other… 기타…
Highlight Kerning 커닝 강조 표시
Highlight Tracking 자간 강조 표시
Step Type 단계별 문자
Can't render this file because it is too large.
+2
View File
@@ -8192,6 +8192,8 @@ mark-style Japanese Japans
Reset Tracking and Kerning Tracking en kerning herstellen
Reset Horizontal Scale Horizontale schaal herstellen
Highlight Font Name Lettertypenaam markeren
Highlight Font Size Lettertypegrootte markeren
Other… Andere…
Highlight Kerning Kerning markeren
Highlight Tracking Tracking markeren
@msg span must be "object" or "selection", got {v} span moet "object" of "selection" zijn, maar is {v}
Can't render this file because it is too large.
+2
View File
@@ -4196,6 +4196,8 @@ axis Both Obie
Reset Tracking and Kerning Resetuj światło i kerning
Reset Horizontal Scale Resetuj skalę poziomą
Highlight Font Name Wyróżnij nazwę czcionki
Highlight Font Size Wyróżnij rozmiar czcionki
Other… Inny…
Highlight Kerning Wyróżnij kerning
Highlight Tracking Wyróżnij światło
Step Type Krok tekstu
Can't render this file because it is too large.
+2
View File
@@ -1179,6 +1179,8 @@ antiAlias Sharp Nítido
Reset Tracking and Kerning Redefinir Rastreamento e Kerning
Reset Horizontal Scale Redefinir Escala Horizontal
Highlight Font Name Destacar Nome da Fonte
Highlight Font Size Destacar Tamanho da Fonte
Other… Outro…
Highlight Kerning Destacar Kerning
Highlight Tracking Destacar Rastreamento
Step Type Ajustar Texto em Incrementos
Can't render this file because it is too large.
+2
View File
@@ -1297,6 +1297,8 @@ font-technology Variable Вариативные
Reset Tracking and Kerning Сбросить трекинг и кернинг
Reset Horizontal Scale Сбросить масштаб по горизонтали
Highlight Font Name Выделить имя шрифта
Highlight Font Size Выделить размер шрифта
Other… Другой…
Highlight Kerning Выделить кернинг
Highlight Tracking Выделить трекинг
Spacing Интервал
Can't render this file because it is too large.
+2
View File
@@ -6303,6 +6303,8 @@ theme Appearance Utseende
Reset Horizontal Scale Återställ horisontell skala
Reset Tracking and Kerning Återställ spärrning och kerning
Highlight Font Name Framhäv typsnittsnamn
Highlight Font Size Framhäv teckenstorlek
Other… Annan…
Highlight Kerning Framhäv kerning
Highlight Tracking Framhäv spärrning
Sample Color from Screen Hämta färg från skärmen
Can't render this file because it is too large.
+2
View File
@@ -1248,6 +1248,8 @@ font-technology Variable Değişken
Reset Tracking and Kerning Takip ve Karakter Aralığını Sıfırla
Reset Horizontal Scale Yatay Ölçeği Sıfırla
Highlight Font Name Yazı Tipi Adını Vurgula
Highlight Font Size Yazı Tipi Boyutunu Vurgula
Other… Diğer…
Highlight Kerning Karakter Aralığını Vurgula
Highlight Tracking Takibi Vurgula
Spacing Aralık
Can't render this file because it is too large.
+2
View File
@@ -1300,6 +1300,8 @@ font-technology Variable Варіативні
Reset Tracking and Kerning Скинути трекінг і кернінг
Reset Horizontal Scale Скинути масштаб по горизонталі
Highlight Font Name Виділити назву шрифту
Highlight Font Size Виділити розмір шрифту
Other… Інший…
Highlight Kerning Виділити кернінг
Highlight Tracking Виділити трекінг
Spacing Інтервал
Can't render this file because it is too large.
+2
View File
@@ -3380,6 +3380,8 @@ mark-style Japanese Kiểu Nhật
Reset to White, Black Đặt lại về Trắng, Đen
Reset Tracking and Kerning Đặt lại giãn chữ và kerning
Highlight Font Name Đánh dấu tên phông
Highlight Font Size Đánh dấu cỡ chữ
Other… Khác…
Highlight Kerning Đánh dấu kerning
Highlight Tracking Đánh dấu giãn chữ
Reset with Mesh Đặt lại với lưới
Can't render this file because it contains an unexpected character in line 205 and column 5.
+2
View File
@@ -1237,6 +1237,8 @@ antiAlias Sharp 锐利
Reset Tracking and Kerning 重置字距和字偶距
Reset Horizontal Scale 重置水平缩放
Highlight Font Name 突出显示字体名称
Highlight Font Size 突出显示字号
Other… 其他…
Highlight Kerning 突出显示字偶距
Highlight Tracking 突出显示字距
Spacing 间距
Can't render this file because it is too large.
+2
View File
@@ -1271,6 +1271,8 @@ font-technology Variable 可變
Reset Tracking and Kerning 重設字距與字距微調
Reset Horizontal Scale 重設水平縮放
Highlight Font Name 反白顯示字體名稱
Highlight Font Size 反白顯示字體大小
Other… 其他…
Highlight Kerning 反白顯示字距微調
Highlight Tracking 反白顯示字距
Spacing 間距
Can't render this file because it is too large.
+1
View File
@@ -322,6 +322,7 @@ fn run_ui_part3(app: &mut VectorcraftApp, id: &str, p: &Value) -> Option<Result<
"type.bold" => crate::panels::character::toggle_face(app, Face::Bold),
"type.italic" => crate::panels::character::toggle_face(app, Face::Italic),
"type.highlightFontName" => crate::panels::character::highlight(app, crate::panels::character::Field::FontName),
"type.highlightFontSize" => crate::panels::character::highlight(app, crate::panels::character::Field::FontSize),
"type.highlightKerning" => crate::panels::character::highlight(app, crate::panels::character::Field::Kerning),
"type.highlightTracking" => crate::panels::character::highlight(app, crate::panels::character::Field::Tracking),
"type.underline" => crate::panels::character::toggle_underline(app),
+1 -1
View File
@@ -219,7 +219,7 @@ pub fn enabled(app: &VectorcraftApp, id: &str) -> bool {
match id {
// Save is off for a clean document that already has its own file.
"file.save" => app.session.active().is_some_and(|d| d.path.is_none() || d.converted || d.is_dirty()),
"type.bold" | "type.italic" | "type.underline" | "type.lineComposer" | "type.hyphenate" => {
"type.bold" | "type.italic" | "type.underline" | "type.lineComposer" | "type.hyphenate" | "type.highlightFontSize" => {
crate::panels::character::text_style(app).is_some()
}
id if crate::panels::paragraph::ALIGN_COMMANDS.iter().any(|c| c.0 == id) => crate::panels::character::text_style(app).is_some(),
+33
View File
@@ -416,6 +416,39 @@ fn center_on_top_and_bottom_are_type_on_a_path_items() {
assert!((start - 0.625).abs() < 1e-6, "{start}");
}
/// Type › Size ends with a separator and Other…, which runs `type.highlightFontSize`: dimmed
/// without selected type, enabled with it, and never checked.
#[test]
fn type_size_ends_with_other() {
let mut app = VectorcraftApp::new(vectorcraft_engine::Session::new(), crate::Services::default());
let id = "type.highlightFontSize";
assert!(!enabled(&app, id), "no document");
app.run("file.new", json!({})).unwrap();
let items: Vec<Item> = menu_tree()
.into_iter()
.filter(|(menu, _)| *menu == "Type")
.flat_map(|(_, items)| items)
.filter_map(|item| match item {
Item::Sub("Size", children) => Some(children),
_ => None,
})
.flatten()
.collect();
let n = items.len();
assert!(n > 2, "{n} items");
assert!(matches!(items[n - 2], Item::Sep), "a separator comes before Other…");
assert!(matches!(&items[n - 1], Item::Cmd("Other…", c, p) if *c == id && p.is_null()), "Other… comes last");
assert!(items[..n - 2].iter().all(|i| matches!(i, Item::Cmd(_, "text.setStyle", _))), "the sizes come first");
assert!(!enabled(&app, id), "nothing selected");
let path = app.run("shape.rectangle", json!({"x": 10, "y": 10, "width": 50, "height": 50})).unwrap()["id"].clone();
app.run("select.set", json!({"ids": [path]})).unwrap();
assert!(!enabled(&app, id), "a path selected");
let text = app.run("text.create", json!({"x": 10, "y": 100, "text": "Size"})).unwrap()["id"].clone();
app.run("select.set", json!({"ids": [text]})).unwrap();
assert!(enabled(&app, id), "type selected");
assert_eq!(checked(&app, id, &Value::Null), None);
}
/// Type › Dynamic Text Presets › Circle, Arch and Bow run `type.dynamicTextPreset` with their
/// preset, enabled for point type and type on a path but not for area type alone.
#[test]
+8 -1
View File
@@ -397,7 +397,14 @@ pub fn menu_tree_named(english_names: bool) -> Vec<(&'static str, Vec<Item>)> {
vec![
sub("Font", font_items(english_names)),
sub("Recent Fonts", RECENT_FONT_IDS.iter().map(|id| c("Recent Font", id)).collect()),
sub("Size", TYPE_SIZES.iter().map(|(l, n)| cp(l, "text.setStyle", json!({ "size": n }))).collect()),
sub(
"Size",
TYPE_SIZES
.iter()
.map(|(l, n)| cp(l, "text.setStyle", json!({ "size": n })))
.chain([Sep, c("Other…", "type.highlightFontSize")])
.collect(),
),
c("Bold", "type.bold"),
c("Italic", "type.italic"),
Sep,
+6
View File
@@ -377,6 +377,12 @@ pub const UI_COMMANDS: &[(&str, &str, &str, &str)] = &[
"Cmd+Alt+Shift+F",
"{} show the Character panel if it is hidden and open its font family menu, whose search field takes the keyboard focus: type to search, Enter applies the highlighted font → {field: \"fontName\"}. Without selected type (or text the Type tool edits) the panel shows, and the error says to select type first",
),
(
"type.highlightFontSize",
"Highlight Font Size",
"",
"{} (Type › Size › Other…) show the Character panel if it is hidden and give its Font Size field the keyboard focus with its value selected (blank where the selected sizes differ): type a size and press Enter → {field: \"fontSize\"}. Without selected type (or text the Type tool edits) the panel shows, and the error says to select type first",
),
(
"type.highlightKerning",
"Highlight Kerning",
+1 -1
View File
@@ -408,7 +408,7 @@ fn a_character_field_shortcut_brings_the_floating_character_panel_forward() {
h.frame(vec![]);
assert!(showing(&h.app.ui, "character"));
assert_eq!(h.app.dock_rt.raise, None);
for command in ["type.highlightKerning", "type.highlightTracking", "type.highlightFontName"] {
for command in ["type.highlightKerning", "type.highlightTracking", "type.highlightFontName", "type.highlightFontSize"] {
h.app.run(command, json!({})).unwrap();
assert_eq!(h.app.dock_rt.raise.as_deref(), Some("character"), "{command}");
h.frame(vec![]);
+12 -7
View File
@@ -481,12 +481,14 @@ pub(crate) fn toggle_face(app: &mut VectorcraftApp, face: Face) -> Result<Value,
Ok(json!({ "style": name }))
}
/// The Character panel fields that the Highlight Font Name, Highlight Kerning and Highlight
/// Tracking commands give the keyboard focus ([`highlight`]).
/// The Character panel fields that the Highlight Font Name, Highlight Font Size (Type › Size ›
/// Other…), Highlight Kerning and Highlight Tracking commands give the keyboard focus
/// ([`highlight`]).
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub(crate) enum Field {
/// The font family menu: it opens, and its search field takes the focus.
FontName,
FontSize,
Kerning,
Tracking,
}
@@ -496,6 +498,7 @@ impl Field {
fn salt(self) -> &'static str {
match self {
Field::FontName => "ch-font",
Field::FontSize => "ch-size",
Field::Kerning => "ch-kern",
Field::Tracking => "ch-track",
}
@@ -504,17 +507,19 @@ impl Field {
fn name(self) -> &'static str {
match self {
Field::FontName => "fontName",
Field::FontSize => "fontSize",
Field::Kerning => "kerning",
Field::Tracking => "tracking",
}
}
}
/// `type.highlightFontName`, `type.highlightKerning` and `type.highlightTracking`: show the
/// Character panel if it is hidden (a shown one is activated, so its floating window comes
/// forward), and give `field` the keyboard focus when the panel next draws it, a number field with
/// its value selected (typing replaces it, Enter applies it). Without selected type or text the
/// Type tool edits, the panel shows, nothing takes the focus and the command fails. → `{field}`.
/// `type.highlightFontName`, `type.highlightFontSize`, `type.highlightKerning` and
/// `type.highlightTracking`: show the Character panel if it is hidden (a shown one is activated,
/// so its floating window comes forward), and give `field` the keyboard focus when the panel next
/// draws it, a number field with its value selected (typing replaces it, Enter applies it).
/// Without selected type or text the Type tool edits, the panel shows, nothing takes the focus and
/// the command fails. → `{field}`.
pub(crate) fn highlight(app: &mut VectorcraftApp, field: Field) -> Result<Value, String> {
// `window.panel` would hide a floating panel in front of its window, or an open flyout.
if crate::panel_docking::visible(&app.ui, "character") {
@@ -343,6 +343,57 @@ fn highlight_commands_focus_the_font_kerning_and_tracking_fields() {
assert_eq!(app.character_focus, None);
}
/// Type › Size › Other… (Highlight Font Size) shows the Character panel and gives its Font Size
/// field the keyboard focus with the value selected: what is typed replaces it, Enter applies it
/// as one undo step, and a selection of different sizes takes the one size typed into the blank
/// field. Without selected type the panel shows, the command fails and nothing takes the focus.
#[test]
fn highlight_font_size_focuses_the_font_size_field() {
let mut app = VectorcraftApp::new(Session::new(), Default::default());
app.run("file.new", json!({"width": 300, "height": 200})).unwrap();
let a = app.run("text.create", json!({"x": 20, "y": 50, "text": "AVAX", "size": 12})).unwrap()["id"].clone();
let b = app.run("text.create", json!({"x": 20, "y": 120, "text": "Wave", "size": 20})).unwrap()["id"].clone();
let ctx = egui::Context::default();
let frame = |app: &mut VectorcraftApp, events: Vec<egui::Event>| {
let mut out = ctx.run_ui(egui::RawInput { events, ..Default::default() }, |ui| show(app, ui));
out.textures_delta.clear();
};
let typed = |text: &str| {
let enter = egui::Event::Key { key: egui::Key::Enter, physical_key: None, pressed: true, repeat: false, modifiers: Default::default() };
vec![egui::Event::Text(text.into()), enter]
};
let size = |app: &VectorcraftApp| shared(app, |s| s.size);
app.run("select.set", json!({"ids": [a.clone()]})).unwrap();
assert_eq!(app.run("type.highlightFontSize", json!({})).unwrap(), json!({"field": "fontSize"}));
assert!(crate::panel_docking::showing(&app.ui, "character"), "the panel shows");
frame(&mut app, vec![]);
assert_eq!(app.character_focus, None, "the Font Size field took the focus");
frame(&mut app, typed("33"));
assert_eq!(size(&app), Some(33.0), "typing replaced the size");
app.run("edit.undo", json!({})).unwrap();
assert_eq!(size(&app), Some(12.0), "one undo step restores the size");
// Choosing Other again while the field holds typed text that is not applied selects all of it.
app.run("type.highlightFontSize", json!({})).unwrap();
frame(&mut app, vec![]);
frame(&mut app, vec![egui::Event::Text("999".into())]);
app.run("type.highlightFontSize", json!({})).unwrap();
frame(&mut app, vec![]);
frame(&mut app, typed("18"));
assert_eq!(size(&app), Some(18.0), "typing replaced the text typed before");
ctx.memory_mut(|m| m.stop_text_input());
// Different sizes: the field is blank, and the size typed applies to every selected object.
app.run("select.set", json!({"ids": [a, b]})).unwrap();
assert_eq!(size(&app), None);
app.run("type.highlightFontSize", json!({})).unwrap();
frame(&mut app, vec![]);
frame(&mut app, typed("16"));
assert_eq!(size(&app), Some(16.0), "both objects take the size typed");
// No type selected: the panel shows, the command fails and nothing is armed.
app.run("select.none", json!({})).unwrap();
assert!(app.run("type.highlightFontSize", json!({})).is_err());
assert_eq!(app.character_focus, None);
}
/// A variable font gets the Variable Font button, which opens one slider per axis named as the
/// font names it; a drag along one sets that axis of the selected type in one undo step.
#[test]
+10 -1
View File
@@ -142,7 +142,8 @@ fn unit_field(
/// [`unit_field`] whose blank field (`value` is `None`) steps from `blank_from` (points) with
/// ↑/↓ and the wheel instead of doing nothing. With `refuse_outside`, a value typed outside
/// `bounds` is refused as text that doesn't read is, rather than kept at the nearer end.
/// `bounds` is refused as text that doesn't read is, rather than kept at the nearer end. Armed
/// with id salt `id` ([`arm_field_focus`]), it takes the keyboard focus with its value selected.
#[allow(clippy::too_many_arguments)]
fn unit_field_from(
ui: &mut Ui,
@@ -160,10 +161,18 @@ fn unit_field_from(
empty: &str,
refuse_outside: bool,
) -> Option<f64> {
let armed = take_armed_focus(ui, &id);
let id = id_with(ui.scope_id(), id);
let shown = value.map(|v| unit.format(v)).unwrap_or_else(|| empty.to_string());
take_dialog_focus(ui, id, &shown);
if armed {
focus_field(ui, id, &shown);
}
let (mut buf, commit, resp, rect) = recessed_text(ui, id, &shown, width, 1, label, name);
if armed {
// A field armed while it has focus keeps the text typed into it: select all of that text.
select_all(ui, id, &buf);
}
select_all_on_focus(ui, &resp, &buf);
// ↑/↓ and the wheel step in the field's unit; a drag on its label scrubs it.
let typed = typed_unit(ui.ctx(), unit);
+4 -1
View File
@@ -7034,7 +7034,10 @@ Pen's second anchor at (150, 431), in line with the square's centre.
`type.highlightTracking` (no default key) and `type.highlightFontName` (Cmd+Alt+Shift+F) show the Character panel and
give its Kerning or Tracking field the keyboard focus with the value selected, or open its font family menu with the
search field focused; each replies `{field: "kerning" | "tracking" | "fontName"}`. Without selected type or text the
Type tool edits, the panel shows and the command fails.
Type tool edits, the panel shows and the command fails. Type › Size › Other… runs `type.highlightFontSize` (`{}`, no
default key), which gives the Character panel's Font Size field the keyboard focus the same way (blank when the
selected sizes differ; the size typed and Enter apply through `text.setStyle {size}` as one undo step) and replies
`{field: "fontSize"}`; the menu item is dimmed without selected type or text the Type tool edits.
The UI command `type.underline` (Cmd+Shift+U,
in remote mode `press_key {key: "U", mods: {cmd: true, shift: true}}` or `invoke_menu`) does what the Character
panel's Underline button does: it underlines the Type tool's selected text or the selected type objects, or removes
+1
View File
@@ -1121,6 +1121,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur
- 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 clears manual kerning while keeping the automatic method, in one undo step; at a caret it resets only the kerning there: of the character before it, or at the start of a line the space before the character after it (#5111).
- Cmd/Ctrl+Alt+K (`type.highlightKerning`) and Cmd/Ctrl+Alt+Shift+F (`type.highlightFontName`) show the Character panel and give its Kerning field the keyboard focus with the value selected, or open its font family menu with the search field focused, on the keys the reference app's [Default keyboard shortcuts](https://web.archive.org/web/20260726060015/https://helpx.adobe.com/illustrator/using/default-keyboard-shortcuts.html) page lists for highlighting kerning and the font name field. The page lists the same key for selecting the tracking value; `type.highlightTracking` focuses the Tracking field the same way and has no default key in Keyboard Shortcuts.
- Type › Size ends with Other… (`type.highlightFontSize`), for a size the list does not hold: it shows the Character panel and gives its Font Size field the keyboard focus with the value selected, and the size typed applies on Enter. [The help page](https://web.archive.org/web/20210601162814/https://helpx.adobe.com/pdf/illustrator_reference.pdf#page=488) describes Other in the Size menu as the way to enter a new size in the Character panel. Selecting the field's value, the separator before Other… and the item being dimmed without selected type are VectorCraft's own choices.
- Cmd/Ctrl+Alt+L (`ui.newLayer`) opens Layer Options for a new layer, as an Alt-click on the Layers panel's New Layer button does, on the key the reference app's [Default keyboard shortcuts](https://web.archive.org/web/20260726060015/https://helpx.adobe.com/illustrator/using/default-keyboard-shortcuts.html) page lists for adding a layer through the New Layer dialog box. OK adds the layer above the current layer, and Cancel adds none. Cmd/Ctrl+L still adds a layer without the dialog.
- F8 (`ui.symbolOptions`) opens Symbol Options for a new symbol made from the selection, as the Symbols panel's New Symbol button does, on the key the reference app's [Default keyboard shortcuts](https://web.archive.org/web/20260726060015/https://helpx.adobe.com/illustrator/using/default-keyboard-shortcuts.html) page lists for making a new symbol. OK makes the symbol and puts an instance of it in place of the art, and Cancel makes none. With nothing selected, F8 opens no dialog, and the status bar says that nothing is selected. Shift+F8 and Cmd/Ctrl+F8 still show the Transform and Info panels.
- Cmd/Ctrl+Shift+X (`type.resetHorizontalScale`) sets the horizontal scale of the selected type, or of the text the Type tool has selected, to 100% as the Character panel shows it (the object's own stretch included), in one undo step; at a caret it leaves the text as it is.