diff --git a/docs/research/thing2-text-input-a11y-prior-art.md b/docs/research/thing2-text-input-a11y-prior-art.md new file mode 100644 index 0000000..62d3b18 --- /dev/null +++ b/docs/research/thing2-text-input-a11y-prior-art.md @@ -0,0 +1,294 @@ +# Thing 2.0: text shaping, text input/IME, focus, accessibility, GPU glyphs: prior art (Eyes pass, 2026-10-10) + +Serves the fork **thing2-text-ownership**: who owns text shaping, text editing/IME, keyboard +focus and accessibility under the ruling `thing:ruling:thing2-one-solver-taffy` +(typed retained document, one Taffy solver, closed render-command list, thin backends). +Options: (a) Thing owns all, backends only draw; (b) hybrid, solver owns geometry and +backends place native controls/a11y nodes at solved rects; (c) something unnamed. +Item 6 (GPU glyph rasterization) is an operator scope addition. + +Read-only facts with evidence pointers. No recommendation. Does not repeat +`thing2-foundation-prior-art.md` (Clay/Taffy/Yoga basics, AccessKit web "planned"). +Marks: **(inferred)** = my juxtaposition; **[background]** = prior knowledge, not re-fetched. +Versions/dates are crates.io `max_stable_version`/`updated_at` and GitHub API, read 2026-10-10. + +--- + +## 1. Rust text stacks that pair with Taffy + +| Crate | Latest (date) | Licence | Role | +| --- | --- | --- | --- | +| parley | 0.12.0 (2026-10-09) | Apache-2.0 OR MIT (emoji crate MIT-only) | rich-text layout, selection/editing, IME primitives | +| fontique | 0.12.0 (2026-10-09) | [background: same repo, Apache-2.0 OR MIT] | font enumeration, fallback | +| cosmic-text | 0.19.0 (2026-04-22) | Apache-2.0 OR MIT | shaping + layout + editor in one crate | +| harfrust | 0.14.0 (2026-10-04) | [background: MIT] | HarfBuzz port; shaping | +| rustybuzz | 0.20.1 (2024-11-12; no release since) | [background: MIT] | older HarfBuzz port | +| swash | 0.2.10 (2026-07-17) | [background: Apache-2.0 OR MIT] | scaling/rasterising | +| fontdb | 0.24.0 (2026-07-29) | [background: MIT] | font DB | +| taffy | 0.14.0 (2026-08-24) | MIT | layout | + +- **parley** github.com/linebender/parley README: "provides an API for implementing rich text + layout"; shaping by HarfRust, bidi by ICU4X, line breaking in Parley, "utilities for text + selection and editing", fontique for fallback, skrifa for outlines, ICU4X for segmentation. + 753 stars, MSRV 1.88 (README). Repo tree has `parley/src/editing/{editor,selection}.rs` and + `examples/editor/src/{accessibility,access_ids}.rs` (AccessKit text example). PRs: "Implement IME + primitives for PlainEditor" #136 (closed 2025-01-21), "Add editor features required for Android IME" + #334 (2025-06), IME baseline-jitter / text-doubling fixes #599, #601 (2026-04/05). Slint's + `accessibility-text` feature enables `parley?/accesskit`. +- **cosmic-text** github.com/pop-os/cosmic-text: 2.2k stars, 841 commits. README: HarfRust shaping, + bidi, swash rendering, own font fallback built from Chromium/Firefox lists; roadmap lists text + editing, selection, bidi selection, copy/paste, click detection (page does not say which are + done). IME not mentioned. Cargo.toml: harfrust 0.5, skrifa 0.40, fontdb 0.24, unicode-bidi, + unicode-linebreak, unicode-segmentation; features `no_std`, `wasm-web`. +- **Who uses which** (manifests on `main`, read today): + - **Bevy**: `bevy_ui` -> taffy 0.14, accesskit 0.25; `bevy_text` -> parley 0.11, swash 0.2.6. + IME PRs #23795 / #23841 "Text input IME support" closed 2026-04-21; #24421 "Fix IME text input + wrapping" closed 2026-06-06. [background: Bevy used cosmic-text before.] + - **Slint**: Taffy 0.10, flexbox feature only (`internal/core/Cargo.toml`); `shared-parley` is a + default feature; parley 0.11.1; `accessibility-text` feature; accesskit 0.24, accesskit_winit 0.33. + - **Blitz** (DioxusLabs): Stylo (CSS) + Taffy (box layout) + Parley (text layout) per README; + `blitz-dom` has `events/ime.rs` and `accessibility.rs`; feature `accessibility = ["accesskit"]`; + `blitz-shell` = winit + AccessKit + muda. README: "beta ... many bugs and missing features". + - **Xilem/Masonry**: README: winit, Parley/Fontique, AccessKit. `masonry_core` depends on accesskit + and parley; widgets `text_area.rs`, `text_input.rs`. masonry/xilem 0.4.0 on crates.io are + 2025-10-29 (repo pushed 2026-09-14). README: "experimental". + - **GPUI (Zed)**: `crates/gpui` depends on taffy and accesskit; `font-kit` default feature; + per-platform text systems (`gpui_apple/src/text_system.rs`, `gpui_wgpu` with font-kit, + `gpui_web/src/{text_system,canvas_text}.rs`). AccessKit PRs #54398, #56065, #64212, #64214 all + closed (merged vs not not checked), latest 2026-09-24. + - **COSMIC / iced**: cosmic-text is pop-os's own crate [background]. + - **iocraft** (terminal): Taffy 0.5.2 flexbox, unicode-width 0.1.13 (section 5). + - **egui**: accesskit workspace dep; own text layout [background]. +- Taffy has no text layout; leaf measure functions supply sizes (prior-art doc 2.2). + +## 2. How Taffy-based toolkits do text input and IME + +- **Masonry/Xilem (desktop)**: IME flows from winit into `TextArea`. Issues in + github.com/linebender/xilem: "Re-add IME support" #762 (closed 2024-11-30), "Ensure that IME events + interact with focus as expected" #1004, "Improve IME area reporting and set IME area in + TextArea" #785, open #1692 "TextArea: on Ime::Disabled use finish_compose()" (2026-03-26), + baseline-jitter fixes #1716 / #1718 (2026-04). Editing buffer is Parley's `PlainEditor` (inferred + from parley #136 + masonry text_area). `xilem_web` is a separate DOM backend (README: "a web backend + and a Masonry backend"); no Masonry-on-canvas web build found. +- **Blitz**: `blitz-dom/src/events/ime.rs` `handle_ime_event` sends `BlitzImeEvent` to the focused + node's `text_input_data_mut().apply_ime_event(font_ctx, layout_ctx, event)`: text input state lives + in the DOM node, not a native control. Shell is winit; README lists no web target. +- **Bevy UI**: IME merged 2026-04/06 (above); accessibility in `bevy_a11y`. +- **Slint**: docs.slint.dev/latest/docs/slint/guide/platforms/web: "Accessibility features (such as + screen readers) are not available" (WebGL canvas, no DOM); Wasm uses Winit backend + FemtoVG; + "running Slint in the browser is currently not recommended for building general-purpose web + applications". Text input / IME on web not addressed on that page. +- **GPUI web** (`crates/gpui_web/src/ime_mirror.rs` header): "The hidden `