Skip to content

Task #700: 셀 paragraph cut 위치 vpos 정합 — compute_cell_line_ranges cum 절대 동기화#706

Open
planet6897 wants to merge 5 commits intoedwardkim:develfrom
planet6897:task700
Open

Task #700: 셀 paragraph cut 위치 vpos 정합 — compute_cell_line_ranges cum 절대 동기화#706
planet6897 wants to merge 5 commits intoedwardkim:develfrom
planet6897:task700

Conversation

@planet6897
Copy link
Copy Markdown
Contributor

closes #700

요약

compute_cell_line_ranges 의 cum 을 paragraph 진입 시 LINE_SEG.vpos 절대값으로 동기화하여 한컴 vpos 단위 abs_limit 와의 mismatch 정합화.

결함

samples/inner-table-01.hwp cell[11] (사업개요, 26 paras) 의 cell-internal split 시:

  • p2 첫 줄에 - 전사 데이터 수집/유통체계 구축 (p[17]) 누락 → rhwp 가 p[18] 부터 표시
  • 원인: cum 누적 metric (line_height + line_spacing + spacing) 이 한컴 LINE_SEG.vpos 누적과 ~50px 어긋남 → abs_limit (한컴 vpos 단위) 와 비교 시 더 많은 paragraph 가 visible

변경

src/renderer/layout/table_layout.rs::compute_cell_line_ranges:

if pi > 0 && cell_first_vpos == 0 {
    if cur_first_vpos < prev_end_vpos {
        // vpos 리셋 — page-break (Task #697)
        if has_limit && cum < abs_limit { cum = abs_limit; }
    } else {
        // 정상 누적 — vpos 절대 동기화 (전진만)
        let target_cum = hwpunit_to_px(cur_first_vpos, self.dpi);
        if target_cum > cum { cum = target_cum; }
    }
}

가드:

시각 정합 ✓

페이지 변경 전 변경 후 (= PDF 정합)
p1 cell[11] 마지막 visible p[19] p[16]
p2 cell[11] 첫 visible p[18] p[17] (- 전사 데이터 수집/유통체계 구축)

회귀 검증

검증 영역 결과
cargo test --release 전체 (21 그룹) ✅ 0 failures
tests/svg_snapshot.rs (form-002 포함) ✅ pass
samples/hwpx/form-002.hwpx p1 (cell[73] paras=29) ✅ paragraph 누락 없음
samples/k-water-rfp.hwp (18p) RMSE 22.87% (동일)
samples/issue_265.hwp / samples/hwp3-sample.hwp RMSE 22.00% (동일)

→ 회귀 없음.

관련

산출물

  • mydocs/plans/task_m100_700.md — 수행 계획서
  • mydocs/plans/task_m100_700_impl.md — 구현 계획서 (옵션 C)
  • mydocs/working/task_m100_700_stage1.md — 정밀 진단
  • mydocs/working/task_m100_700_stage3_1.md — 구현 결과
  • mydocs/report/task_m100_700_report.md — 최종 보고서

planet6897 added 5 commits May 8, 2026 10:57
- mismatch 산술: line metric 누적 vs vpos 누적 ~50px 차이 (cell[11] p[19] 끝)
- 한컴 PDF cut 위치 = p[16] 끝 (387.78px), abs_limit (459.7) 보다 72px 일찍
- pagination engine 의 split_end_content_limit 산출이 line metric 기반 = 한컴 vpos 단위와 mismatch
- form-002 회귀 원인 분석: paragraph 사이 spacing vpos delta vs line metric mismatch
- 정정 방향 3옵션 (A height_measurer / B layout y 보정 / C cum 동기화) 권고: C 우선
- compute_cell_line_ranges 의 cum 을 LINE_SEG.vpos 절대값으로 동기화 (차분 누적 X)
- 셀별 가드: cell_first_vpos == 0 (한컴 정상 인코딩 케이스만 적용)
- target_cum > cum 조건 — cum 만 전진 허용
- form-002 회귀 가드 — 차분 누적의 paragraph 사이 mismatch 회피
- 단위 테스트 3개 + 회귀 fixture 군 RMSE 검증
- paragraph 진입 시 cum 을 LINE_SEG.vpos 절대값으로 동기화 (전진만 허용)
- 셀별 가드: cell_first_vpos == 0 (한컴 정상 인코딩 케이스만)
- vpos 리셋 검출 + cum=abs_limit 강제 (Task edwardkim#697 통합)
- 차분 누적 (delta) 대신 절대 동기화 — form-002 회귀 가드

검증:
- cargo test --release 21 그룹 0 fail
- inner-table-01.hwp p2 첫 줄 '- 전사 데이터 수집/유통체계 구축' 정상 ✓
- 회귀 fixture (form-002, k-water-rfp, issue_265, hwp3-sample) RMSE 동일 = 회귀 없음
- inner-table-01.hwp p2 첫 줄 '- 전사 데이터 수집/유통체계 구축' 정상 ✓
- 회귀 fixture (form-002, k-water-rfp, issue_265, hwp3-sample) RMSE 동일
- cargo test --release 21 그룹 0 fail
- cell_first_vpos == 0 가드 + 절대 동기화로 form-002 회귀 가드 성공
inner-table-01.hwp p1 의 cell[10] '사업개요' 라벨이 split row 라는 이유만으로
Top 정렬 강제되어 PDF 정합과 어긋남. line_ranges 가 셀의 모든 line 을 visible
처리하면 (= 실제 split 영향 안 받은 cell) cell.vertical_align 보존.

검증: cargo test --release 21 그룹 통과, 시각: 사업개요 라벨이 cell 중앙 정렬.
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.

1 participant