render: adopt guarded text variants for backend replay#916
Conversation
There was a problem hiding this comment.
Pull request overview
This PR introduces a GlyphOutline text variant (Text IR v2 strict outline sidecar) alongside the existing TextRun/GlyphRun, bumps the layer JSON schema minor version to 11, and adds a backend-agnostic variant-selection diagnostic API. The renderer adapters (Canvas, SVG, Skia, WebCanvas) are updated to fall through GlyphOutline so the public render path is unchanged. Validation is extended to enforce that outline sidecars carry a anchorOpId in the same paint-order slot.
Changes:
- New
LayerGlyphOutlinePaint/PaintOp::GlyphOutlinetypes, JSON serialization, andtext.glyphOutline*feature metadata at schema minor 11. analyze_text_variant_selectionAPI (with backend, reject-reason, and report types) for backend-side variant choice diagnostics.- Sidecar anchor validation in
text_variants.rsand outline-aware diagnostics/fallback reasons intext_v2.rs.
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| src/paint/paint_op.rs | Adds GlyphOutline variant and supporting outline/stroke types. |
| src/paint/mod.rs | Re-exports the new outline types. |
| src/paint/schema.rs | Bumps schema_minor_version 10 → 11. |
| src/paint/json.rs | Serializes GlyphOutline, adds outline/strict-sidecar features, splits has_glyph_runs/has_glyph_outlines. |
| src/paint/text_v2.rs | Diagnostics for outline strictness and fallback reasons. |
| src/paint/text_variants.rs | Adds anchor validation for outline sidecars and tests. |
| src/renderer/layer_renderer.rs | New analyze_text_variant_selection API plus extensive tests. |
| src/renderer/canvas.rs | Routes GlyphOutline through fallback (no public render change). |
| src/renderer/svg_layer.rs | Same fallback handling for SVG backend. |
| src/renderer/web_canvas.rs | Same fallback handling for web canvas backend. |
| src/renderer/skia/renderer.rs | Skips unselected outline variants and ignores outline ops in replay. |
| docs/text-ir-v2.md | Documents the P14 GlyphOutline contract and selection diagnostics. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…ion API (PR #916, @seo-rii) additive 변경, 기존 렌더링 경로 무변경. TextRun fallback 유지. - paint/paint_op.rs — PaintOp::GlyphOutline 신규 - paint/text_variants.rs — analyze_text_variant_selection 진단 API - paint/text_v2.rs — outline strict sidecar 계약 - paint/json.rs — text.glyphOutline feature metadata + payload serialization - renderer/layer_renderer.rs — CanvasKit backend variant selection 준비 (+907) - schema 1.11 검증: - cargo test --release --lib: 1275 passed (+17 신규) - PNG 시각 판정 ★ 통과 Refs #536 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
검토 + cherry-pick 머지 완료. 감사합니다. 처리 결과
재검증
P12→P13→P14 단계적 진행이 일관됩니다. 수고하셨습니다. |
What
PaintOp::GlyphOutline을 추가해서 Text IR v2의 strict outline sidecar 계약을 잡았습니다.text.glyphOutline/text.glyphOutline.strictSidecarfeature metadata와 outline payload serialization을 추가했습니다.TextRunfallback은 계속 기본 경로로 유지하고, SVG/Canvas/native Skia adapter는GlyphOutline을 직접 그리지 않도록 fallback-safe하게 처리했습니다.analyze_text_variant_selection진단 API를 추가했습니다.Why
P13까지는 Text IR v2 diagnostics가 “이 슬롯이 strict variant로 승격 가능한가”를 설명하는 단계였습니다. P14는 그 다음 단계로, 실제 backend가 선택할 수 있는 variant 후보와 거절 사유를 안정적으로 만들기 위한 준비입니다.
이번 PR은 public canvas/default render path를 바꾸지 않습니다. 아직 glyph/outline을 실제로 그리는 PR이 아니라, backend가 안전하게 선택하거나
TextRun으로 되돌아갈 수 있는 계약과 테스트를 먼저 넣는 쪽입니다.Non-goals
Tests
cargo test text_variant --libcargo test glyph_outline --libcargo test canvaskit --libcargo test renderer::layer_renderer --libcargo test paint::json --libcargo test paint::text_v2 --libcargo test --lib