Skip to content

render: add Text IR v2 diagnostics and schema closure#881

Open
seo-rii wants to merge 2 commits into
edwardkim:develfrom
seo-rii:render-p13
Open

render: add Text IR v2 diagnostics and schema closure#881
seo-rii wants to merge 2 commits into
edwardkim:develfrom
seo-rii:render-p13

Conversation

@seo-rii
Copy link
Copy Markdown
Contributor

@seo-rii seo-rii commented May 13, 2026

변경 요약

이번 PR은 render P13 단계로, P12에서 열린 guarded GlyphRun variant contract 위에 Text IR v2 diagnostics와 schema closure metadata를 추가합니다.

핵심은 기본 렌더링 경로를 바꾸지 않으면서, TextRun fallback과 optional text variant 사이의 선택 상태를 JSON에서 설명할 수 있게 만드는 것입니다. 즉, 이번 단계는 CanvasKit/native glyph replay를 켜는 PR이 아니라, 후속 backend adoption 전에 fallback reason, strict profile guard, downgrade path를 먼저 안정화하는 PR입니다.

Text IR v2 closure 메모

P13은 Text IR v2를 완성하는 단계가 아니라, P11/P12에서 추가한 compatibility contract를 진단 가능한 형태로 닫는 단계입니다. 기존 TextRun fallback은 계속 canonical compatibility path로 남기고, GlyphRun은 optional sidecar variant로만 유지합니다.

주요 방향은 아래와 같습니다.

  • Compatibility first: normal export는 계속 schema v1 flattened TextRun + optional GlyphRun 형태를 유지합니다.
  • Report-only diagnostics: textV2 diagnostics는 renderer output을 바꾸지 않고, consumer가 fallback/variant 상태를 이해하는 데만 씁니다.
  • Slot diagnostics: text variant group별 fallback 존재 여부, strict variant 가능 여부, fallback reason을 JSON으로 내보냅니다.
  • Fallback-free guard: fallback-free strict profile은 모든 text slot에 strict visual variant가 있을 때만 통과합니다.
  • Downgrade policy: v1 compatibility writer의 downgrade path를 명시하고, faithful TextRun fallback이 없는 상태를 validation issue로 보고합니다.
  • Line-break risk telemetry: char overlap, vertical/rotated text, width ratio, distributed spacing, tab leader, field marker, explicit line/paragraph end 같은 layout-sensitive text를 report-only risk로 표시합니다.

자세한 배경과 현재 제한은 문서에 정리했습니다: https://github.com/seo-rii/rhwp/blob/render-p13/docs/text-ir-v2.md

What

  • src/paint/text_v2.rs 추가
    • TextV2Diagnostics
    • TextV2SlotDiagnostic
    • TextV2VariantDiagnostic
    • TextV2ValidationIssue
    • TextV2LineBreakRisk
    • TextV2CompatibilityProfile
  • PageLayerTree::to_json()에 additive textV2 diagnostics object 추가
  • usedFeatures / knownFeatures에 Text IR v2 diagnostics feature vocabulary 추가
  • layer schema minor version을 1.10으로 올림
  • fallback-free strict profile guard 추가
  • validate_text_variant_scope() 결과를 textV2.validationIssues로 노출
  • GlyphRun diagnostics 기반 strict visual eligibility와 fallback reason 정리
  • docs/text-ir-v2.md에 P13 diagnostics/export contract 추가

Non-goals

  • GlyphRun을 canonical text path로 전환하지 않습니다.
  • CanvasKit glyph replay를 켜지 않습니다.
  • native Skia glyph id replay 선택 정책을 바꾸지 않습니다.
  • GlyphOutline / outline stroke replay는 포함하지 않습니다.
  • variantOps sidecar reader/writer의 실제 migration은 이 PR에서 완료하지 않습니다.
  • public render path나 visual output을 바꾸지 않습니다.

variantOps와 richer outline payload는 같은 Text IR v2 closure 축에 있지만, 이번 PR은 그 전 단계인 diagnostics/downgrade/strict-profile guard를 먼저 여는 범위입니다. 그래서 PR은 draft로 열어두고, 필요하면 같은 branch에 follow-up commit으로 이어 붙일 수 있습니다.

Compatibility

  • 기본 renderer는 textV2 diagnostics를 몰라도 기존 TextRun fallback을 그대로 사용할 수 있습니다.
  • requiredFeatures는 계속 비워 둡니다.
  • textV2는 additive/report-only payload입니다.
  • normal export의 compatibilityProfilev1Compat입니다.
  • schema v1 compatibility writer는 schemaV1FlattenedTextRunAndGlyphRun downgrade path를 유지합니다.

관련 이슈

Refs #536

테스트

  • git diff --check upstream/devel...HEAD
  • rustfmt --check --edition 2021 src/paint/text_v2.rs src/paint/json.rs src/paint/schema.rs
  • rustfmt --check --edition 2021 --config skip_children=true src/paint/mod.rs
  • cargo test --lib -q text_v2
  • cargo test --lib -q paint::
  • cargo test --lib -q text_shape
  • cargo test --lib -q text_variants
  • cargo test --lib -q layer_tree_schema_contract_is_stable
  • cargo test --lib -q serializes_text_and_shape_ops_for_browser_replay
  • cargo test --lib -q serializes_optional_glyph_run_variant_with_text_run_fallback
  • cargo test --lib -q

스크린샷

없음.

이번 PR은 schema/diagnostics export 변경입니다. renderer visual output은 기존 TextRun fallback을 유지합니다.

@seo-rii seo-rii marked this pull request as ready for review May 14, 2026 03:54
Copilot AI review requested due to automatic review settings May 14, 2026 03:54
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds Text IR v2 “report-only” diagnostics and schema closure metadata to the PageLayerTree JSON export, while keeping the existing schema-v1 flattened TextRun + optional GlyphRun compatibility contract as the canonical path. The goal is to make text variant/fallback state and strict-profile eligibility explicitly diagnosable for future backend adoption.

Changes:

  • Introduces src/paint/text_v2.rs implementing TextV2Diagnostics (slot diagnostics, validation issues, and line-break risk telemetry) plus compatibility profile guards.
  • Extends PageLayerTree::to_json() to emit an additive "textV2" object and updates text feature vocabulary (usedFeatures / knownFeatures).
  • Bumps layer schema minor version from 1.9 → 1.10 and updates docs describing the new diagnostics/export contract.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/paint/text_v2.rs New Text IR v2 diagnostics/guards module (slot diagnostics, validation issues, line-break risk telemetry).
src/paint/json.rs Adds "textV2" diagnostics object to exported JSON and updates feature vocabulary + schema minor assertions.
src/paint/schema.rs Schema minor version bump to 10 and updates stability test.
src/paint/mod.rs Exposes the new text_v2 module and re-exports diagnostics types.
docs/text-ir-v2.md Documents the P13 diagnostics payload and strict-profile/telemetry semantics.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/paint/text_v2.rs
Comment thread src/paint/text_v2.rs Outdated
Comment thread src/paint/json.rs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants