Skip to content

HWP3/HWP5/HWPX sample16 페이지 수 차이 — paragraph height 누적 차이 (64 vs 67 vs 69) #998

@jangster77

Description

@jangster77

개요

`hwp3-sample16` 의 3 변종 + HWPX 자동보정 결과의 페이지 수 차이.

변종 페이지 수 비고
`samples/hwp3-sample16.hwp` (HWP3) 64 reference (한컴 viewer 정합)
`samples/hwp3-sample16-hwp5.hwp` (HWP5) 67 (+3) PR #997 (G4 word wrap) 적용 후
`samples/hwp3-sample16-hwp5.hwpx` (HWPX) (별도 측정 필요) PR #989 (D6 line_spacing) 영향
HWPX studio 자동보정 후 69 (+5) "HWPX 비표준 감지" 자동 보정 옵션

→ 페이지 수 차이가 다른 root cause 임. PR #994 의 시각 겹침 fix 와 별개.

추정 root cause

Paragraph height 누적 차이

  • HWP3: 64 페이지 (한컴 viewer 정합)
  • HWP5: G4 word wrap 으로 paragraph 가 multi-line 으로 분할 → 페이지당 수용량 감소 → +3 페이지
  • HWPX 자동보정: linesegArray 채우기 후 다시 +2 페이지 → 총 69

추정 원인:

  1. CHARS_PER_LINE 휴리스틱 (35) 이 너무 conservative — 한컴은 더 많은 chars/line 수용
  2. paragraph margin / line_spacing 미세 차이 — paragraph 별로 +1 line wrap 발생
  3. HWPX linesegArray preset 값 — Hancom converter 가 다른 line break 가정

재현

```bash
./target/release/rhwp export-svg samples/hwp3-sample16.hwp -o /tmp/h3/ # 64 페이지
./target/release/rhwp export-svg samples/hwp3-sample16-hwp5.hwp -o /tmp/h5/ # 67 페이지 (PR #997 후)
./target/release/rhwp export-svg samples/hwp3-sample16-hwp5.hwpx -o /tmp/hwpx/ # ? 페이지
```

scope

  • 1차 검증 파일: 위 3 변종
  • 영향 모듈: `src/renderer/composer.rs` (compose_lines fallback) + `src/renderer/typeset.rs` (paragraph height 계산)
  • 회귀 검증: 240 sample 페이지 수 + 시각

수정 방향 후보

후보 설명 Risk
H1 CHARS_PER_LINE 휴리스틱 → 동적 (font_size + body_width 기반)
H2 compose_paragraph 진입 시 reflow_line_segs 호출 (정밀 word wrap) 중-높
H3 typeset 의 paragraph height 계산 정합

관련

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