Skip to content

DesignCraft: An open-source page and layout design editor written by scratch in pure Rust

Properties: ••• expands Character and Paragraph in place, as in InDesign

paaspaas00578a1ce16946
diff --git a/ROADMAP.md b/ROADMAP.md
index a7b5105d3..8721cce1b 100644
--- a/ROADMAP.md
+++ b/ROADMAP.md
@@ -348,6 +348,7 @@ list) · [roadmap.md](docs/roadmap.md) (milestones, plan) · [parity-checklist.m
Newest first.
+- **2026-10-21** · Properties › Character and Paragraph: ••• (More Options) expands the section in place, as InDesign's: Character adds vertical and horizontal scale, baseline shift, skew, language and OpenType, and All Caps, Small Caps, Superscript, Subscript, Underline and Strikethrough; Paragraph adds the left, right, first line and last line indents, space before and after, the drop cap's lines and characters, Align to Baseline Grid and Hyphenate. It used to open the Character or Paragraph panel; the language field moved under ••• as in InDesign. Found in the Learn Skills Daily course, chapter 16. No readiness percentage change.
- **2026-10-16** · Type › Reload Fonts (`font.reload`): fonts installed, edited or removed while DesignCraft runs are read again without a restart, and the open documents recompose with them (#328, #547). An edited font file is noticed by its length and modification time; bundled, added and document fonts stay as they are. InDesign does this by itself, so noticing changes automatically is still open (gap 6). No readiness percentage change.
- **2026-10-16** · Parents can be deleted from their Pages-panel context menu or `layout.parents.delete {id}`. Applied-page and based-on references are cleared, local override copies survive, and Undo restores the parent. Addresses the deletion portion of #956; no readiness percentage change.
- **2026-10-17** · File › Package writes the document's and the IDML's links relative to the package (`Links/logo.png`, `file:Links/logo.png`), so a package holds no path from the machine that made it; opening a document resolves them to the files beside it. Links › Copy Link(s) To still links by full path. (#340). No readiness percentage change.
diff --git a/crates/ui-egui/src/i18n.rs b/crates/ui-egui/src/i18n.rs
index efe089ef9..8dd4709f9 100644
--- a/crates/ui-egui/src/i18n.rs
+++ b/crates/ui-egui/src/i18n.rs
@@ -36,6 +36,47 @@ pub const LANGUAGES: &[(&str, &str)] = &[
/// English → [German, French, Spanish, Japanese, Simplified Chinese].
const TABLE: &[(&str, [&str; 5])] = &[
+ ("Vertical Scale", ["Vertikal skalieren", "Échelle verticale", "Escala vertical", "垂直比率", "垂直缩放"]),
+ ("Horizontal Scale", ["Horizontal skalieren", "Échelle horizontale", "Escala horizontal", "水平比率", "水平缩放"]),
+ ("Baseline Shift", ["Grundlinienversatz", "Décalage vertical", "Desplazamiento vertical", "ベースラインシフト", "基线偏移"]),
+ (
+ "Skew (False Italic)",
+ ["Verzerren (falscher Kursivstil)", "Inclinaison (faux italique)", "Sesgar (cursiva falsa)", "歪み(斜体)", "倾斜(伪斜体)"],
+ ),
+ ("Left Indent", ["Einzug links", "Retrait gauche", "Sangría izquierda", "左インデント", "左缩进"]),
+ ("Right Indent", ["Einzug rechts", "Retrait droit", "Sangría derecha", "右インデント", "右缩进"]),
+ (
+ "First Line Left Indent",
+ ["Einzug links in erster Zeile", "Retrait gauche de première ligne", "Sangría izquierda en primera línea", "1行目左インデント", "首行左缩进"],
+ ),
+ (
+ "Last Line Right Indent",
+ ["Einzug rechts in letzter Zeile", "Retrait droit de dernière ligne", "Sangría derecha en última línea", "最終行右インデント", "末行右缩进"],
+ ),
+ (
+ "Drop Cap Number of Lines",
+ ["Initiale: Anzahl der Zeilen", "Lettrine (nombre de lignes)", "Capitular: número de líneas", "ドロップキャップの行数", "首字下沉行数"],
+ ),
+ (
+ "Drop Cap One or More Characters",
+ [
+ "Initiale: ein oder mehrere Zeichen",
+ "Lettrine (un ou plusieurs caractères)",
+ "Capitular: uno o más caracteres",
+ "ドロップキャップの文字数",
+ "首字下沉一个或多个字符",
+ ],
+ ),
+ (
+ "Align to Baseline Grid",
+ [
+ "An Grundlinienraster ausrichten",
+ "Aligner sur la grille de ligne de base",
+ "Alinear con cuadrícula base",
+ "ベースライングリッドに揃える",
+ "对齐基线网格",
+ ],
+ ),
// Menus.
("File", ["Datei", "Fichier", "Archivo", "ファイル", "文件"]),
("Edit", ["Bearbeiten", "Édition", "Edición", "編集", "编辑"]),
diff --git a/crates/ui-egui/src/i18n/ar.rs b/crates/ui-egui/src/i18n/ar.rs
index b050de38b..9ce202c6e 100644
--- a/crates/ui-egui/src/i18n/ar.rs
+++ b/crates/ui-egui/src/i18n/ar.rs
@@ -30,6 +30,17 @@ pub(super) const TABLE: &[(&str, &str)] = &[
("Cut", "قص"),
("Copy", "نسخ"),
("Paste", "لصق"),
+ ("Vertical Scale", "المقياس الرأسي"),
+ ("Horizontal Scale", "المقياس الأفقي"),
+ ("Baseline Shift", "إزاحة خط الأساس"),
+ ("Skew (False Italic)", "إمالة (مائل زائف)"),
+ ("Left Indent", "مسافة بادئة يسرى"),
+ ("Right Indent", "مسافة بادئة يمنى"),
+ ("First Line Left Indent", "مسافة بادئة يسرى للسطر الأول"),
+ ("Last Line Right Indent", "مسافة بادئة يمنى للسطر الأخير"),
+ ("Drop Cap Number of Lines", "عدد أسطر الحرف الاستهلالي"),
+ ("Drop Cap One or More Characters", "حرف استهلالي واحد أو أكثر"),
+ ("Align to Baseline Grid", "محاذاة إلى شبكة خط الأساس"),
("Paste Vector Art", "لصق رسم متجه"),
("Baseline Options", "خيارات خط الأساس"),
("Fixed Number", "عدد ثابت"),
diff --git a/crates/ui-egui/src/i18n/cs.rs b/crates/ui-egui/src/i18n/cs.rs
index e77e72a1c..d6931c30e 100644
--- a/crates/ui-egui/src/i18n/cs.rs
+++ b/crates/ui-egui/src/i18n/cs.rs
@@ -31,6 +31,17 @@ pub(super) const TABLE: &[(&str, &str)] = &[
("Cut", "Vyjmout"),
("Copy", "Kopírovat"),
("Paste", "Vložit"),
+ ("Vertical Scale", "Svislá změna velikosti"),
+ ("Horizontal Scale", "Vodorovná změna velikosti"),
+ ("Baseline Shift", "Posun účaří"),
+ ("Skew (False Italic)", "Zkosení (nepravá kurzíva)"),
+ ("Left Indent", "Odsazení zleva"),
+ ("Right Indent", "Odsazení zprava"),
+ ("First Line Left Indent", "Odsazení prvního řádku zleva"),
+ ("Last Line Right Indent", "Odsazení posledního řádku zprava"),
+ ("Drop Cap Number of Lines", "Počet řádků iniciály"),
+ ("Drop Cap One or More Characters", "Iniciála: jeden nebo více znaků"),
+ ("Align to Baseline Grid", "Zarovnat na mřížku účaří"),
("Reverse Path", "Obrátit cestu"),
("Set Anchor", "Nastavit kotvu"),
("Clear", "Vymazat"),
diff --git a/crates/ui-egui/src/i18n/it.rs b/crates/ui-egui/src/i18n/it.rs
index a918a9829..9390fba86 100644
--- a/crates/ui-egui/src/i18n/it.rs
+++ b/crates/ui-egui/src/i18n/it.rs
@@ -28,6 +28,17 @@ pub(super) const TABLE: &[(&str, &str)] = &[
("Cut", "Taglia"),
("Copy", "Copia"),
("Paste", "Incolla"),
+ ("Vertical Scale", "Scala verticale"),
+ ("Horizontal Scale", "Scala orizzontale"),
+ ("Baseline Shift", "Spostamento linea di base"),
+ ("Skew (False Italic)", "Inclinazione (falso corsivo)"),
+ ("Left Indent", "Rientro sinistro"),
+ ("Right Indent", "Rientro destro"),
+ ("First Line Left Indent", "Rientro sinistro prima riga"),
+ ("Last Line Right Indent", "Rientro destro ultima riga"),
+ ("Drop Cap Number of Lines", "Capolettera: numero di righe"),
+ ("Drop Cap One or More Characters", "Capolettera: uno o più caratteri"),
+ ("Align to Baseline Grid", "Allinea alla griglia di base"),
("Paste Vector Art", "Incolla grafica vettoriale"),
("Baseline Options", "Opzioni linea di base"),
("Fixed Number", "Numero fisso"),
diff --git a/crates/ui-egui/src/i18n/ka.rs b/crates/ui-egui/src/i18n/ka.rs
index d938c2dc7..2085b64de 100644
--- a/crates/ui-egui/src/i18n/ka.rs
+++ b/crates/ui-egui/src/i18n/ka.rs
@@ -31,6 +31,17 @@ pub(super) const TABLE: &[(&str, &str)] = &[
("Cut", "ამოჭრა"),
("Copy", "კოპირება"),
("Paste", "ჩასმა"),
+ ("Vertical Scale", "ვერტიკალური მასშტაბი"),
+ ("Horizontal Scale", "ჰორიზონტალური მასშტაბი"),
+ ("Baseline Shift", "საბაზო ხაზის წანაცვლება"),
+ ("Skew (False Italic)", "დახრა (ცრუ კურსივი)"),
+ ("Left Indent", "მარცხენა შეწევა"),
+ ("Right Indent", "მარჯვენა შეწევა"),
+ ("First Line Left Indent", "პირველი სტრიქონის მარცხენა შეწევა"),
+ ("Last Line Right Indent", "ბოლო სტრიქონის მარჯვენა შეწევა"),
+ ("Drop Cap Number of Lines", "ინიციალის სტრიქონების რაოდენობა"),
+ ("Drop Cap One or More Characters", "ინიციალი: ერთი ან მეტი სიმბოლო"),
+ ("Align to Baseline Grid", "საბაზო ბადეზე სწორება"),
("Inches Decimal", "ინჩები (ათობითი)"),
("Back", "უკან"),
("Warning", "გაფრთხილება"),
diff --git a/crates/ui-egui/src/i18n/pl.rs b/crates/ui-egui/src/i18n/pl.rs
index 68d685d99..ee304632e 100644
--- a/crates/ui-egui/src/i18n/pl.rs
+++ b/crates/ui-egui/src/i18n/pl.rs
@@ -29,6 +29,17 @@ pub(super) const TABLE: &[(&str, &str)] = &[
("Cut", "Wytnij"),
("Copy", "Kopiuj"),
("Paste", "Wklej"),
+ ("Vertical Scale", "Skala pionowa"),
+ ("Horizontal Scale", "Skala pozioma"),
+ ("Baseline Shift", "Przesunięcie linii bazowej"),
+ ("Skew (False Italic)", "Pochylenie (fałszywa kursywa)"),
+ ("Left Indent", "Wcięcie z lewej"),
+ ("Right Indent", "Wcięcie z prawej"),
+ ("First Line Left Indent", "Wcięcie pierwszego wiersza z lewej"),
+ ("Last Line Right Indent", "Wcięcie ostatniego wiersza z prawej"),
+ ("Drop Cap Number of Lines", "Inicjał: liczba wierszy"),
+ ("Drop Cap One or More Characters", "Inicjał: jeden lub więcej znaków"),
+ ("Align to Baseline Grid", "Wyrównaj do siatki linii bazowych"),
("Clear", "Wyczyść"),
("Duplicate", "Powiel"),
("Select All", "Zaznacz wszystko"),
diff --git a/crates/ui-egui/src/i18n/pt_br.rs b/crates/ui-egui/src/i18n/pt_br.rs
index 8521de594..89bc29f6a 100644
--- a/crates/ui-egui/src/i18n/pt_br.rs
+++ b/crates/ui-egui/src/i18n/pt_br.rs
@@ -31,6 +31,17 @@ pub(super) const TABLE: &[(&str, &str)] = &[
("Cut", "Recortar"),
("Copy", "Copiar"),
("Paste", "Colar"),
+ ("Vertical Scale", "Escala vertical"),
+ ("Horizontal Scale", "Escala horizontal"),
+ ("Baseline Shift", "Deslocamento da linha de base"),
+ ("Skew (False Italic)", "Inclinação (falso itálico)"),
+ ("Left Indent", "Recuo à esquerda"),
+ ("Right Indent", "Recuo à direita"),
+ ("First Line Left Indent", "Recuo à esquerda da primeira linha"),
+ ("Last Line Right Indent", "Recuo à direita da última linha"),
+ ("Drop Cap Number of Lines", "Capitular: número de linhas"),
+ ("Drop Cap One or More Characters", "Capitular: um ou mais caracteres"),
+ ("Align to Baseline Grid", "Alinhar à grade de linha de base"),
("Paste Vector Art", "Colar arte vetorial"),
("Baseline Options", "Opções de linha de base"),
("Fixed Number", "Número fixo"),
diff --git a/crates/ui-egui/src/i18n/ru.rs b/crates/ui-egui/src/i18n/ru.rs
index 251555ca5..6706b9fb1 100644
--- a/crates/ui-egui/src/i18n/ru.rs
+++ b/crates/ui-egui/src/i18n/ru.rs
@@ -33,6 +33,17 @@ pub(super) const TABLE: &[(&str, &str)] = &[
("Cut", "Вырезать"),
("Copy", "Копировать"),
("Paste", "Вставить"),
+ ("Vertical Scale", "Масштаб по вертикали"),
+ ("Horizontal Scale", "Масштаб по горизонтали"),
+ ("Baseline Shift", "Смещение базовой линии"),
+ ("Skew (False Italic)", "Наклон (ложный курсив)"),
+ ("Left Indent", "Отступ слева"),
+ ("Right Indent", "Отступ справа"),
+ ("First Line Left Indent", "Отступ первой строки слева"),
+ ("Last Line Right Indent", "Отступ последней строки справа"),
+ ("Drop Cap Number of Lines", "Буквица: число строк"),
+ ("Drop Cap One or More Characters", "Буквица: один или несколько символов"),
+ ("Align to Baseline Grid", "Выровнять по сетке базовых линий"),
("Clear", "Очистить"),
("Duplicate", "Дублировать"),
("Select All", "Выделить все"),
diff --git a/crates/ui-egui/src/i18n/uk.rs b/crates/ui-egui/src/i18n/uk.rs
index dd4a1434d..f3402b9d6 100644
--- a/crates/ui-egui/src/i18n/uk.rs
+++ b/crates/ui-egui/src/i18n/uk.rs
@@ -29,6 +29,17 @@ pub(super) const TABLE: &[(&str, &str)] = &[
("Cut", "Вирізати"),
("Copy", "Копіювати"),
("Paste", "Вставити"),
+ ("Vertical Scale", "Масштаб по вертикалі"),
+ ("Horizontal Scale", "Масштаб по горизонталі"),
+ ("Baseline Shift", "Зсув базової лінії"),
+ ("Skew (False Italic)", "Нахил (несправжній курсив)"),
+ ("Left Indent", "Відступ ліворуч"),
+ ("Right Indent", "Відступ праворуч"),
+ ("First Line Left Indent", "Відступ першого рядка ліворуч"),
+ ("Last Line Right Indent", "Відступ останнього рядка праворуч"),
+ ("Drop Cap Number of Lines", "Буквиця: кількість рядків"),
+ ("Drop Cap One or More Characters", "Буквиця: один або кілька символів"),
+ ("Align to Baseline Grid", "Вирівняти за сіткою базових ліній"),
("Paste Vector Art", "Вставити векторну графіку"),
("Baseline Options", "Параметри базової лінії"),
("Fixed Number", "Фіксована кількість"),
diff --git a/crates/ui-egui/src/icons.rs b/crates/ui-egui/src/icons.rs
index a90fe989e..446b412fe 100644
--- a/crates/ui-egui/src/icons.rs
+++ b/crates/ui-egui/src/icons.rs
@@ -938,6 +938,77 @@ pub fn paint(p: &Painter, r: Rect, name: &str, c: Color32) {
pen.line(&[(15.0, 13.5), (17.0, 15.5), (15.0, 17.5)]);
}
}
+ "vscale" => {
+ pen.text(13.0, 10.5, "T", 15.0);
+ pen.line(&[(4.0, 3.0), (4.0, 17.0)]);
+ pen.line(&[(2.5, 5.0), (4.0, 3.0), (5.5, 5.0)]);
+ pen.line(&[(2.5, 15.0), (4.0, 17.0), (5.5, 15.0)]);
+ }
+ "hscale" => {
+ pen.text(10.0, 8.0, "T", 13.0);
+ pen.line(&[(3.0, 16.5), (17.0, 16.5)]);
+ pen.line(&[(5.0, 14.5), (3.0, 16.5), (5.0, 18.5)]);
+ pen.line(&[(15.0, 14.5), (17.0, 16.5), (15.0, 18.5)]);
+ }
+ "baseline-shift" => {
+ pen.text(7.0, 11.0, "A", 13.0);
+ pen.text(15.5, 5.5, "a", 8.0);
+ pen.line(&[(15.5, 17.5), (15.5, 10.0)]);
+ pen.line(&[(13.5, 12.0), (15.5, 10.0), (17.5, 12.0)]);
+ }
+ "skew" => {
+ pen.w = 1.8;
+ pen.line(&[(7.0, 4.0), (17.0, 4.0)]);
+ pen.line(&[(12.0, 4.0), (8.0, 17.0)]);
+ }
+ "indent-left" | "indent-right" | "indent-first" | "indent-last" => {
+ // Text lines, and an arrow at the side (or line) indented.
+ let (x0, x1) = match name {
+ "indent-left" => (9.0, 18.0),
+ "indent-right" => (2.0, 11.0),
+ _ => (2.0, 18.0),
+ };
+ for (k, y) in [4.0, 8.0, 12.0, 16.0].into_iter().enumerate() {
+ let (a, z) = match (name, k) {
+ ("indent-first", 0) => (9.0, x1),
+ ("indent-last", 3) => (x0, 11.0),
+ _ => (x0, x1),
+ };
+ pen.line(&[(a, y), (z, y)]);
+ }
+ let (y, from, to) = match name {
+ "indent-left" => (10.0, 2.0, 7.0),
+ "indent-right" => (10.0, 18.0, 13.0),
+ "indent-first" => (4.0, 2.0, 7.0),
+ _ => (16.0, 18.0, 13.0),
+ };
+ pen.line(&[(from, y), (to, y)]);
+ let d = if to > from { -2.0 } else { 2.0 };
+ pen.line(&[(to + d, y - 2.0), (to, y), (to + d, y + 2.0)]);
+ }
+ "space-before" | "space-after" => {
+ let before = name == "space-before";
+ let (bar, lines) = if before { (3.0, [11.0, 14.5, 18.0]) } else { (17.0, [2.0, 5.5, 9.0]) };
+ pen.line(&[(2.0, bar), (18.0, bar)]);
+ for y in lines {
+ pen.line(&[(8.0, y), (18.0, y)]);
+ }
+ let (a, z) = if before { (5.0, 10.0) } else { (10.0, 15.0) };
+ pen.line(&[(4.0, a), (4.0, z)]);
+ pen.line(&[(2.5, a + 1.5), (4.0, a), (5.5, a + 1.5)]);
+ pen.line(&[(2.5, z - 1.5), (4.0, z), (5.5, z - 1.5)]);
+ }
+ "drop-lines" | "drop-chars" => {
+ pen.text(5.5, 8.0, "A", 14.0);
+ if name == "drop-chars" {
+ pen.text(13.5, 4.5, "a", 8.0);
+ }
+ for (y, x) in [(if name == "drop-chars" { 8.5 } else { 3.5 }, 11.0), (8.5, 11.0), (13.5, 11.0), (17.5, 2.0)] {
+ if name == "drop-lines" || y > 5.0 {
+ pen.line(&[(x, y), (18.0, y)]);
+ }
+ }
+ }
"corner" => {
pen.w = 1.0;
for (x, y) in [(3.0, 3.0), (14.0, 3.0), (3.0, 14.0), (14.0, 14.0)] {
diff --git a/crates/ui-egui/src/panels/properties.rs b/crates/ui-egui/src/panels/properties.rs
index 44acf6e2c..8d7abdd9a 100644
--- a/crates/ui-egui/src/panels/properties.rs
+++ b/crates/ui-egui/src/panels/properties.rs
@@ -1312,21 +1312,132 @@ fn character_section(app: &mut DesignApp, ui: &mut Ui) {
}) {
let _ = app.run("type.char", json!({"attrs": {"tracking": v}}));
}
- // Language: hyphenation, spelling and typographer's quotes follow it.
- ui.add_space(1.0);
+ // ••• shows the rest in place, as InDesign's Properties panel does.
+ let more = temp_bool(ui, "props_char_more", false);
+ if more {
+ character_more(app, ui, &c, fw);
+ }
+ if more_options(ui, &app.ui.language).clicked() {
+ set_temp_bool(ui, "props_char_more", !more);
+ }
+}
+
+/// A percentage or other number field in one half of a two-field row, with its icon.
+#[allow(clippy::too_many_arguments)]
+fn half_field(ui: &mut Ui, b: Rect, right: bool, y: f32, half: f32, icon: &str, tip: &str, field: NumField) -> Option<f64> {
+ let t = Tokens::get(ui.ctx());
+ let x = if right { half + 10.0 } else { 0.0 };
+ let ir = sub(b, x, y + 1.0, 19.0, 19.0);
+ icons::paint(ui.painter(), ir, icon, t.icon);
+ ui.interact(ir, ui.id().with(("half_icon", icon)), Sense::hover()).on_hover_text(tip);
+ place(ui, sub(b, x + 24.0, y, half - 24.0, FIELD_H), |ui| field.width(half - 24.0).show(ui))
+}
+
+/// Properties › Character after •••: vertical and horizontal scale, baseline shift and skew,
+/// language and OpenType, then All Caps, Small Caps, Superscript, Subscript, Underline and
+/// Strikethrough, as InDesign lays them out.
+fn character_more(app: &mut DesignApp, ui: &mut Ui, c: &Value, fw: f32) {
+ let lang_ui = app.ui.language.clone();
+ let tr = |s: &str| crate::i18n::tr(&lang_ui, s).to_string();
+ let half = (fw - 10.0) / 2.0;
+ let b = block(ui, 2.0 * FIELD_H + 5.0);
+ const SCALES: &[f64] = &[25.0, 50.0, 75.0, 80.0, 90.0, 100.0, 110.0, 120.0, 125.0, 150.0, 200.0];
+ let pct = |v: &Value| v.as_f64().map(|s| (s * 1000.0).round() / 10.0);
+ let field = |id, v, suffix, decimals| NumField::number(id, v, suffix, decimals).spinner();
+ if let Some(v) = half_field(
+ ui,
+ b,
+ false,
+ 0.0,
+ half,
+ "vscale",
+ &tr("Vertical Scale"),
+ field("cvscale", pct(&c["vScale"]), "%", 1).presets(SCALES).range(1.0, 1000.0),
+ ) {
+ let _ = app.run("type.char", json!({"attrs": {"vScale": v / 100.0}}));
+ }
+ if let Some(v) = half_field(
+ ui,
+ b,
+ true,
+ 0.0,
+ half,
+ "hscale",
+ &tr("Horizontal Scale"),
+ field("chscale", pct(&c["hScale"]), "%", 1).presets(SCALES).range(1.0, 1000.0),
+ ) {
+ let _ = app.run("type.char", json!({"attrs": {"hScale": v / 100.0}}));
+ }
+ if let Some(v) = half_field(
+ ui,
+ b,
+ false,
+ 26.0,
+ half,
+ "baseline-shift",
+ &tr("Baseline Shift"),
+ field("cbshift", c["baselineShift"].as_f64(), " pt", 2).range(-5000.0, 5000.0),
+ ) {
+ let _ = app.run("type.char", json!({"attrs": {"baselineShift": v}}));
+ }
+ if let Some(v) =
+ half_field(ui, b, true, 26.0, half, "skew", &tr("Skew (False Italic)"), field("cskew", c["skew"].as_f64(), "°", 1).range(-85.0, 85.0))
+ {
+ let _ = app.run("type.char", json!({"attrs": {"skew": v}}));
+ }
+ // Language (hyphenation, spelling and typographer's quotes follow it) and OpenType.
+ ui.add_space(4.0);
let lang = c["language"].as_str().unwrap_or("English: USA").to_string();
- let label = crate::i18n::tr(&app.ui.language, "Language");
- let resp = widgets::dropdown(ui, crate::i18n::tr(&app.ui.language, &lang), fw).on_hover_ui(|ui| {
- crate::rtl::label(ui, label);
+ let label = tr("Language");
+ let row = block(ui, FIELD_H);
+ let resp = place(ui, sub(row, 0.0, 0.0, half, FIELD_H), |ui| widgets::dropdown(ui, crate::i18n::tr(&lang_ui, &lang), half)).on_hover_ui(|ui| {
+ crate::rtl::label(ui, label.clone());
});
- resp.widget_info(|| egui::WidgetInfo::labeled(egui::WidgetType::ComboBox, true, label));
+ resp.widget_info(|| egui::WidgetInfo::labeled(egui::WidgetType::ComboBox, true, &label));
egui::Popup::menu(&resp).show(|ui| {
- ui.set_min_width(fw);
+ ui.set_min_width(half);
egui::ScrollArea::vertical().max_height(320.0).show(ui, |ui| language_menu(app, ui, &lang));
});
- if more_options(ui, &app.ui.language).clicked() {
- show_panel(app, "character");
+ if place(ui, sub(row, half + 10.0, 0.0, half, FIELD_H), |ui| widgets::outline_button(ui, &tr("OpenType"), half)).clicked() {
+ show_typography_panel(app);
+ }
+ // The case and position buttons.
+ ui.add_space(8.0);
+ let caps = c["capitalization"].as_str().unwrap_or("normal").to_string();
+ let pos = c["position"].as_str().unwrap_or("normal").to_string();
+ let (ul, st) = (c["underline"].as_bool().unwrap_or(false), c["strikethrough"].as_bool().unwrap_or(false));
+ let buttons: [(&str, &str, bool, Value); 6] = [
+ ("TT", "All Caps", caps == "allCaps", json!({"capitalization": if caps == "allCaps" { "normal" } else { "allCaps" }})),
+ ("Tᴛ", "Small Caps", caps == "smallCaps", json!({"capitalization": if caps == "smallCaps" { "normal" } else { "smallCaps" }})),
+ ("T¹", "Superscript", pos == "superscript", json!({"position": if pos == "superscript" { "normal" } else { "superscript" }})),
+ ("T₁", "Subscript", pos == "subscript", json!({"position": if pos == "subscript" { "normal" } else { "subscript" }})),
+ ("T̲", "Underline", ul, json!({"underline": !ul})),
+ ("T", "Strikethrough", st, json!({"strikethrough": !st})),
+ ];
+ let pitch = fw / 6.0;
+ let row = block(ui, 22.0);
+ for (i, (text, tip, on, attrs)) in buttons.into_iter().enumerate() {
+ let r = Rect::from_center_size(row.min + vec2(pitch * (i as f32 + 0.5), 11.0), vec2(26.0, 22.0));
+ let resp = ui.interact(r, ui.id().with(("case", i)), Sense::click());
+ let t = Tokens::get(ui.ctx());
+ if on {
+ ui.painter().rect_filled(r, 2.0, t.tool_active);
+ } else if resp.hovered() {
+ ui.painter().rect_filled(r, 2.0, t.hover);
+ }
+ let col = if on { t.text_strong } else { t.icon };
+ ui.painter().text(r.center(), egui::Align2::CENTER_CENTER, text, egui::FontId::proportional(13.0), col);
+ // Strikethrough: the T struck through (a combining stroke doesn't draw in every font).
+ if i == 5 {
+ ui.painter().line_segment([r.center() + vec2(-6.0, 0.5), r.center() + vec2(6.0, 0.5)], Stroke::new(1.2, col));
+ }
+ let tip = tr(tip);
+ resp.widget_info(|| egui::WidgetInfo::selected(egui::WidgetType::Button, true, on, &tip));
+ if resp.on_hover_text(&tip).clicked() {
+ let _ = app.run("type.char", json!({"attrs": attrs}));
+ }
}
+ ui.add_space(4.0);
}
/// Paragraph section: the 9 alignment buttons and •••.
@@ -1356,11 +1467,65 @@ fn paragraph_section(app: &mut DesignApp, ui: &mut Ui) {
}
}
});
+ let more = temp_bool(ui, "props_para_more", false);
+ if more {
+ paragraph_more(app, ui, &a["para"], fw);
+ }
if more_options(ui, &app.ui.language).clicked() {
- show_panel(app, "paragraph");
+ set_temp_bool(ui, "props_para_more", !more);
}
}
+/// Properties › Paragraph after •••: left and right indent, first line and last line indent,
+/// space before and after, drop cap lines and characters, then Hyphenate and Align to Baseline
+/// Grid, as InDesign lays them out.
+fn paragraph_more(app: &mut DesignApp, ui: &mut Ui, p: &Value, fw: f32) {
+ let lang_ui = app.ui.language.clone();
+ let tr = |s: &str| crate::i18n::tr(&lang_ui, s).to_string();
+ let u = units(app);
+ let half = (fw - 10.0) / 2.0;
+ ui.add_space(4.0);
+ let b = block(ui, 4.0 * FIELD_H + 15.0);
+ let rows = [
+ (("indent-left", "Left Indent", "leftIndent"), ("indent-right", "Right Indent", "rightIndent")),
+ (("indent-first", "First Line Left Indent", "firstLineIndent"), ("indent-last", "Last Line Right Indent", "lastLineIndent")),
+ (("space-before", "Space Before", "spaceBefore"), ("space-after", "Space After", "spaceAfter")),
+ ];
+ for (i, (l, r)) in rows.into_iter().enumerate() {
+ let y = i as f32 * (FIELD_H + 5.0);
+ for (right, (icon, tip, key)) in [(false, l), (true, r)] {
+ let min = if key == "firstLineIndent" { -10_000.0 } else { 0.0 };
+ let field = NumField::measure(key, p[key].as_f64(), u).spinner().range(min, 10_000.0);
+ if let Some(v) = half_field(ui, b, right, y, half, icon, &tr(tip), field) {
+ let _ = app.run("type.para", json!({"attrs": {key: v}}));
+ }
+ }
+ }
+ let y = 3.0 * (FIELD_H + 5.0);
+ for (right, icon, tip, key, max) in [
+ (false, "drop-lines", "Drop Cap Number of Lines", "dropCapLines", designcraft_compose::MAX_DROP_CAP_LINES),
+ (true, "drop-chars", "Drop Cap One or More Characters", "dropCapChars", designcraft_compose::MAX_DROP_CAP_CHARS),
+ ] {
+ let field = NumField::number(key, p[key].as_f64(), "", 0).spinner().range(0.0, max as f64);
+ if let Some(v) = half_field(ui, b, right, y, half, icon, &tr(tip), field) {
+ let _ = app.run("type.para", json!({"attrs": {key: (v.max(0.0) as u64).min(max as u64)}}));
+ }
+ }
+ ui.add_space(4.0);
+ ui.horizontal(|ui| {
+ let grid = p["gridAlign"].as_str() == Some("allLines");
+ if widgets::icon_toggle(ui, "grid-baseline", grid, &tr("Align to Baseline Grid")).clicked() {
+ let _ = app.run("type.para", json!({"attrs": {"gridAlign": if grid { "none" } else { "allLines" }}}));
+ }
+ ui.add_space(12.0);
+ let mut h = p["hyphenate"].as_bool().unwrap_or(true);
+ if widgets::checkbox(ui, &mut h, &tr("Hyphenate")).changed() {
+ let _ = app.run("type.para", json!({"attrs": {"hyphenate": h}}));
+ }
+ });
+ ui.add_space(4.0);
+}
+
fn bullets_section(app: &mut DesignApp, ui: &mut Ui) {
let Some(a) = text_attrs(app) else { return };
let lt = a["para"]["listType"].as_str().unwrap_or("none").to_string();
@@ -3058,6 +3223,9 @@ mod tests {
app,
);
h.run_steps(3);
+ assert!(h.query_by_label("Language").is_none(), "under •••, as in InDesign");
+ h.get_all_by_label("More Options").next().unwrap().click();
+ h.run_steps(3);
h.get_by_label("Language").click();
h.run_steps(2);
h.get_by_label("French").click();
@@ -3065,6 +3233,40 @@ mod tests {
assert_eq!(language(h.state_mut()), "French");
}
+ /// Properties › Character and Paragraph •••, as in InDesign: the sections expand in place,
+ /// with the scales, baseline shift, skew, language, OpenType and the case buttons, and the
+ /// indents, spacing and drop caps.
+ #[test]
+ fn more_options_expand_character_and_paragraph_in_place() {
+ let mut app = DesignApp::new(designcraft_engine::Session::new(), crate::Services::default());
+ app.run("file.new", json!({})).unwrap();
+ app.run("frame.create", json!({"rect": [72, 72, 300, 200], "content": "text", "text": "If fine plants", "caret": true})).unwrap();
+ app.run("edit.selectAll", json!({})).unwrap();
+ let mut h = panel_harness(app, show);
+ h.run_steps(3);
+ for l in ["Vertical Scale", "Small Caps", "Drop Cap Number of Lines", "Space Before"] {
+ assert!(h.query_by_label(l).is_none(), "{l} hidden until •••");
+ }
+ h.get_all_by_label("More Options").next().unwrap().click();
+ h.run_steps(3);
+ h.get_by_label("Small Caps").click();
+ h.run_steps(3);
+ let _ = h.get_by_label("OpenType");
+ let _ = h.get_by_label("Language");
+ h.get_all_by_label("More Options").nth(1).unwrap().click();
+ h.run_steps(3);
+ let _ = h.get_by_label("Hyphenate");
+ h.get_by_label("Align to Baseline Grid").click();
+ h.run_steps(3);
+ let a = text_attrs(h.state_mut()).unwrap();
+ assert_eq!(a["chars"]["capitalization"], "smallCaps");
+ assert_eq!(a["para"]["gridAlign"], "allLines");
+ // ••• again folds the section.
+ h.get_all_by_label("More Options").next().unwrap().click();
+ h.run_steps(3);
+ assert!(h.query_by_label("Small Caps").is_none());
+ }
+
fn kerning(app: &mut DesignApp) -> Value {
text_attrs(app).unwrap()["chars"]["kerning"].clone()
}
diff --git a/crates/ui-egui/src/widgets.rs b/crates/ui-egui/src/widgets.rs
index fb9876aa2..cf7762cbd 100644
--- a/crates/ui-egui/src/widgets.rs
+++ b/crates/ui-egui/src/widgets.rs
@@ -382,6 +382,8 @@ pub fn more_options(ui: &mut Ui, language: &str) -> Response {
let (row, _) = ui.allocate_exact_size(vec2(ui.available_width(), 14.0), Sense::hover());
let r = Rect::from_min_max(pos2(row.max.x - 26.0, row.min.y), pos2(row.max.x - 4.0, row.max.y));
let resp = ui.interact(r, ui.id().with(("more", row.min.y as i32)), Sense::click());
+ let label = crate::i18n::tr(language, "More Options");
+ resp.widget_info(|| egui::WidgetInfo::labeled(egui::WidgetType::Button, true, label));
for i in 0..3 {
ui.painter().circle_filled(pos2(r.min.x + 4.0 + i as f32 * 7.0, r.center().y), 1.9, if resp.hovered() { t.text_strong } else { t.icon });
}
@@ -567,6 +569,8 @@ pub fn checkbox(ui: &mut Ui, on: &mut bool, label: &str) -> Response {
*on = !*on;
resp.mark_changed();
}
+ let checked = *on;
+ resp.widget_info(|| egui::WidgetInfo::selected(egui::WidgetType::Checkbox, true, checked, label));
resp
}