DesignCraft: An open-source page and layout design editor written by scratch in pure Rust
Merge #612: Windows mixed-DPI drag keeps the window's size; GPU surface up to the adapter's texture limit
aionggb32deda33910
diff --cc ROADMAP.mdindex c9da5d25b,dfcd0bf61..2ec5ab02b--- a/ROADMAP.md+++ b/ROADMAP.md@@@ -128,31 -129,7 +128,32 @@@ list) · [roadmap.md](docs/roadmap.md)Newest first.+- **2026-10-12** · With the Type tool, dragging a table's column or row border resizes it (the double-arrow cursor shows over a border): later columns and rows move along, Shift keeps the table size, and Shift on the right or bottom edge scales every column or row. A dragged row becomes At Least; one undo step per drag, Esc cancels; works in rotated frames and turned spreads. Scripts use `table.resizeBorder`. No readiness percentage change.+- **2026-10-12** · The Tools panel's Fill/Stroke keys work: D (default fill and stroke), X (fill or stroke in front), Shift+X (swap per object, tints included) and / (Apply None), as `color.*` commands; swap and default are one undo step (`object.swapFillStroke`, `object.defaultFillStroke`); the Color panel follows the proxy's fill/stroke choice. No readiness percentage change.+- **2026-10-12** · With a placed graphic selected (Direct Selection), the Transform values act on the graphic inside its frame, as in InDesign: a tilted frame's image can be straightened to 0°. No readiness percentage change.+- **2026-10-11** · Font menu laid out like InDesign's: filters (classification, favourites,+ recently added), families opening to their styles, the selected text as the sample in three+ sizes, Recently Used fonts, Show Similar Fonts and each font's format.+- **2026-10-12** · The Effects panel shows the level its settings apply to ("Group: Color Dodge 100%") and, as in InDesign, Isolate Blending and Knockout Group for a selected group. No readiness percentage change.+- **2026-10-12** · Edit › Step and Repeat has its InDesign dialog: Repeat (Count, or Rows and Columns with Create as a grid), Offset (Vertical, Horizontal, in ruler units) and Preview, which shows the copies while the dialog is open; Cancel takes them away and OK makes them as one undo step. No readiness percentage change.+- **2026-10-12** · Load Styles: the Paragraph Styles and Character Styles panels load styles from another DesignCraft document or an IDML file, with the styles, swatches and lists they name; a dialog picks the styles and what happens to one the document defines differently (`style.load`). No readiness percentage change.+- **2026-10-12** · On screen, blend modes blend with the objects below and not with the paper, as in InDesign and in PDF export: a Color Dodge or Screen object over blank paper shows as it is. No readiness percentage change.+- **2026-10-12** · Text threads by hand: click a selected text frame's in or out port to load+ the text cursor, then click a frame to thread it, click empty space for a column-wide frame or+ drag one (it snaps like frame drawing); Shift-click autoflows, Alt-click stays loaded on the+ frame just added; click the linked frame or double-click a port to break the thread.+ `text.thread`, `text.unthread`, `text.removeFromThread` with undo; locked frames and layers+ refuse threads. The alpha gate now waits only on the Primary Text Frame page fixes (#165). No+ readiness percentage change.+- **2026-10-12** · Properties › Transform shows rotation, shear and X/Y scale, and Rotate 90° and Flip Horizontal/Vertical buttons, as InDesign's does. No readiness percentage change.+- **2026-10-12** · Underlines and strikethroughs are drawn as one bar per stretch of text on screen, as in PDF export: a bar per letter left faint seams between the letters. No readiness percentage change.+- **2026-10-12** · The section marker character shows its section's marker text on document pages (nothing when the section has none) instead of the word "Section", which stays on parent pages; editing the marker recomposes (#556). No readiness percentage change.+- **2026-10-12** · IDML import keeps a font family name exactly as written, trailing spaces included, and font lookup falls back to the name without surrounding spaces; `FontStyle="Nothing"` leaves the style to the paragraph (#558). No readiness percentage change.+- **2026-10-12** · Clipping paths saved with images in IDML (Detect Edges, Alpha Channel, Photoshop Path, User-Modified Path, inverted or not) clip the image on screen and in PDF and survive IDML export; `object.clippingPathOptions` reports, inverts or removes one (#450). No readiness percentage change.+- **2026-10-12** · Anchored objects with text wrap push text aside: other stories' text under them and the lines of their own story after the anchor's line (#557). No readiness percentage change.+- **2026-10-12** · Hyphenation Zone applies to the Single-line Composer only, as in InDesign. With the default Paragraph Composer, ragged text hyphenates where InDesign does (aper-natem), giving the same line breaks. No readiness percentage change.+- **2026-10-12** · Orderly native exit writes the latest recovery state after finalizing current quit approvals; incomplete or stale plans keep their documents, and Undo to the saved state clears stale recovery. Unavailable or failed recovery is reported. Cancelable macOS Dock Quit remains open (#544). No readiness percentage change.+ - **2026-10-12** · Windows: dragging the window across monitors with different display scales keeps its size instead of growing until it crashes (winit pinned to its 0.30.x backport of the fix). The GPU surface may be as large as the adapter's largest texture (16384 px on DirectX 12, Vulkan and Metal hardware) instead of 8192, and a wgpu error is logged instead of closing the app. No readiness percentage change.- **2026-10-12** · Recovered documents keep a checkpoint until saved, closed or reverted, including a second crash before autosave. Restarted document IDs and explicit recovery folders preserve other snapshots; failed republishing retains the original. No readiness percentage change.- **2026-10-12** · Book numbering and style updates prepare every chapter before saving. Only closed native chapters are changed; imported IDML remains a read-only style/PDF source. If a later disk write fails, the error names the completed chapters; the batch is not a whole-book transaction. No readiness percentage change.- **2026-10-12** · Desktop write callbacks and CLI raster exports use the atomic writer too; open readers retain the original bytes, while private Unix modes and symlink targets survive replacement. Permanent tests cover both actual callers. No readiness percentage change.diff --cc apps/designcraft/src/main.rsindex c6d8648be,8f75573c5..56e51ddc0--- a/apps/designcraft/src/main.rs+++ b/apps/designcraft/src/main.rs@@@ -13,14 -11,11 +13,15 @@@#![cfg_attr(all(target_os = "windows", not(debug_assertions)), windows_subsystem = "windows")]#![deny(clippy::unwrap_used, clippy::expect_used, clippy::panic, clippy::unimplemented, clippy::todo, clippy::unreachable)]+#[cfg(target_os = "macos")]+mod apple_events;mod control_server;mod gpu;+ mod gpu_limits;mod logging;#[cfg(target_os = "macos")]+mod mac_window;+#[cfg(target_os = "macos")]mod native_menu;mod profile;@@@ -382,38 -259,17 +383,41 @@@ fn main() -> std::process::ExitCodeif let Some(icon) = app_icon() {options.viewport = options.viewport.with_icon(icon);}+ // The adapter's largest texture side instead of eframe's 8192, so a window across several+ // monitors keeps its surface (see `gpu_limits`).+ gpu_limits::request_adapter_texture_size(&mut options);// The graphics backend, decided before the window exists: a driver that faults takes the- // process down before any Rust code can catch it (see `gpu`).- let gpu = gpu::Startup::begin(if no_prefs() { None } else { profile::config_dir().map(|d| d.join(gpu::FILE)) }, env!("CARGO_PKG_VERSION"));- if let Some(s) = &gpu- && let eframe::egui_wgpu::WgpuSetup::CreateNew(create) = &mut options.wgpu_options.wgpu_setup- {- create.instance_descriptor.backends = s.backends();+ // process down before any Rust code can catch it (see `gpu::backend`).+ let fallback = gpu::backend::Fallback::begin(+ if no_prefs() { None } else { profile::config_dir().map(|d| d.join(gpu::backend::FILE)) },+ env!("CARGO_PKG_VERSION"),+ &gpu::backend::skipped_backends(&skip),+ );+ let instance_backends = fallback.as_ref().map(gpu::backend::Fallback::backends);+ let startup = std::sync::Arc::new(gpu::Startup::new(fallback, skip.clone()));+ // The adapter: the GPU that drives the (primary) display unless `WGPU_POWER_PREF` chooses a+ // kind; a GPU without a monitor reset its driver and took every monitor down. Logged first:+ // the first question in every black-window report.+ let power_env = eframe::wgpu::PowerPreference::from_env();+ let power = gpu::power_preference(power_env);+ let displays = gpu::preferred_displays(power_env);+ let chosen_gpu = !gpu::automatic(power_env);+ if chosen_gpu {+ log::info!("graphics processor chosen by WGPU_POWER_PREF ({power:?}): which GPU drives the display isn't considered");+ } else {+ let listed: Vec<String> = displays.iter().map(ToString::to_string).collect();+ log::info!("display GPUs (PCI vendor:device): {}", if listed.is_empty() { "unknown".to_string() } else { listed.join(", ") });}+ if let eframe::egui_wgpu::WgpuSetup::CreateNew(create) = &mut options.wgpu_options.wgpu_setup {+ if let Some(backends) = instance_backends {+ create.instance_descriptor.backends = backends;+ }+ create.instance_descriptor.flags = gpu::instance_flags();+ // Only adapters that can show the window, in the order `gpu` gives.+ create.native_adapter_selector = Some(gpu::selector(power, displays, startup.clone()));+ }+ gpu::watch_panics();+ gpu::watch_first_frame(startup.clone());// winit has no file drag-and-drop on Wayland (only on X11), so dropping images from the file// manager showed a "no" cursor. Run through XWayland when it's there; DESIGNCRAFT_WAYLAND=1// keeps the native Wayland backend.@@@ -424,103 -280,55 +428,104 @@@b.with_x11();}));}- eframe::run_native(- "DesignCraft",- options,- Box::new(move |cc| {- let mut gpu = gpu;- if let Some(rs) = &cc.wgpu_render_state {- gpu_limits::log_uncaptured_errors(&rs.device);- // What a bug report needs to know about the graphics driver.- let info = rs.adapter.get_info();- log::info!("graphics: {} on {:?} ({:?}; driver {} {})", info.name, info.backend, info.device_type, info.driver, info.driver_info);- if let (Some(s), Some(backend)) = (gpu.as_mut(), gpu::Backend::of(info.backend)) {- s.started_with(backend);+ // Registered before the event loop starts, so it catches the Finder event that launched the app+ // as well as later ones. Lives until the event loop returns; the app creator only borrows it.+ #[cfg(target_os = "macos")]+ let apple_events = apple_events::AppleEvents::install();+ #[cfg(target_os = "macos")]+ let events = &apple_events;+ let created = startup.clone();+ // A panic that ends the window (egui-wgpu's own) is caught here: never a crash.+ let run = std::panic::catch_unwind(std::panic::AssertUnwindSafe(|| {+ eframe::run_native(+ "DesignCraft",+ options,+ Box::new(move |cc| {+ let mut restarted = None;+ if let Some(rs) = &cc.wgpu_render_state {++ gpu_limits::log_uncaptured_errors(&rs.device);+ // What a bug report needs to know about the graphics driver.+ let info = rs.adapter.get_info();+ log::info!(+ "graphics: {} on {:?} ({:?}; driver {} {}; power preference {power:?})",+ info.name,+ info.backend,+ info.device_type,+ info.driver,+ info.driver_info+ );+ created.started_with(info.backend);+ created.created(&cc.egui_ctx);+ if !skip.is_empty() {+ // A processor chosen by `WGPU_POWER_PREF` can be the one that can't show the window.+ let hint = if chosen_gpu { " (without WGPU_POWER_PREF it uses the one that drives your display)" } else { "" };+ restarted = Some(format!(+ "The graphics processor tried first couldn't show the window, so DesignCraft started again on {} ({:?}, {:?}){hint}.",+ info.name.trim(),+ info.backend,+ info.device_type+ ));+ }}- }- let mut session = Session::new();- // Crash recovery: reopen what a previous run left unsaved, then keep it current.- session.recovery_dir = profile::recovery_dir();- let recovered = session.execute("file.recovery.open", &serde_json::json!({})).ok();- let mut app = DesignApp::new(session, services());- if let Some(line) = gpu.as_ref().and_then(gpu::Startup::status_line) {- app.status(line);- }- // Recovered documents matter more than the graphics note; both are in the log.- if let Some(n) = recovered.as_ref().and_then(|r| r["opened"].as_array()).map(Vec::len).filter(|n| *n > 0) {- app.status(format!("Recovered {n} unsaved document{} from the last session.", if n == 1 { "" } else { "s" }));- }- load_prefs(&mut app);- app.integrated_titlebar = cfg!(target_os = "macos");- if let Some(port) = control_port {- let rx = control_server::start(port, cc.egui_ctx.clone());- app = app.with_control(rx);- }- if sample {- let _ = app.run("file.newSample", serde_json::json!({}));- }- for f in files {- if let Err(e) = app.open_file("file.open", serde_json::json!({"path": f})) {- eprintln!("designcraft: {f}: {e}");+ let mut session = Session::new();+ // Crash recovery: reopen what a previous run left unsaved, then keep it current.+ session.recovery_dir = profile::recovery_dir();+ let recovered = session.execute("file.recovery.open", &serde_json::json!({})).ok();+ let mut app = DesignApp::new(session, services());+ if let Some(line) = restarted.or_else(|| created.status_line()) {+ app.status(line);}- }- Ok(Box::new(App {- app,- #[cfg(target_os = "macos")]- menu: None,- startup: gpu,- frames: 0,- }))- }),- )+ // Recovered documents matter more than the graphics note; both are in the log.+ if let Some(n) = recovered.as_ref().and_then(|r| r["opened"].as_array()).map(Vec::len).filter(|n| *n > 0) {+ app.status(format!("Recovered {n} unsaved document{} from the last session.", if n == 1 { "" } else { "s" }));+ }+ load_prefs(&mut app);+ // After `load_prefs`, which replaces the UI state and with it the status line.+ if let Some(note) = portable_note {+ app.status(note);+ }+ app.integrated_titlebar = cfg!(target_os = "macos");+ if let Some(port) = control_port {+ let rx = control_server::start(port, cc.egui_ctx.clone());+ app = app.with_control(rx);+ }+ if sample {+ let _ = app.run("file.newSample", serde_json::json!({}));+ }+ for f in files {+ if let Err(e) = app.open_file("file.open", serde_json::json!({"path": f})) {+ log::warn!("{f}: {e}");+ }+ }+ // The first frame is due from now (`gpu::watch_first_frame`).+ created.ready();+ Ok(Box::new(App {+ app,+ #[cfg(target_os = "macos")]+ menu: None,+ startup: created,+ #[cfg(target_os = "macos")]+ apple_events: events.connect(&cc.egui_ctx),+ #[cfg(target_os = "macos")]+ movable: None,+ frames: 0,+ }))+ }),+ )+ }))+ .map_err(|payload| designcraft_engine::guard::panic_message(payload.as_ref()));+ // The window's end, or a graphics failure that starts the app again. A failure is logged:+ // standard error and the log file, since a Windows start has no console to show it.+ // Documents that arrived after the last frame, for a start again to open too.+ #[cfg(target_os = "macos")]+ startup.opening(apple_events.queued());+ match gpu::finish(run, &startup) {+ Ok(()) => std::process::ExitCode::SUCCESS,+ Err(e) => {+ log::error!("DesignCraft stopped: {e}");+ std::process::ExitCode::FAILURE+ }+ }}#[cfg(test)]diff --cc docs/hardware-parity.mdindex 8bee7331d,9d6af6121..9c4bb17ed--- a/docs/hardware-parity.md+++ b/docs/hardware-parity.md@@@ -1,6 -1,6 +1,6 @@@# Hardware and platform parity- > **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-11 · **Change:** minor (font managers on macOS; shared print spooler; Windows CI passes) · **Target:** Adobe InDesign 2026 (21.6)-> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-12 · **Change:** trivial (Windows mixed-DPI drag and windows wider than 8192 px don't crash) · **Target:** Adobe InDesign 2026 (21.6)++> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-12 · **Change:** minor (font managers on macOS; shared print spooler; Windows CI passes; Windows mixed-DPI drag and windows wider than 8192 px don't crash) · **Target:** Adobe InDesign 2026 (21.6)What InDesign does with hardware, per platform, against DesignCraft. Layout is not aGPU-hungry workload, so this dimension carries little weight, but a start that fails on a@@@ -15,11 -15,10 +15,11 @@@ graphics driver loses the user entirely| GPU display (canvas) | GPU Performance: GPU preview, animated zoom (Metal on macOS; Windows with supported GPUs) | canvas rasterized on the CPU (vello_cpu, SIMD, multithreaded), presented by wgpu (Metal) | wgpu DirectX 12 (since #297), Vulkan/OpenGL fallback | Vulkan, OpenGL fallback | WebGPU, WebGL2 fallback || Start-up on any GPU | robust | Metal device lost on Intel Macs (#334) | AMD OpenGL crash (#167), launch failures (#273) | some reports (#192, #220) | || Backend fallback | n/a | `gpu.json` skips a backend whose start never showed a frame (#297) | same | same | |+| Adapter choice and restart | n/a | power saving; a GPU that fails or hangs at start-up is left out and the app starts again on the other one; indirect-call check off (#334) | the GPU that drives the primary display (`EnumDisplayDevices`); DirectX 12 adapters, then OpenGL, then Vulkan | the GPU that drives the panel or a monitor (sysfs), then the system's order | || Animated / scrubby zoom | ✓ (GPU) | ✓ (CPU tiles, damage regions) | ✓ | ✓ | ✓ |- | HiDPI / Retina | ✓ | ✓ | ✓ | ✓ | ✓ |+ | HiDPI / Retina | ✓ | ✓ | ✓ (drags across monitors with different scales keep the window's size: winit pinned to the rust-windowing/winit#4694 backport) | ✓ | ✓ || UI scaling | ✓ | ✓ (menus and dialogs usable at larger scales, #281) | ✓ | ✓ | ✓ |- | Multi-monitor, floating document windows | ✓ | ~ one window; New Window for the same document | ~ | ~ | ✗ |+ | Multi-monitor, floating document windows | ✓ | ~ one window; New Window for the same document; the window may span monitors up to the GPU's largest texture (16384 px on DirectX 12, Vulkan and Metal hardware), and beyond it draws wrongly instead of closing | ~ | ~ | ✗ || Printing | system print with PPDs, PostScript, separations | PDF to CUPS (`craft-print`) | Windows PDF raster spooler (`craft-print`) | PDF to CUPS (`craft-print`) | browser download || Colour-managed display (monitor profile) | ✓ | ✗ (working CMYK profile simulated; monitor profile not applied) | ✗ | ✗ | ✗ || Touch / pen | Touch workspace (Windows), gestures | trackpad pinch/scroll | ~ | ~ | ~ |