Skip to content

HWPX → 어댑터 → HWP 변환 후 TypesetEngine 페이지 수 차이 보정 #314

@planet6897

Description

@planet6897

선행: #313 (TypesetEngine main 전환)

배경

#313 에서 `paginate()` 진입점을 Paginator → TypesetEngine으로 전환. 이때 `tests/hwpx_to_hwp_adapter.rs` 의 3개 테스트가 회귀하여 `#[ignore]` 처리됨.

증상

```
[#178 Stage 4] hwpx-h-02: orig=9, after_adapter=10
```

  • HWPX 직접 로드 → TypesetEngine: 9쪽
  • HWPX → 어댑터 → HWP 직렬화 → 재로드 → TypesetEngine: 10쪽 (+1)
  • Paginator 로 측정 시는 동일 페이지 수 (회귀 없음)

원인 추정

어댑터(`src/adapter` 영역)가 HWPX의 paragraph/line_seg 정보를 HWP로 변환할 때 TypesetEngine이 의존하는 line_seg 정확도(특히 vpos/line_height 같은 필드)를 보존하지 못함. Paginator는 자체 height_measurer 기반이라 영향 없으나 TypesetEngine은 LINE_SEG 직접 사용으로 더 민감.

격리된 테스트

  • `tests/hwpx_to_hwp_adapter.rs::stage4_page_count_recovered_hwpx_h_02`
  • `tests/hwpx_to_hwp_adapter.rs::stage5_all_three_samples_recover_via_unified_entry_point`
  • `tests/hwpx_to_hwp_adapter.rs::stage6_verify_recovered_for_all_three_samples`

`#[ignore]` 어트리뷰트 + 사유 메시지로 표시됨. 본 sub-issue 완료 시 격리 해제.

작업 범위

  1. 어댑터의 paragraph/line_seg 변환 로직 검토 (`src/adapter` 영역)
  2. hwpx-h-02 변환 전후 LINE_SEG 데이터 비교 (vpos, line_height, line_spacing 등)
  3. 보존되지 않는 필드 식별 + 보강
  4. 격리된 3개 테스트 `#[ignore]` 제거 + 통과 확인
  5. 원본 HWPX 직접 페이지네이션 결과와 어댑터 변환 후 결과 일치 확인

검증

  • 격리된 3개 테스트 통과
  • `cargo test` 전체 회귀 0
  • hwpx-h-01/h-02/h-03 모두 어댑터 변환 후 페이지 수 보존

비범위

  • TypesetEngine 자체 변경
  • Paginator fallback 동작 변경

참고

  • `mydocs/report/task_m100_313_report.md`
  • `tests/hwpx_to_hwp_adapter.rs` (격리 테스트 + 메시지)
  • `src/renderer/typeset.rs` (LINE_SEG 의존 로직)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions