# 05 — Text, IME, Accessibility, and Layout *Research date: 2026-10-21* ## Executive Summary - **Pure-Rust text shaping and font parsing are production-ready in 2026 (`harfrust` + `skrifa` + `fontique`).** Google Fonts' `harfrust` (`v0.14.0`, Oct 2026) has reached HarfBuzz 14.5.1 parity, uses zero-copy `fontations`/`read-fonts` tables directly (`ShaperData` + `ShaperInstance`), and runs 10–15% faster than `rustybuzz` while supporting variable-font variation coordinates, AAT (`morx`/`kerx`/`trak`), and shape plans. Pair it with `skrifa` (`v0.42.0`) for TrueType/CFF hinting + COLRv1 and `fontique` (`v0.8.0`) for font enumeration and script/locale fallback. - **Keep OS font metrics on Apple (`CTFont`) while using `harfrust` + `parley` for cross-platform shaping and line breaking.** On macOS and iOS, system UI fonts (`SF Pro`, `SF Compact`, `.AppleSystemUIFont`) rely on optical-size (`opsz`) tracking tables (`trak`) and OS-specific ascent/descent rules. Use `parley` (`v0.12.0`, built on `parley_engine` + `fontique` + `harfrust` + `skrifa` + `icu4x`) for bidirectional paragraph layout, mixed inline runs, and cursor/selection geometry, augmented with GPUI's two-tier unwrapped-vs-wrapped `LineLayoutCache` (`zed/crates/gpui/src/text_system/line_layout.rs:523-698`) so container resizes only recompute wrap boundaries without re-shaping. - **Luminance-quantized glyph dilation solves light-on-dark thin text on Apple displays without subpixel LCD fringes.** Subpixel LCD rendering is incompatible with transparent layers and GPU transforms. Instead, steal Kit's GPUI fork (`kitlangton/gpui`) luminance glyph dilation (`kitlangton/gpui/src/platform/mac/text_system.rs:42-81, 470-564`, commit `2582af8ad0`): quantize text color relative luminance ($0.2126R + 0.7152G + 0.0722B$) into 5 cache buckets (`0..=4`), pad `raster_bounds` by `1px`, and rasterize with `set_should_smooth_fonts(true)` at that gray fill level when `AppleFontSmoothing != 0`, paired with linear-space (`sRGB` framebuffer) alpha blending. - **Never re-rasterize hinted glyphs on every frame of a spring transform.** Vello's `glifo` (`vello/glifo/src/glyph.rs:1702-1731`) folds uniform transform scale into `draw_font_size` and hashes `size.to_bits()`, thrashing the glyph atlas and causing stem-hinting pop on every frame of a 120 Hz spring animation. During active transforms, lock glyphs to unhinted/linear-metrics outlines rasterized at the target (or octave-stepped) scale and sample bilinearly, or promote large/hero animated text (`> 28px` or explicitly tagged) to Rive-style per-glyph vector paths (`rive-runtime/src/text/text.cpp:544-592`). - **Use a unified `SumTree`-backed rope + display map for all text editing, from single-line inputs to multi-megabyte buffers.** Zed's concurrent B+ tree `SumTree` (`zed/crates/sum_tree/src/sum_tree.rs`, `TREE_BASE = 6`) maintains UTF-8 bytes, UTF-16 code units (required by Apple/Windows/Web IME), UTF-32 chars, line breaks, and soft-wrap display rows in $O(\log N)$ time with zero-copy `Arc` snapshots. - **Implement native platform IME protocols directly on desktop and iOS, with a sliding-window `