From 99c4a82b3088efaebb181d065f2c2b9d090e99b1 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sat, 21 Nov 2026 19:43:40 -0800 Subject: [PATCH] Tabs: fallback glyphs in tab titles sit on the condensed face's baseline The tab family's copies of the semibold faces took the copy made for egui's empty Proportional family, which has no baseline shift, instead of the one made for the tab family. They now take the tab family's copy. egui's own faces stay under their own names, as in the semibold family: egui skips some of their characters (the Ubuntu logo, two symbols in its emoji face) only under those names. ui_fonts::baseline_copies measured a fallback face without its own FontTweak scale, while egui draws the face and its y_offset_factor at that scale. The shift now uses it, so a scaled fallback (Inter SemiBold at 0.92) sits on the row's baseline. Faces added before this change are at scale 1 and keep their shift. Without the condensed face the tab family is no longer bound, and tabs draw in theme::tab_title_font: the tab family when the context's fonts bind it, otherwise the semibold family as it is. Fonts an embedder adds to the semibold family then reach tab titles too, and an embedder's own definitions that bind only the other families keep working. The condensed face and the lookup of its catalog row move to build/condensed_ui_face.rs, which the crate's tests include. With CRAFT_FONTS_REQUIRED=1, an unreadable catalog, a malformed row for the face or a row whose file can't be embedded is a build error; a checkout without the catalog or the row still gives a warning. A checkout whose catalog names the condensed face without its file is watched through the file's folder inside the checkout, so the build runs again once the file appears. docs/development.md lists FONT_TAB among the families an embedder adds fonts to. ASSETS.md and NOTICE name the face, and the docs/ui-parity.md row says official builds wait for the craft-fonts pin to move. Tests: with the monospace face standing in for the condensed face, and without craft-fonts, one test checks the tab family's x-height, the baseline of a character only the semibold face has, and that the characters egui skips draw in a tab title as in semibold text. Two tab-strip tests check that titles are laid out in the tab family with a stand-in face and in the semibold family without one. The condensed-face test checks the x-height at 200 pt, the shortened-title test also runs in the tab font, the install_fonts test checks the tab family, and ui_fonts' no-craft-fonts test allows the condensed face, which a checkout can give alone. A text-crate test finds the face's row as craft-fonts' catalog has it and rejects malformed rows for it. Two comments use American spelling. --- ASSETS.md | 2 +- NOTICE | 2 + crates/text/build.rs | 52 +++++++----- crates/text/build/condensed_ui_face.rs | 45 ++++++++++ crates/text/src/lib.rs | 3 + crates/ui-egui/src/chrome/tabs.rs | 7 +- crates/ui-egui/src/chrome/tests.rs | 22 ++--- crates/ui-egui/src/i18n/tests.rs | 3 + crates/ui-egui/src/tests/tab_overflow.rs | 79 +++++++++++++++++- crates/ui-egui/src/theme.rs | 101 +++++++++++++++++++---- crates/ui-egui/src/ui_fonts.rs | 26 +++--- crates/ui-egui/tests/install_fonts.rs | 14 +++- docs/development.md | 8 +- docs/ui-parity.md | 2 +- 14 files changed, 299 insertions(+), 67 deletions(-) create mode 100644 crates/text/build/condensed_ui_face.rs diff --git a/ASSETS.md b/ASSETS.md index 2812067e00..b949197d4c 100644 --- a/ASSETS.md +++ b/ASSETS.md @@ -24,7 +24,7 @@ Generated-in-code art is original and has no file to list. This covers the defau **Font files are never committed here.** Fonts shared by the Crafting Apps live in [storytold/craft-fonts](https://github.com/storytold/craft-fonts). The small Latin UI/document fonts below predate that rule and stay. -**Optional build input: craft-fonts.** Builds made with `CRAFT_FONTS_DIR=` (all official releases) embed the Japanese fonts listed in its [`ATTRIBUTION.md`](https://github.com/storytold/craft-fonts/blob/main/ATTRIBUTION.md): BIZ UDPGothic Regular and Bold, Shippori Mincho Regular and BIZ UDMincho Regular (web builds: BIZ UDPGothic Regular only), all under the SIL Open Font License 1.1. They are not files in this repository; release packages carry each one's `OFL-.txt`. Builds without `CRAFT_FONTS_DIR` embed none of them. +**Optional build input: craft-fonts.** Builds made with `CRAFT_FONTS_DIR=` (all official releases) embed the Japanese fonts listed in its [`ATTRIBUTION.md`](https://github.com/storytold/craft-fonts/blob/main/ATTRIBUTION.md): BIZ UDPGothic Regular and Bold, Shippori Mincho Regular and BIZ UDMincho Regular (web builds: BIZ UDPGothic Regular only), all under the SIL Open Font License 1.1. They are not files in this repository; release packages carry each one's `OFL-.txt`. Builds without `CRAFT_FONTS_DIR` embed none of them. Desktop builds with a checkout whose opt-in `fonts/latin-manifest.txt` lists Noto Sans Condensed SemiBold (The Noto Project Authors, SIL Open Font License 1.1, from the [notofonts/latin-greek-cyrillic NotoSans-v2.015 release](https://github.com/notofonts/latin-greek-cyrillic/releases/tag/NotoSans-v2.015)) also embed that face, for document tab titles. | Asset | Author | Source | Licence | Notes | |---|---|---|---|---| diff --git a/NOTICE b/NOTICE index 434cd3e524..99470afd8e 100644 --- a/NOTICE +++ b/NOTICE @@ -45,6 +45,8 @@ fonts listed in https://github.com/storytold/craft-fonts/blob/main/ATTRIBUTION.m Shippori Mincho, BIZ UDMincho, Noto Sans CJK SC and Noto Sans Arabic in the current manifest; web builds BIZ UDPGothic Regular only) under the SIL Open Font License 1.1. Their license texts ship with the release packages as OFL-.txt. +Desktop builds with a craft-fonts checkout whose fonts/latin-manifest.txt lists Noto Sans Condensed +SemiBold (Copyright 2022 The Noto Project Authors, SIL Open Font License 1.1) also embed that face. PDF import decodes CJK text with Adobe's CMap resources (https://github.com/adobe-type-tools/cmap-resources), compiled into the app through the hayro-cmap crate under the BSD 3-Clause License: diff --git a/crates/text/build.rs b/crates/text/build.rs index 5979c6557c..2658094965 100644 --- a/crates/text/build.rs +++ b/crates/text/build.rs @@ -14,12 +14,16 @@ //! out with a warning, never an error, and never costs the desktop its fonts. //! //! On native targets it writes `CONDENSED_UI_FONT`: the condensed face document tab titles draw in -//! (`CONDENSED_UI_FACE`), the one row it reads from the opt-in `fonts/latin-manifest.txt`. A -//! checkout without that row leaves it `None` with a warning, never an error. +//! (`build/condensed_ui_face.rs`), the one row it reads from the opt-in `fonts/latin-manifest.txt`. +//! A checkout without the catalog or that row leaves it `None` with a warning, never an error; an +//! unreadable catalog, a malformed row or a file that can't be embedded is an error with +//! `CRAFT_FONTS_REQUIRED=1`. use std::fmt::Write as _; use std::path::{Path, PathBuf}; +#[path = "build/condensed_ui_face.rs"] +mod condensed_ui_face; #[path = "build/web_fonts.rs"] mod web_fonts; @@ -28,6 +32,7 @@ fn main() { println!("cargo::rerun-if-env-changed=CRAFT_FONTS_REQUIRED"); println!("cargo::rerun-if-changed=web-fonts.txt"); println!("cargo::rerun-if-changed=build/web_fonts.rs"); + println!("cargo::rerun-if-changed=build/condensed_ui_face.rs"); let required = std::env::var_os("CRAFT_FONTS_REQUIRED").is_some(); let (mut fonts, mut web, mut condensed) = (String::new(), String::new(), String::from("None")); if let Some(dir) = std::env::var_os("CRAFT_FONTS_DIR").filter(|d| !d.is_empty()).map(PathBuf::from) { @@ -55,7 +60,8 @@ fn main() { if std::env::var("CARGO_CFG_TARGET_ARCH").is_ok_and(|a| a != "wasm32") { match condensed_ui_font(&dir) { Ok(entry) => condensed = format!("Some({entry})"), - Err(e) => println!("cargo::warning=document tabs draw in the interface face: CRAFT_FONTS_DIR={}: {e}", dir.display()), + Err((e, true)) if required => println!("cargo::error=CRAFT_FONTS_DIR={}: {e}", dir.display()), + Err((e, _)) => println!("cargo::warning=document tabs draw in the interface face: CRAFT_FONTS_DIR={}: {e}", dir.display()), } } } @@ -108,7 +114,7 @@ fn craft_fonts(dir: &Path) -> Result { Ok(out) } -/// The `CraftFont { .. }` initialiser of one manifest row of the checkout `dir` (canonical `root`). +/// The `CraftFont { .. }` initializer of one manifest row of the checkout `dir` (canonical `root`). fn craft_font(dir: &Path, root: &Path, family: &str, style: &str, file: &str, scripts: &str) -> Result { let path = dir.join(file).canonicalize().map_err(|e| format!("{file}: {e}"))?; // The manifest is supplier data: embed only regular files inside the checkout. @@ -124,29 +130,33 @@ fn craft_font(dir: &Path, root: &Path, family: &str, style: &str, file: &str, sc )) } -/// The condensed craft-fonts face (family, style) document tab titles draw in, from the opt-in -/// Latin catalog. -const CONDENSED_UI_FACE: (&str, &str) = ("Noto Sans", "Condensed SemiBold"); - -/// The `CraftFont { .. }` initialiser of [`CONDENSED_UI_FACE`]'s row in `fonts/latin-manifest.txt`. -fn condensed_ui_font(dir: &Path) -> Result { +/// The `CraftFont { .. }` initializer of the condensed face's row in `fonts/latin-manifest.txt` +/// (`build/condensed_ui_face.rs`). The error says whether the checkout is broken: one without the +/// catalog or the row is an older craft-fonts, and an unreadable catalog, a malformed row or a row +/// whose file can't be embedded is broken. +fn condensed_ui_font(dir: &Path) -> Result { + let (family, style) = condensed_ui_face::FACE; let manifest = dir.join("fonts/latin-manifest.txt"); // A checkout without the catalog is watched through its folder, so the build runs again once // the catalog appears. let watched = if manifest.is_file() { manifest.clone() } else { dir.join("fonts") }; println!("cargo::rerun-if-changed={}", watched.display()); - let text = std::fs::read_to_string(&manifest).map_err(|e| format!("{}: {e} (an older craft-fonts?)", manifest.display()))?; - let root = dir.canonicalize().map_err(|e| format!("{}: {e}", dir.display()))?; - let row = text - .lines() - .map(str::trim) - .filter(|l| !l.is_empty() && !l.starts_with('#')) - .map(|l| l.split(" | ").map(str::trim).collect::>()) - .find(|f| f.first() == Some(&CONDENSED_UI_FACE.0) && f.get(1) == Some(&CONDENSED_UI_FACE.1)); - let Some([family, style, file, scripts, ..]) = row.as_deref() else { - return Err(format!("{} {} not in {} (an older craft-fonts?)", CONDENSED_UI_FACE.0, CONDENSED_UI_FACE.1, manifest.display())); + let text = std::fs::read_to_string(&manifest).map_err(|e| { + let older = e.kind() == std::io::ErrorKind::NotFound; + (format!("{}: {e}{}", manifest.display(), if older { " (an older craft-fonts?)" } else { "" }), !older) + })?; + let row = condensed_ui_face::row(&text).map_err(|e| (format!("{}: {e}", manifest.display()), true))?; + let Some((file, scripts)) = row else { + return Err((format!("{family} {style} not in {} (an older craft-fonts?)", manifest.display()), false)); }; - craft_font(dir, &root, family, style, file, scripts) + let root = dir.canonicalize().map_err(|e| (format!("{}: {e}", dir.display()), true))?; + // A row whose file is missing is watched through the file's folder inside the checkout (or the + // checkout's `fonts/`), so the build runs again once the file appears. + craft_font(dir, &root, family, style, file, scripts).map_err(|e| { + let inside = dir.join(file).parent().and_then(|p| p.canonicalize().ok()).filter(|p| p.starts_with(&root) && p.is_dir()); + println!("cargo::rerun-if-changed={}", inside.unwrap_or_else(|| dir.join("fonts")).display()); + (e, true) + }) } /// One `WebFont { .. }` initialiser per `web-fonts.txt` line, from its craft-fonts manifest row, and diff --git a/crates/text/build/condensed_ui_face.rs b/crates/text/build/condensed_ui_face.rs new file mode 100644 index 0000000000..c70e2cb2a4 --- /dev/null +++ b/crates/text/build/condensed_ui_face.rs @@ -0,0 +1,45 @@ +//! The condensed craft-fonts face document tab titles draw in, and its row in the checkout's opt-in +//! Latin catalog (`fonts/latin-manifest.txt`). Shared by `build.rs` and the crate's tests +//! (`#[path]`-included by both, so it has no dependencies). + +/// The condensed face's family and style. +pub const FACE: (&str, &str) = ("Noto Sans", "Condensed SemiBold"); + +/// The file and scripts fields of [`FACE`]'s row in the catalog `text`: `None` when no row names +/// the face, and an error when the row that names it does not have the catalog's 8 fields or leaves +/// the file or scripts empty. +pub fn row(text: &str) -> Result, String> { + for line in text.lines().map(str::trim).filter(|l| !l.is_empty() && !l.starts_with('#')) { + let fields: Vec<&str> = line.split(" | ").map(str::trim).collect(); + match fields.as_slice() { + [family, style, file, scripts, _, _, _, _] if (*family, *style) == FACE && !file.is_empty() && !scripts.is_empty() => { + return Ok(Some((*file, *scripts))); + } + [family, style, ..] if (*family, *style) == FACE => return Err(format!("malformed manifest line: {line}")), + _ => {} + } + } + Ok(None) +} + +#[cfg(test)] +mod tests { + use super::*; + + /// The face's row as storytold/craft-fonts#72 adds it to the catalog is found, rows for other + /// faces are not taken for it, and a row naming it without its file or scripts, or with one of + /// them empty, is an error. + #[test] + fn the_catalog_row_names_the_face() { + let catalog = "# Latin presentation fonts for the Crafting Apps (opt-in).\n\ + Inter | SemiBold | fonts/inter/Inter-SemiBold.ttf | Latn | OFL-1.1 | fonts/inter/OFL.txt | 78a843fade9d4612a5567302fb595b56976eb5fcebf4fea5a5912d638bafcde3 | https://github.com/rsms/inter/releases/download/v4.1/Inter-4.1.zip#extras/ttf/Inter-SemiBold.ttf\n\ + Noto Sans | Condensed SemiBold | fonts/noto-sans-condensed/NotoSans-CondensedSemiBold.ttf | Latn | OFL-1.1 | fonts/noto-sans-condensed/OFL.txt | b41ecd0838ecd17b706432a01c0d63f8bf977d851cc2cf37242324233edb9294 | https://github.com/notofonts/latin-greek-cyrillic/releases/download/NotoSans-v2.015/NotoSans-v2.015.zip#NotoSans/unhinted/ttf/NotoSans-CondensedSemiBold.ttf\n"; + assert_eq!(row(catalog), Ok(Some(("fonts/noto-sans-condensed/NotoSans-CondensedSemiBold.ttf", "Latn")))); + let rest = "OFL-1.1 | fonts/a/OFL.txt | 00 | https://example.com/a.zip"; + assert_eq!(row(&format!("Noto Sans | SemiBold | fonts/a.ttf | Latn | {rest}\n")), Ok(None), "another style"); + assert_eq!(row(&format!("# Noto Sans | Condensed SemiBold | fonts/a.ttf | Latn | {rest}\n")), Ok(None), "a comment"); + assert_eq!(row("Inter | Bold\n"), Ok(None), "a short row for another face"); + assert!(row(&format!("Noto Sans | Condensed SemiBold | fonts/a.ttf | {rest}\n")).is_err(), "a row without its scripts"); + assert!(row(&format!("Noto Sans | Condensed SemiBold | fonts/a.ttf | | {rest}\n")).is_err(), "a row with empty scripts"); + } +} diff --git a/crates/text/src/lib.rs b/crates/text/src/lib.rs index 2028639af4..d1e82be440 100644 --- a/crates/text/src/lib.rs +++ b/crates/text/src/lib.rs @@ -1068,6 +1068,9 @@ pub fn x_height(data: &[u8], index: u32) -> Option { m.x_height.filter(|h| *h > 0.0).map(|h| h / f32::from(m.units_per_em.max(1))) } +#[cfg(test)] +#[path = "../build/condensed_ui_face.rs"] +mod condensed_ui_face_build; #[cfg(test)] mod tests; #[cfg(test)] diff --git a/crates/ui-egui/src/chrome/tabs.rs b/crates/ui-egui/src/chrome/tabs.rs index 1aff4fe1a9..782309a3f0 100644 --- a/crates/ui-egui/src/chrome/tabs.rs +++ b/crates/ui-egui/src/chrome/tabs.rs @@ -56,7 +56,7 @@ pub(crate) fn window_tab(app: &VectorcraftApp, ui: &mut Ui, w: crate::doc_window ui.painter().rect_filled(strip, 0.0, t.tab_strip); ui.painter().line_segment([strip.left_bottom(), strip.right_bottom()], Stroke::new(1.0, t.border)); let title = document_window_title(app, w).unwrap_or_default(); - let galley = ui.painter().layout_no_wrap(title, theme::tab_font(title_size), t.text_strong); + let galley = ui.painter().layout_no_wrap(title, theme::tab_title_font(ui, title_size), t.text_strong); let r = egui::Rect::from_min_size(strip.min, vec2((galley.size().x + 28.0).min(strip.width()), strip.height() - 1.0)); ui.painter().rect_filled(r, 0.0, t.panel); ui.painter().line_segment([r.right_top(), r.right_bottom()], Stroke::new(1.5, t.border)); @@ -213,6 +213,7 @@ pub fn doc_tabs(app: &mut VectorcraftApp, ui: &mut Ui) { ui.painter().line_segment([strip.left_bottom(), strip.right_bottom()], Stroke::new(1.0, t.border)); // On the Home screen no tab is the current one. let shown = crate::doc_windows::tab_window(app).filter(|_| app.ui.home.is_none()); + let title_font = theme::tab_title_font(ui, title_size); // The windows under the tabs, with the text each tab shows, its whole title and the text laid // out; `active` is the position of the highlighted one. An inactive tab shows the name alone, // without the zoom and the mode in parentheses (color mode and view, or the opacity mask being @@ -225,7 +226,7 @@ pub fn doc_tabs(app: &mut VectorcraftApp, ui: &mut Ui) { let title = window_tab_title(app, w, d); let (text, color) = if Some(w) == shown { (title.clone(), t.text_strong) } else { (view_tab_name(d, crate::doc_windows::label(app, w)), t.text_dim) }; - let galley = ui.painter().layout_no_wrap(text.clone(), theme::tab_font(title_size), color); + let galley = ui.painter().layout_no_wrap(text.clone(), title_font.clone(), color); (w, text, title, galley) }) .collect(); @@ -259,7 +260,7 @@ pub fn doc_tabs(app: &mut VectorcraftApp, ui: &mut Ui) { break; } let color = if Some(*win) == shown { t.text_strong } else { t.text_dim }; - let (galley, fits) = shortened_title(ui.ctx(), text, theme::tab_font(title_size), color, left - TAB_PADDING); + let (galley, fits) = shortened_title(ui.ctx(), text, title_font.clone(), color, left - TAB_PADDING); (galley, left.max(0.0), true, fits) } else { (galley.clone(), *w, false, true) diff --git a/crates/ui-egui/src/chrome/tests.rs b/crates/ui-egui/src/chrome/tests.rs index 3b889b1f09..b78968442e 100644 --- a/crates/ui-egui/src/chrome/tests.rs +++ b/crates/ui-egui/src/chrome/tests.rs @@ -29,27 +29,29 @@ fn the_tabs_after_the_leading_one_are_drawn_whole() { assert_eq!(super::tab_room(None, false, 120.0, 119.99), 119.99, "no leading tab"); } -/// A shortened title shows at every width that holds "…", fractional ones included (#8584). +/// A shortened title shows at every width that holds "…", fractional ones included (#8584), in the +/// semibold face and in the tab titles' face (the condensed one in a build with craft-fonts, #8583). #[test] fn a_shortened_title_fits_at_fractional_widths() { let ctx = egui::Context::default(); crate::theme::install_fonts(&ctx); - let font = crate::theme::semibold(13.0); let title = "Untitled-12 @ 66.67 % (RGB/Preview)"; let mut too_wide = vec![]; let mut output = ctx.run_ui(egui::RawInput::default(), |ui| { - let (ellipsis, _) = super::shortened_title(ui.ctx(), "…", font.clone(), egui::Color32::WHITE, 1000.0); - let mut width = ellipsis.size().x.ceil() + 1.0; - while width < 200.0 { - let (galley, fits) = super::shortened_title(ui.ctx(), title, font.clone(), egui::Color32::WHITE, width); - if !fits { - too_wide.push((width, galley.size().x)); + for font in [crate::theme::semibold(13.0), crate::theme::tab_title_font(ui, 13.0)] { + let (ellipsis, _) = super::shortened_title(ui.ctx(), "…", font.clone(), egui::Color32::WHITE, 1000.0); + let mut width = ellipsis.size().x.ceil() + 1.0; + while width < 200.0 { + let (galley, fits) = super::shortened_title(ui.ctx(), title, font.clone(), egui::Color32::WHITE, width); + if !fits { + too_wide.push((font.family.clone(), width, galley.size().x)); + } + width += 0.25; } - width += 0.25; } }); output.textures_delta.clear(); - assert!(too_wide.is_empty(), "shortened titles wider than their room (room, width): {too_wide:?}"); + assert!(too_wide.is_empty(), "shortened titles wider than their room (family, room, width): {too_wide:?}"); } /// Tabs 100 wide at 0, 100, 200…, for documents `docs` (a document listed twice has two views). diff --git a/crates/ui-egui/src/i18n/tests.rs b/crates/ui-egui/src/i18n/tests.rs index 7954785e30..6136913184 100644 --- a/crates/ui-egui/src/i18n/tests.rs +++ b/crates/ui-egui/src/i18n/tests.rs @@ -1501,6 +1501,9 @@ fn bundled_fonts_cover_the_catalogs() { egui::FontFamily::Name(crate::theme::FONT_TAB.into()), egui::FontFamily::Name(crate::theme::FONT_MONO.into()), ]; + // The tab family is bound only in builds with craft-fonts' condensed face. + let tab = egui::FontFamily::Name(crate::theme::FONT_TAB.into()); + let families: Vec = families.into_iter().filter(|f| *f != tab || fonts.definitions().families.contains_key(f)).collect(); for l in LANGUAGES.iter().filter(|l| !l.source.is_empty()) { let (entries, _) = parse_entries(l.source); let cjk_checked = japanese_ui_font && l.code == "ja"; diff --git a/crates/ui-egui/src/tests/tab_overflow.rs b/crates/ui-egui/src/tests/tab_overflow.rs index c9f9edec0a..7b389001d5 100644 --- a/crates/ui-egui/src/tests/tab_overflow.rs +++ b/crates/ui-egui/src/tests/tab_overflow.rs @@ -145,12 +145,87 @@ fn tab_titles_in_the_condensed_face_fit_more_tabs() { let whole = texts.iter().filter(|(t, _)| t.starts_with("Poster draft") && !t.ends_with('…')).count(); // The height of an x, in the tab font and in semibold text. let x = |font: egui::FontId| ctx.fonts_mut(|f| f.layout_no_wrap("x".into(), font, egui::Color32::WHITE)).rows[0].glyphs[0].uv_rect.size.y; - (whole, x(crate::theme::tab_font(40.0)), x(crate::theme::semibold(40.0))) + let tab = if face.is_some() { crate::theme::tab_font(200.0) } else { crate::theme::semibold(200.0) }; + (whole, x(tab), x(crate::theme::semibold(200.0))) }; let (semibold, _, _) = whole_tabs(None); let (narrow, x_tab, x_semibold) = whole_tabs(Some(condensed)); assert!(narrow > semibold, "more tabs fit whole in the condensed face: {narrow} against {semibold}"); - assert!((x_tab - x_semibold).abs() <= 1.0, "an x is {x_tab} pt tall in a tab title and {x_semibold} pt in semibold text"); + // Two points at 200 pt: a pixel of rounding on each glyph. The faces' own x-heights differ by + // about 8 pt at this size. + assert!((x_tab - x_semibold).abs() <= 2.0, "at 200 pt an x is {x_tab} pt tall in a tab title and {x_semibold} pt in semibold text"); +} + +/// The tab strip lays its titles out in the tab family's own face when it has one: the monospace +/// face stands in for craft-fonts' condensed face, which CI's craft-fonts checkout does not have +/// (#8583). +#[test] +fn tab_titles_draw_in_the_tab_familys_face() { + let stand_in = vectorcraft_text::CraftFont { + family: "Stand-in", + style: "Regular", + scripts: &["Latn"], + bytes: include_bytes!("../../../../assets/fonts/JetBrainsMono-Regular.ttf"), + }; + let mut app = VectorcraftApp::new(Session::new(), Default::default()); + app.run("file.new", json!({"width": 100, "height": 100, "name": "Tab test"})).unwrap(); + app.sync_views(); + let ctx = egui::Context::default(); + ctx.set_fonts(crate::theme::interface_fonts_with(Some(&stand_in))); + let titles = title_fonts(&mut app, &ctx); + assert_eq!(titles.len(), 1, "{titles:?}"); + for (title, font) in titles { + assert_eq!(font.family, egui::FontFamily::Name(crate::theme::FONT_TAB.into()), "{title}"); + } +} + +/// The fonts the tab strip lays its "Tab test" titles out in. +fn title_fonts(app: &mut VectorcraftApp, ctx: &egui::Context) -> Vec<(String, egui::FontId)> { + let mut out = ctx.run_ui(egui::RawInput { screen_rect: Some(egui::Rect::from_min_size(Pos2::ZERO, SIZE)), ..Default::default() }, |ui| { + egui::CentralPanel::default().show(ui, |ui| chrome::doc_tabs(app, ui)); + }); + out.textures_delta.clear(); + fn walk(s: &egui::Shape, v: &mut Vec<(String, egui::FontId)>) { + match s { + egui::Shape::Text(t) if t.galley.text().starts_with("Tab test") => { + v.extend(t.galley.job.sections.first().map(|s| (t.galley.text().to_owned(), s.format.font_id.clone()))); + } + egui::Shape::Vec(list) => list.iter().for_each(|s| walk(s, v)), + _ => {} + } + } + let mut fonts = vec![]; + for c in &out.shapes { + walk(&c.shape, &mut fonts); + } + fonts +} + +/// Without the condensed face the tab family is not bound, and tab titles draw in the semibold +/// family as it is, with a face added to it later (#8583). +#[test] +fn tab_titles_draw_in_semibold_where_the_tab_family_is_not_bound() { + let mut app = VectorcraftApp::new(Session::new(), Default::default()); + for i in 0..3 { + app.run("file.new", json!({"width": 100, "height": 100, "name": format!("Tab test {i}")})).unwrap(); + } + app.session.set_active(0); + app.sync_views(); + // A face put at the head of the semibold family after the interface's, as an embedder may. + let mut fonts = crate::theme::interface_fonts_with(None); + let added = "Added semibold".to_owned(); + fonts.font_data.insert( + added.clone(), + std::sync::Arc::new(egui::FontData::from_static(include_bytes!("../../../../assets/fonts/JetBrainsMono-Regular.ttf"))), + ); + fonts.families.entry(egui::FontFamily::Name(crate::theme::FONT_UI_SEMIBOLD.into())).or_default().insert(0, added); + let ctx = egui::Context::default(); + ctx.set_fonts(fonts); + let titles = title_fonts(&mut app, &ctx); + assert_eq!(titles.len(), 3, "{titles:?}"); + for (title, font) in titles { + assert_eq!(font.family, egui::FontFamily::Name(crate::theme::FONT_UI_SEMIBOLD.into()), "{title}"); + } } /// With the last document active, the tabs from it to the end leave room before the » button, and diff --git a/crates/ui-egui/src/theme.rs b/crates/ui-egui/src/theme.rs index 11e8af8e22..2743922495 100644 --- a/crates/ui-egui/src/theme.rs +++ b/crates/ui-egui/src/theme.rs @@ -497,16 +497,23 @@ pub const FONT_MONO: &str = "mono"; /// The family document tab titles draw in. In a build with craft-fonts' condensed face /// ([`vectorcraft_text::CONDENSED_UI_FONT`]), that face heads it, at the x-height of the /// [`FONT_UI_SEMIBOLD`] face, followed by the faces of [`FONT_UI_SEMIBOLD`] on its baseline, so -/// more tabs fit in the strip (#8583). Without it the family is [`FONT_UI_SEMIBOLD`]'s. +/// more tabs fit in the strip (#8583). Without it the family is not bound, and tab titles draw in +/// [`FONT_UI_SEMIBOLD`] ([`tab_title_font`]). pub const FONT_TAB: &str = "tab"; pub fn semibold(size: f32) -> FontId { FontId::new(size, FontFamily::Name(FONT_UI_SEMIBOLD.into())) } -/// A document tab's title font ([`FONT_TAB`]). -pub fn tab_font(size: f32) -> FontId { +/// A font in [`FONT_TAB`], which is bound only with the condensed face: see [`tab_title_font`]. +pub(crate) fn tab_font(size: f32) -> FontId { FontId::new(size, FontFamily::Name(FONT_TAB.into())) } +/// The font document tab titles draw in on `ui`: the [`FONT_TAB`] family when `ui`'s fonts bind +/// it (with the condensed face), otherwise [`semibold`]. +pub fn tab_title_font(ui: &egui::Ui, size: f32) -> FontId { + let font = tab_font(size); + if ui.ctx().fonts(|f| f.definitions().families.contains_key(&font.family)) { font } else { semibold(size) } +} /// Whether `family` draws semibold text and takes the bold fallback faces. pub(crate) fn is_semibold(family: &FontFamily) -> bool { matches!(family, FontFamily::Name(name) if [FONT_UI_SEMIBOLD, FONT_TAB].contains(&&**name)) @@ -516,7 +523,7 @@ pub fn mono(size: f32) -> FontId { } /// Installs the interface's fonts and binds the families the panels and dialogs draw in -/// ([`FONT_UI`], [`FONT_UI_SEMIBOLD`], [`FONT_TAB`], [`FONT_MONO`]). egui 0.37 only bundles its own faces when +/// ([`FONT_UI`], [`FONT_UI_SEMIBOLD`], [`FONT_MONO`], and [`FONT_TAB`] with the condensed face). egui 0.37 only bundles its own faces when /// its `default_fonts` feature is on (this crate enables it); without any face a family lays out /// tofu, and the `egui_kittest` harness alone panics on a missing glyph. Every context that shows /// these families needs this once: [`crate::VectorcraftApp::ui`] calls it on its first pass, and @@ -548,9 +555,10 @@ pub(crate) fn interface_fonts_with(condensed: Option<&vectorcraft_text::CraftFon |faces: Vec<&str>, fallback: &[String]| -> Vec { faces.into_iter().map(str::to_owned).chain(fallback.iter().cloned()).collect() }; fonts.families.insert(FontFamily::Proportional, family(ui.clone(), &fallback)); let semi = family(semi, &fallback); - let tab = tab_faces(&mut fonts, &semi, condensed); + if let Some(tab) = tab_faces(&mut fonts, &semi, condensed) { + fonts.families.insert(FontFamily::Name(FONT_TAB.into()), tab); + } fonts.families.insert(FontFamily::Name(FONT_UI_SEMIBOLD.into()), semi); - fonts.families.insert(FontFamily::Name(FONT_TAB.into()), tab); fonts.families.insert(FontFamily::Name(FONT_UI.into()), family(ui, &fallback)); fonts.families.insert(FontFamily::Name(FONT_MONO.into()), family(mono, &mono_fallback)); add_craft_fonts(&mut fonts); @@ -559,28 +567,38 @@ pub(crate) fn interface_fonts_with(condensed: Option<&vectorcraft_text::CraftFon /// The faces of [`FONT_TAB`], added to `fonts`: `condensed`, scaled to the x-height of the first /// face of `semi` (the [`FONT_UI_SEMIBOLD`] stack), then a copy of each face of `semi` on its -/// baseline. `semi` itself without `condensed`, or when either face's x-height can't be read. -fn tab_faces(fonts: &mut FontDefinitions, semi: &[String], condensed: Option<&vectorcraft_text::CraftFont>) -> Vec { +/// baseline. egui's own faces are listed under their own names, uncopied, as in the semibold +/// family: egui skips some of their characters (the Ubuntu logo, for one) only under those names. +/// `None` without `condensed`, or when either face's x-height can't be read. +fn tab_faces(fonts: &mut FontDefinitions, semi: &[String], condensed: Option<&vectorcraft_text::CraftFont>) -> Option> { let x_height = |data: &FontData| vectorcraft_text::x_height((*data.font).as_ref(), data.index).map(|h| h * data.tweak.scale); - let reference = semi.first().and_then(|head| fonts.font_data.get(head)).and_then(|data| x_height(data)); - let Some((f, reference)) = condensed.zip(reference) else { return semi.to_vec() }; - let Some(own) = vectorcraft_text::x_height(f.bytes, 0) else { return semi.to_vec() }; + let reference = semi.first().and_then(|head| fonts.font_data.get(head)).and_then(|data| x_height(data))?; + let f = condensed?; + let own = vectorcraft_text::x_height(f.bytes, 0)?; let name = craft_font_name(f); let head = FontData::from_static(f.bytes).tweak(egui::epaint::text::FontTweak { scale: reference / own, ..Default::default() }); - // `baseline_copies` reads the head of each family it is given: here only this one. + // `baseline_copies` reads the head of each family it is given. `row` also has egui's empty + // Proportional and Monospace families, whose copies are not this family's. + let tab = FontFamily::Name(FONT_TAB.into()); let mut row = FontDefinitions::empty(); row.font_data.insert(name.clone(), Arc::new(head.clone())); - row.families.insert(FontFamily::Name(FONT_TAB.into()), vec![name.clone()]); + row.families.insert(tab.clone(), vec![name.clone()]); let mut faces = vec![name.clone()]; for face in semi { + if FontDefinitions::builtin_font_names().contains(&face.as_str()) { + faces.push(face.clone()); + continue; + } let Some(data) = fonts.font_data.get(face).cloned() else { continue }; - for (copy, data, _) in crate::ui_fonts::baseline_copies(&row, &format!("{face} / {name}"), &data) { + for (copy, data, _) in + crate::ui_fonts::baseline_copies(&row, &format!("{face} / {name}"), &data).into_iter().filter(|(_, _, f)| f.contains(&tab)) + { fonts.font_data.insert(copy.clone(), Arc::new(data)); faces.push(copy); } } fonts.font_data.insert(name, Arc::new(head)); - faces + Some(faces) } /// The interface's own faces, added to `fonts`: the names of the regular, semibold and monospace @@ -831,4 +849,57 @@ mod tests { assert_eq!(ctx.global_style().interaction.tooltip_delay, f32::INFINITY); assert_eq!(ctx.global_style().visuals.window_fill, Tokens::for_brightness(Brightness::Light).panel); } + + /// The face heading the tab family draws an x as tall as the semibold face does, and a + /// character it lacks falls back to the semibold face (drawn at its own 0.92 scale) on its + /// baseline (#8583). The monospace face stands in for craft-fonts' condensed face, which CI's + /// craft-fonts checkout does not have. + #[cfg(feature = "interface-fonts")] + #[test] + fn the_tab_family_keeps_the_semibold_x_height_and_baseline() { + let stand_in = vectorcraft_text::CraftFont { + family: "Stand-in", + style: "Regular", + scripts: &["Latn"], + bytes: include_bytes!("../../../assets/fonts/JetBrainsMono-Regular.ttf"), + }; + let mut defs = interface_fonts_with(Some(&stand_in)); + assert_eq!(defs.families[&FontFamily::Name(FONT_TAB.into())][0], craft_font_name(&stand_in)); + // The semibold face alone, as it draws a character in its own family. + defs.families.insert(FontFamily::Name("probe".into()), vec!["Inter-SemiBold".to_owned()]); + let ctx = egui::Context::default(); + ctx.set_pixels_per_point(2.0); + ctx.set_fonts(defs); + let mut output = ctx.run_ui(egui::RawInput::default(), |_| {}); + output.textures_delta.clear(); + let glyphs = |text: &str, font: FontId| ctx.fonts_mut(|f| f.layout_no_wrap(text.into(), font, Color32::WHITE)).rows[0].glyphs.clone(); + let x = |font: FontId| glyphs("x", font)[0].uv_rect.size.y; + let (x_tab, x_semibold) = (x(tab_font(200.0)), x(semibold(200.0))); + // Two points at 200 pt: a pixel of rounding on each glyph. The faces' own x-heights differ + // by about 10 pt at this size. + assert!((x_tab - x_semibold).abs() <= 2.0, "at 200 pt an x is {x_tab} pt tall in a tab title and {x_semibold} pt in semibold text"); + // egui skips some characters of its own faces (the Ubuntu logo, two symbols in its emoji + // face); a tab title draws them as semibold text does. + for c in ['\u{534D}', '\u{5350}', '\u{E0FF}', '\u{EFFD}', '\u{F0FF}', '\u{F200}'] { + let has = |font: FontId| ctx.fonts_mut(|f| f.has_glyph(&font, c)); + let name = format!("U+{:04X}", u32::from(c)); + assert_eq!(has(tab_font(13.0)), has(semibold(13.0)), "{name} has a glyph in a tab title as in semibold text"); + if has(semibold(13.0)) { + // Both families take it from the same fallback face, which draws it at one size. + let size = |font: FontId| glyphs(&c.to_string(), font).first().map(|g| g.uv_rect.size); + assert_eq!(size(tab_font(13.0)), size(semibold(13.0)), "{name} draws at the same size in a tab title as in semibold text"); + } + } + let bottom = |g: &egui::epaint::text::Glyph| g.pos.y + g.uv_rect.offset.y + g.uv_rect.size.y; + // U+0182, which Inter has and the monospace face lacks. + let c = 'Ƃ'; + for size in [13.0_f32, 24.0, 40.0, 100.0] { + let own = glyphs(&c.to_string(), FontId::new(size, FontFamily::Name("probe".into()))); + let row = glyphs(&format!("H{c}"), tab_font(size)); + assert_eq!((own.len(), row.len()), (1, 2), "{c} lays out as one glyph"); + // Half a point: one device pixel at 2 pixels per point, for each glyph's rounding. + let drift = (bottom(&row[1]) - row[0].pos.y) - (bottom(&own[0]) - own[0].pos.y); + assert!(drift.abs() <= 0.5, "at {size} pt, {c} ends {drift:.2} pt below the tab family's baseline"); + } + } } diff --git a/crates/ui-egui/src/ui_fonts.rs b/crates/ui-egui/src/ui_fonts.rs index cb419067e1..8e2d07ff5c 100644 --- a/crates/ui-egui/src/ui_fonts.rs +++ b/crates/ui-egui/src/ui_fonts.rs @@ -239,7 +239,7 @@ pub(crate) fn baseline_copies(defs: &FontDefinitions, name: &str, data: &FontDat let mut copies: Vec<(String, FontData, Vec)> = vec![]; for (family, stack) in &defs.families { let head = stack.first().and_then(|head| Some((head.as_str(), defs.font_data.get(head)?))); - let shift = head.and_then(|(_, data)| row_metrics(data)).map_or(0.0, |row| baseline_shift(row, (*data.font).as_ref(), data.index)); + let shift = head.and_then(|(_, data)| row_metrics(data)).map_or(0.0, |row| baseline_shift(row, data)); if let Some((_, _, families)) = copies.iter_mut().find(|(_, copy, _)| copy.tweak.y_offset_factor.to_bits() == shift.to_bits()) { families.push(family.clone()); continue; @@ -266,15 +266,19 @@ fn em_metrics(data: &[u8], index: u32) -> Option<(f32, f32)> { Some((ascent / upem, (ascent - descent + gap) / upem)) } -/// The `y_offset_factor` that puts the glyphs of the face at `index` of `face` on the baseline of -/// the row's first face, whose ascent, row height and offset in ems are `row`. egui draws a -/// fallback glyph's baseline at its face's ascent plus half the difference between the two row -/// heights, so a face with a taller ascent or descent sits off the baseline by the shift computed -/// here, in ems of the font size, limited to half an em either way. -fn baseline_shift(row: (f32, f32, f32), face: &[u8], index: u32) -> f32 { +/// The `y_offset_factor` that puts the glyphs of the fallback face `data` on the baseline of the +/// row's first face, whose ascent, row height and offset in ems are `row`. egui draws a fallback +/// glyph's baseline at its face's ascent plus half the difference between the two row heights, so a +/// face with a taller ascent or descent sits off the baseline by the shift computed here, in ems of +/// the font size, limited to half an em either way. egui scales the face's metrics and its +/// `y_offset_factor` by the face's own `FontTweak` scale, so both are measured at that scale. +fn baseline_shift(row: (f32, f32, f32), data: &FontData) -> f32 { let (row_ascent, row_height, row_offset) = row; - let shift = em_metrics(face, index).map_or(0.0, |(ascent, height)| row_ascent + row_offset - (ascent + 0.5 * (row_height - height))); - if shift.is_finite() { shift.clamp(-0.5, 0.5) } else { 0.0 } + let scale = data.tweak.scale; + let shift = em_metrics((*data.font).as_ref(), data.index) + .map_or(0.0, |(ascent, height)| row_ascent + row_offset - scale * ascent - 0.5 * (row_height - scale * height)); + let factor = if shift.is_finite() { shift.clamp(-0.5, 0.5) / scale } else { 0.0 }; + if factor.is_finite() { factor } else { 0.0 } } /// Call `f` with the text of `shape` and the shapes it holds. @@ -375,8 +379,10 @@ mod tests { fonts.finish(&ctx); frame(&ctx, &mut fonts, "日本語の文字 Layer 1"); if vectorcraft_text::CRAFT_FONTS.is_empty() { + // The condensed tab face is read from its own catalog, so a checkout can give it alone. + let condensed = vectorcraft_text::CONDENSED_UI_FONT.as_ref().map(crate::theme::craft_font_name); let names: Vec = ctx.fonts(|f| f.definitions().font_data.keys().cloned().collect()); - assert!(names.iter().all(|n| !n.starts_with("craft-fonts")), "{names:?}"); + assert!(names.iter().all(|n| !n.starts_with("craft-fonts") || Some(n) == condensed.as_ref()), "{names:?}"); } assert!(has_glyph(&ctx, 'L')); } diff --git a/crates/ui-egui/tests/install_fonts.rs b/crates/ui-egui/tests/install_fonts.rs index d7ebcaab27..56d49bc3bc 100644 --- a/crates/ui-egui/tests/install_fonts.rs +++ b/crates/ui-egui/tests/install_fonts.rs @@ -33,7 +33,8 @@ fn frame(ctx: &egui::Context, draw: impl FnMut(&mut egui::Ui)) { fn every_family_the_panels_draw_in_is_bound() { let ctx = context(); frame(&ctx, |ui| { - for font in [theme::semibold(12.0), theme::mono(12.0), FontId::new(12.0, FontFamily::Name(theme::FONT_UI.into()))] { + let tab = theme::tab_title_font(ui, 12.0); + for font in [theme::semibold(12.0), tab, theme::mono(12.0), FontId::new(12.0, FontFamily::Name(theme::FONT_UI.into()))] { ui.label(egui::RichText::new("Gaussian Blur").font(font)); } }); @@ -45,6 +46,17 @@ fn every_family_the_panels_draw_in_is_bound() { let installed: Vec<&str> = INTERFACE_FACES.into_iter().filter(|face| definitions.font_data.contains_key(*face)).collect(); let family = |family: FontFamily| definitions.families[&family].clone(); let named = |name: &str| family(FontFamily::Name(name.into())); + // The tab family is bound, headed by craft-fonts' condensed face and followed by the semibold + // faces, when the build has that face and both faces give an x-height to match. + let x_height = |name: &String| definitions.font_data.get(name).and_then(|d| vectorcraft_text::x_height((*d.font).as_ref(), d.index)); + let semibold_head = named(theme::FONT_UI_SEMIBOLD).first().and_then(x_height); + match vectorcraft_text::CONDENSED_UI_FONT.as_ref().filter(|f| vectorcraft_text::x_height(f.bytes, 0).is_some() && semibold_head.is_some()) { + None => assert!(!definitions.families.contains_key(&FontFamily::Name(theme::FONT_TAB.into()))), + Some(f) => { + assert_eq!(named(theme::FONT_TAB)[0], format!("craft-fonts {} {}", f.family, f.style)); + assert!(named(theme::FONT_TAB).len() > named(theme::FONT_UI_SEMIBOLD).len(), "the semibold faces follow the condensed one"); + } + } if cfg!(feature = "interface-fonts") { assert_eq!(installed, INTERFACE_FACES); assert_eq!(named(theme::FONT_UI)[0], "Inter"); diff --git a/docs/development.md b/docs/development.md index 66f925324e..950b996ed9 100644 --- a/docs/development.md +++ b/docs/development.md @@ -178,8 +178,9 @@ CRAFT_FONTS_DIR="$PWD/../craft-fonts" cargo xtask ci # also runs the Japanese- checkout's opt-in `fonts/latin-manifest.txt`, Noto Sans Condensed SemiBold, as `vectorcraft_text::CONDENSED_UI_FONT`. `theme::FONT_TAB` draws the titles in it at the x-height of the interface's semibold face, so more tabs fit in the strip. Without - `CRAFT_FONTS_DIR`, on the web, or with a checkout that lacks the row (a build warning), tab - titles draw in the semibold face. + `CRAFT_FONTS_DIR`, on the web, or with a checkout that lacks the row (a build warning), + `theme::FONT_TAB` is not bound and tab titles draw in the semibold family + (`theme::tab_title_font`). - Tests that need Japanese or Georgian glyphs skip with a message when built without craft-fonts. The FreeBSD CI job and every release job (`release.yml`) check craft-fonts out at a pinned commit; release packages carry each embedded font's `OFL-.txt`. @@ -205,7 +206,8 @@ font that has them to each of the families below (`ctx.add_font` with an `Insert family). The panels and dialogs draw in their own egui families (`theme::FONT_UI`, `FONT_UI_SEMIBOLD`, -`FONT_MONO`), and egui panics drawing text in a family no font is bound to. `VectorcraftApp::logic` +`FONT_MONO`, and `FONT_TAB` for document tab titles in builds with the condensed face), and egui +panics drawing text in a family no font is bound to. `VectorcraftApp::logic` binds them on its first frame; an embedder that draws the panels or dialogs without it calls `theme::install_fonts` once on its context, with or without `interface-fonts`. It replaces the context's font definitions, so the embedder's own fonts are added after it. diff --git a/docs/ui-parity.md b/docs/ui-parity.md index 8b5a9f315a..b6fa3393c1 100644 --- a/docs/ui-parity.md +++ b/docs/ui-parity.md @@ -443,7 +443,7 @@ next unit in the order a right-click on a ruler lists them, from Feet back to Po | A middle-click on a document tab or its × closes it as the × does; closing a modified document's last view asks to save first (VectorCraft addition, as in PhotoCraft) | done | #6506; `chrome::tests::a_middle_click_on_a_tab_closes_it_as_the_close_box_does`; not scored | | When the document tabs don't all fit, the first tab that doesn't fit whole fills the room before the » button with its title shortened and ending in "…", once that room leaves at least 40 pt for the title; with the active tab among the last ones, the tab before the ones shown fills the room left at the start instead; an active tab wider than the strip is shortened to it, and a tab narrower than 25 pt shows no ×; the tooltip of a shortened tab shows the whole title, wrapped to the window (VectorCraft's own rule) | done | #8584; `tests::tab_overflow`; not scored | | An inactive document tab shows the document's name, the view number and the unsaved-changes mark, without the zoom and the mode in parentheses (the color mode and view, or the opacity mask being edited); the active tab keeps its whole title, and an inactive tab's tooltip shows the whole title (VectorCraft's own rule) | done | #8582; `tests::tab_overflow::inactive_tabs_show_the_name_alone_so_more_tabs_fit`; not scored | -| Document tab titles draw in a condensed face (craft-fonts' Noto Sans Condensed SemiBold) at the x-height of the interface's semibold face, so more tabs fit; builds without that face draw them in the semibold face (VectorCraft's own rule) | done | #8583; `tests::tab_overflow::tab_titles_in_the_condensed_face_fit_more_tabs`; not scored | +| Document tab titles draw in a condensed face (craft-fonts' Noto Sans Condensed SemiBold) at the x-height of the interface's semibold face, so more tabs fit; builds without that face draw them in the semibold face (VectorCraft's own rule) | done; release builds pending | #8583; `tests::tab_overflow::tab_titles_in_the_condensed_face_fit_more_tabs`, `theme::tests::the_tab_family_keeps_the_semibold_x_height_and_baseline`; the release and FreeBSD workflows pin a craft-fonts commit without the face, so official builds draw tab titles in the semibold face until that pin moves past storytold/craft-fonts#72; not scored | | Panels hidden by Tab or Shift+Tab show for a while when the pointer rests on the left or right edge of the window, over the canvas, and hide again when it moves away; Tab shows them for good | done | Part of #5661; `window.panels.peek` ([Workspace basics](https://web.archive.org/web/2014/https://helpx.adobe.com/illustrator/using/workspace-basics.html), "Hide or show all panels"); VectorCraft's own choices: the 6 pt band and the 0.3 s delays, only the docked panels on that side show (floating panels, Tools and the Control bar stay hidden), and nothing shows in Presentation Mode; `panel_docking::tests::resting_on_the_right_edge_shows_the_hidden_panels_over_the_canvas_until_the_pointer_leaves` and the tests after it | | Behaviour | Status | Notes |