Skip to content

render: add Text IR v2 compatibility contract#797

Closed
seo-rii wants to merge 1 commit into
edwardkim:develfrom
seo-rii:render-p11
Closed

render: add Text IR v2 compatibility contract#797
seo-rii wants to merge 1 commit into
edwardkim:develfrom
seo-rii:render-p11

Conversation

@seo-rii

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

Copy link
Copy Markdown
Contributor

변경 요약

이번 PR은 render P11 단계로, P9까지 반영된 최신 devel 위에 Text IR v2 compatibility contract를 추가합니다.

핵심은 TextRun fallback 의미를 바꾸지 않으면서, 앞으로 GlyphRun/font resource/native glyph replay로 넘어갈 수 있는 schema contract를 먼저 여는 것입니다. 즉, 이번 단계는 GlyphRun을 기본 경로로 만드는 PR이 아니라 TextRun v2 compatibility contract를 완성하는 PR입니다.

Text IR v2 설계 메모

P11은 이 시리즈에서 Text IR v2 개념이 처음 들어오는 지점입니다. 다만 이 PR에서 Text IR v2를 완성하거나 기존 text replay contract를 대체하지는 않습니다. 기존 TextRun fallback을 유지한 채, 후속 GlyphRun/font resource/native glyph replay가 붙을 수 있는 compatibility contract를 먼저 여는 단계입니다.

간단히 정리하면 아래 방향입니다.

  • Compatibility first: 모든 backend는 계속 TextRun fallback으로 렌더링할 수 있어야 합니다.
  • Additive schema: schemaMinorVersion, feature negotiation metadata, text metadata를 추가하되 기존 consumer를 깨지 않게 둡니다.
  • Source traceability: PageLayerTree.text_sourcesTextRun.source span으로 text op의 원문 범위를 추적할 수 있게 합니다.
  • Placement/cluster metadata: paintStyle, projectionKind, orientation, placement, clusterBasis, clusters, legacyVisuals로 text replay 의미를 더 명확히 표현합니다.
  • External special visual ops: char overlap, control mark, tab leader, decoration을 별도 paint op로 낮추되, P11에서는 기존 renderer가 skip해서 double-painting을 막습니다.
  • Still designing: GlyphRun eligibility, font resource table, cluster basis, fallback diagnostics는 P12 이후 guarded variant 작업에서 확정합니다.

자세한 배경과 설계 메모는 repo 문서에 정리했습니다: https://github.com/seo-rii/rhwp/blob/render-p11/docs/text-ir-v2.md

주요 변경은 아래와 같습니다.

  • PageLayerTree JSON에 schemaMinorVersion, resourceTableMinorVersion, schema, resourceTable metadata 추가
  • usedFeatures, requiredFeatures, optionalFeatures, knownFeatures, text metadata 추가
  • PageLayerTree.text_sources와 export-local TextSourceTable 추가
  • TextRun.source span을 JSON으로 export
  • TextRun.paintStyle, projectionKind, orientation, placement, clusterBasis, clusters, legacyVisuals export
  • PaintOp::CharOverlap, PaintOp::TextControlMark, PaintOp::TabLeader, PaintOp::TextDecoration 추가
  • LayerBuilder에서 char overlap / tab leader / decoration / visible control mark를 explicit visual op로 낮춤
  • 기존 SVG / Canvas / native Skia renderer는 새 special visual op를 skip해서 double-painting 방지
  • docs/text-ir-v2.md에 Text IR v2 migration contract 문서화
  • README에 P11 범위와 GlyphRun 후속 분리 명시

control mark 계열은 기존 renderer output option과 맞추기 위해 showParagraphMarks 또는 showControlCodes가 켜진 경우에만 external op로 낮춥니다. 반면 char overlap, tab leader, decoration은 visual payload가 항상 존재하므로 explicit op를 만들고, 기존 TextRun payload는 legacy mirror로 둡니다.

관련 이슈

Refs #536

범위

이번 PR에 포함한 범위는 아래 정도입니다.

  • Text IR v2 compatibility metadata
  • source table / source span export
  • text placement / cluster metadata export
  • special text visual externalization
  • unknown/additive op를 기존 renderer가 안전하게 건너뛰는 처리
  • JSON schema negotiation metadata
  • Text IR v2 문서화

비목표

아래는 일부러 이번 PR에 넣지 않았습니다.

  • GlyphRun을 canonical text path로 전환
  • font blob / font face resource table 구현
  • native Skia glyph id replay
  • CanvasKit glyph replay
  • glyph outline replay
  • public render path 변경
  • binary resource interning / typed array transport

