개요
#942 의 증상 A (HWPX +8 페이지) 의 root cause 확정 후 별도 task 로 분리.
증상 B/C 도 이 +8 drift 의 결과로 보이며, 본 fix 가 들어가면 자연 해소될 가능성 높음.
Root cause (확정)
samples/hwp3-sample16-hwp5.hwpx vs samples/hwp3-sample16-hwp5.hwp 비교 (rhwp ir-diff):
- HWPX 파서가 일부 paragraph (e.g. `` PUA 항목 부호 시작) 에 `lineSegArray` 를 미리 IR 에 emit — `line_segs count = 1` (e.g. `lh=1299 HU, ls=779 HU`)
- HWP5 파서는 같은 paragraph 에 대해 `line_segs count = 0` 으로 두고 typeset 시점 동적 생성
- 두 결과의 height 가 일치하지 않음 → paragraph 당 ~27.7 px 차이 (lh 17.3 + ls 10.4)
- 8 개 paragraph 누적 → +8 페이지 inflate (Stage 7.8 의 `pi=395 cur_h=985.5 vs avail=967.3 (18.2 px overflow)` 와 일치)
영향 paragraph (HWPX sample16-hwp5)
확인된 `` 시작 paragraph: 376, 380, 383, 386, 395, 400, 403, 407, … (총 59 건의 line_segs count 차이)
재현
```bash
./target/release/rhwp ir-diff samples/hwp3-sample16-hwp5.hwpx samples/hwp3-sample16-hwp5.hwp --summary
→ '59건 line_segs count' 가 가장 큰 항목
./target/release/rhwp dump samples/hwp3-sample16-hwp5.hwpx -s 0 -p 395
→ ls[0]: lh=1299, th=1299, bl=1104, ls=779, ...
./target/release/rhwp dump samples/hwp3-sample16-hwp5.hwp -s 0 -p 395
→ ls 없음 (line_segs=0)
Stage 7.8 진단
ls /tmp/hwpx-942/.svg | wc -l # 72
ls /tmp/hwp5-942/.svg | wc -l # 62
한컴 PDF: 64
```
수정 방향 후보
| 후보 |
설명 |
Risk |
| D1: HWPX 파서가 lineSegArray emit 안 함 |
HWP5 처럼 typeset 위임 |
중 (다른 paragraph 의 정합 case 회귀 가능) |
| D2: `format_paragraph` 가 preset LineSeg 무시 |
항상 재계산 |
중 |
| D3: HWPX 파서의 LineSeg 변환 식 보정 |
HWP5 typeset 결과와 일치하도록 |
낮 |
| D4: typeset 이 preset LineSeg 의 height 만 무시 |
LineSeg 위치 유지, height 만 재계산 |
낮-중 |
수행 task 진행 시 후보 식별 + 회귀 테스트 (sample 전체) 필수.
관련
scope
- 1차 검증 파일: `samples/hwp3-sample16-hwp5.hwpx` + `pdf/hwp3-sample16-hwp5-2022.pdf` (64 페이지)
- 영향 모듈: `src/parser/hwpx/` (lineSegArray 변환), `src/renderer/typeset.rs` (format_paragraph LineSeg 활용)
- 회귀 검증: 169 HWPX 샘플 페이지 수 변동 0 필요
개요
#942 의 증상 A (HWPX +8 페이지) 의 root cause 확정 후 별도 task 로 분리.
증상 B/C 도 이 +8 drift 의 결과로 보이며, 본 fix 가 들어가면 자연 해소될 가능성 높음.
Root cause (확정)
samples/hwp3-sample16-hwp5.hwpxvssamples/hwp3-sample16-hwp5.hwp비교 (rhwp ir-diff):영향 paragraph (HWPX sample16-hwp5)
확인된 `` 시작 paragraph: 376, 380, 383, 386, 395, 400, 403, 407, … (총 59 건의 line_segs count 차이)
재현
```bash
./target/release/rhwp ir-diff samples/hwp3-sample16-hwp5.hwpx samples/hwp3-sample16-hwp5.hwp --summary
→ '59건 line_segs count' 가 가장 큰 항목
./target/release/rhwp dump samples/hwp3-sample16-hwp5.hwpx -s 0 -p 395
→ ls[0]: lh=1299, th=1299, bl=1104, ls=779, ...
./target/release/rhwp dump samples/hwp3-sample16-hwp5.hwp -s 0 -p 395
→ ls 없음 (line_segs=0)
Stage 7.8 진단
ls /tmp/hwpx-942/.svg | wc -l # 72
ls /tmp/hwp5-942/.svg | wc -l # 62
한컴 PDF: 64
```
수정 방향 후보
수행 task 진행 시 후보 식별 + 회귀 테스트 (sample 전체) 필수.
관련
scope