82 lines
4.7 KiB
Markdown
82 lines
4.7 KiB
Markdown
# E/F measured-label experiment implementation handoff
|
|
|
|
Local uncommitted implementation against `6ea7518e7be5b5f17d5fbc5d667da8b388058af4`.
|
|
No compiler, GUI, Gitea, commit or push run by this worker. Root owns all gates.
|
|
`rustfmt --edition 2024 --config skip_children=true` completed for the six
|
|
explicitly owned/authorized Rust files. This establishes formatting only.
|
|
|
|
## Changed implementation
|
|
|
|
- New private `crates/oa-desktop/src/diagram/label_layout_experiment.rs` contains
|
|
read-once external E/F/Baseline profile, one-target identity guards, measured
|
|
typography cache, shared Layout, fixed placements, collision guards, Canvas
|
|
line records, explicit SVG line export and five focused tests.
|
|
- `diagram.rs`: Scene stores the shared Layout, profile and font-system version;
|
|
both ordinary and work-preview scenes apply it before geometry consumers.
|
|
Existing cache additionally keys profile/font version. Drawing and SVG consume
|
|
the same ordered line positions. Derived target label bounds feed existing hit
|
|
and route-drag start code. The private adapter applies to already-routed data.
|
|
- Parent-authorized thin calls: `app.rs` Fit, `diagram_usage.rs` whole/edge bounds,
|
|
and `diagram/work_drag.rs` dirty-input shield. No second routing call introduced.
|
|
- `diagram/attachment_tests.rs`: existing manual Scene literal gains default fields.
|
|
- Parent supplied the pinned `harness/experiments/wrapped-label-20261001/fixture/eight-card.json`;
|
|
it is referenced with include_bytes, not rewritten by this worker.
|
|
|
|
No changes to core, schema, source formats, canonical label.text/Name, Project,
|
|
port/card/path state, or B's cue. The fixture and diagram are identified exactly;
|
|
other labels return untouched. Baseline returns the complete routed value unchanged.
|
|
Automatic guard failure leaves baseline rather than painting an invalid narrower
|
|
shape over an old hitbox. Nested/collapsed scenes are excluded from this witness.
|
|
|
|
## Measurement and scope
|
|
|
|
Pinned Iced 0.14 graphics Paragraph is accessible through
|
|
`iced::advanced::graphics::text::Paragraph`; the same implementation is used by
|
|
Canvas Text. Each fixed line is shaped at font 13 with absolute line height 16,
|
|
Basic ASCII shaping and no wrap. Width comes from Paragraph min_width; baseline
|
|
and resolved face family come from actual cosmic-text runs. A single face per
|
|
line is required; mixed fallback or unsupported metrics reject the trial.
|
|
Cached measurements are keyed by profile and Iced font-system version; ordinary
|
|
hover, selection and camera changes reuse the entire Scene. No character-count
|
|
width heuristic is used.
|
|
|
|
SVG writes explicit per-line x and shaped baseline y with the resolved family,
|
|
not browser wrapping or generic sans-serif. It does not embed the font: native
|
|
export rendering and font availability on another machine remain a validation
|
|
boundary, not proven glyph parity. Tests compare generated text/geometry records,
|
|
not raster output or browser appearance.
|
|
|
|
Automatic E permits exactly one straight own segment crossing both padded sides;
|
|
all foreign strokes, cards and labels (including association-end labels) are
|
|
excluded. Automatic F clears all strokes. Guards use measured boxes, card margin
|
|
12, other-label margin 4 and stroke margin 3. Fixed F's own-is-closer width margin
|
|
is explicitly asserted by its fixture test rather than accepted as a general
|
|
placement scoring rule.
|
|
|
|
Authored target labels keep the externally selected line shape and honor actual
|
|
fraction/offset. They deliberately retain that shape when a user moves into a
|
|
collision, reporting Layout.clear=false; silently unwrapping/resetting would
|
|
violate the trial boundary. Conservative whole-scene bounds retain prior bounds
|
|
and include moved authored boxes. No ordinary save/reopen formatting contract,
|
|
general typesetter, placement winner, or production policy is claimed.
|
|
|
|
## Parent gates
|
|
|
|
Suggested targeted test selector:
|
|
|
|
```powershell
|
|
cargo test --locked -p oa-desktop label_layout_experiment -- --test-threads=1 --nocapture
|
|
```
|
|
|
|
Five tests cover full unchanged baseline and all 12 point arrays/other labels,
|
|
actual measured dimensions and guard result, matching Canvas/SVG/picking/focus
|
|
geometry records, foreign-stroke/card rejection without mutation, authored
|
|
fraction/offset/shape retention during real route-preview construction, and
|
|
actual Scene/measurement cache reuse plus profile/revision invalidation.
|
|
The first test prints measured line/family/bounds records for parent capture.
|
|
|
|
Compilation, strict lint, fixture guard feasibility on this font installation,
|
|
native rendering, actual edit lifecycle, performance, independent fresh-reader
|
|
trial, and integration/publication remain pending. Preserve first failures and
|
|
revise at the responsible layer; no successful test/native outcome is asserted.
|