GlyphRun 계열은 font identity와 fallback 검증이 같이 필요합니다. 그래서 P11에서는 TextRun fallback을 그대로 유지하고, P12에서 guarded GlyphRun variant replay로 넘기는 편이 맞습니다.

테스트

  • git diff --check origin/devel..HEAD
  • cargo test --lib paint::json --features native-skia
  • cargo test --lib paint::builder --features native-skia
  • cargo test --lib layer --features native-skia
  • cargo test --features native-skia --lib skia

스크린샷

없음.

이번 PR은 Text IR schema/export contract 변경입니다. renderer visual output은 기존 TextRun fallback을 유지하고, 새 explicit visual op는 기존 renderer에서 double-painting 되지 않도록 skip합니다.

edwardkim added a commit that referenced this pull request May 11, 2026
…ract (P11)

P11 단계 — P9 영역 영역 text replay parity 후속 영역 영역 Text IR v2 compatibility contract 추가.

Skia native raster Issue #536 트래킹 단계적 진전:
P4 #599 → P5 #626 → P6 #720 → P8 #761 → P9 #769 → P11 #797

중요: 본 PR 은 GlyphRun 을 기본 경로로 만드는 PR 이 아니라 TextRun v2 compatibility contract 를 완성하는 PR.

4 본질 원칙:
- Compatibility first — 모든 backend 가 TextRun fallback 으로 렌더링 가능
- Additive schema — schemaMinorVersion + feature negotiation (기존 consumer 미파괴)
- Source traceability — text_sources + TextRun.source span
- Placement/cluster metadata — paintStyle/projectionKind/orientation/placement/clusterBasis/clusters/legacyVisuals

신규 인프라:
- PaintOp::{CharOverlap, TextControlMark, TabLeader, TextDecoration} — explicit visual ops
- PageLayerTree.text_sources + TextSourceTable (export-local)
- TextRun.source span + 7 신규 metadata
- schemaMinorVersion + resourceTableMinorVersion + feature negotiation
- docs/text-ir-v2.md migration contract

Renderer 정정 — 4 backend 동기 (feedback_image_renderer_paths_separate 권위 사례):
- svg_layer.rs / canvas.rs / skia/renderer.rs / web_canvas.rs — 신규 special visual op skip (double-painting 방지)

Non-goals (Still designing):
- GlyphRun eligibility / font resource table / cluster basis / fallback diagnostics — P12+ 분리

검증:
- cargo build/test/clippy --release ALL GREEN (clippy -D warnings)
- native-skia 28/28 PASS (PR #769 인프라 보존)
- 광범위 sweep 7 fixture / 170 페이지 / 회귀 0 (Compatibility first 원칙 입증)
- 시각 판정 면제 (작업지시자 결정 — contract 정합 단계 + 결정적 검증 + sweep 통과)

Refs #536
@edwardkim

Copy link
Copy Markdown
Owner

@seo-rii 검토 완료했습니다. 감사합니다.

처리 결과

Merge commit: 098db015 (devel)

본질

P11 — Text IR v2 compatibility contract. PR #599 (P4) → #626 (P5) → #720 (P6) → #761 (P8) → #769 (P9) → P11 (#797) 단계적 진전 (Issue #536 트래킹).

Compatibility first + Additive schema + Source traceability + Placement/cluster metadata 4 본질 원칙 영역 영역 TextRun fallback 유지 + 후속 GlyphRun / font resource / native glyph replay 영역 영역 schema contract 미리 열기.

검증

  • cargo build/test/clippy --release ALL GREEN (clippy -D warnings)
  • native-skia 28/28 PASS (PR render: improve Skia text replay parity #769 인프라 보존)
  • 광범위 sweep 170/170 same diff=0 (Compatibility first 원칙 입증)
  • 시각 판정 면제 (contract 정합 단계 + 결정적 검증 + sweep 통과)

feedback_image_renderer_paths_separate 권위 사례 강화

4 backend (svg_layer / canvas / skia/renderer / web_canvas) 동기 정정 — 신규 special visual op skip (double-painting 방지).

5/11 사이클 — Skia native raster 트래킹의 후속 단계 (P12+ GlyphRun 영역 영역 분리 명시), 수고하셨습니다.

@edwardkim

Copy link
Copy Markdown
Owner

Merged. Merge commit: 098db01

@edwardkim edwardkim closed this May 11, 2026
edwardkim added a commit that referenced this pull request May 11, 2026
PR #797 (Refs #536) — P11 Text IR v2 compatibility contract.
Skia native raster 트래킹 단계적 진전 (P4→P5→P6→P8→P9→P11).

Merge commit: 098db01
Cherry-pick: 795a132
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