Skip to content

hwp3-sample16: paragraph 외곽선(border) 밖으로 본문 내용 돌출 #952

@jangster77

Description

@jangster77

개요

samples/hwp3-sample16.hwpsamples/3-11월_실전_통합_2022.hwp 등 다수 sample 에서 시각 회귀 3건 확인. 본 issue 안에서 통합 해결.

회귀 항목

Issue 1 — 페이지 외곽선 paper/body 잘못 분류 (HWP3/HWP5/HWPX)

증상: samples/hwp3-sample16-hwp5.hwp 페이지 17 외곽선이 body 안쪽으로 작아짐 (task877 baseline 시점 paper-based 정상 표시).

Bisect 결과:

Commit 외곽선
local/task877 tip (8514e68a) paper-based ✓
4bb11289 fix: 쪽테두리 종이기준/본문기준 bit 해석 반전 (#920) body-based ⚠️
local/task952 (현재) body-based ⚠️

Root cause: 4bb11289paper_based = (attr & 0x01) == 0 비트 반전이 잘못된 해석.

Spec 정답 — rhwp 자체의 HWPX 파서 (src/parser/hwpx/section.rs:562) 가 spec 갖고 있음:

if text_border.eq_ignore_ascii_case("PAPER") {
    attr |= 0x0000_0001;
}

즉 textBorder="PAPER" → bit 0 = 1.

그러나 실제 sample 다수 분석 결과 — 한컴 viewer 는 attr/textBorder 무관 항상 paper-based outline 렌더:

Sample attr (HWP5) textBorder (HWPX) fillArea (HWPX) 한컴 시각
sample16 (HWP3/HWP5 변환) 0x01 PAPER PAPER paper
시험지 (3-11월) 0x00 CONTENT PAPER paper
다른 한컴 sample 4종 0x01 - - paper

→ bit 0 의 spec 해석 자체가 outline 위치 결정 아님. fillArea="PAPER" 가 outline 위치 결정 가능성 (HWPX 파서가 fillArea="PAPER" 무시함 — _ => 0).

Fix: paper_based = true 강제 (한컴 viewer 실측 정합).

Issue 2 — sample16 page 18 "나. 주요 과업내용" 본문 다음 페이지 밀림

증상: page 18 (HWP3 native page 16) 의 다이어그램 + "나. 주요 과업내용" 후 본문 (○ 통합모델 ... ) 이 다음 페이지로 밀림. 한컴 page 16 은 모두 같은 페이지.

진단: 9e038d2 (Stage 3 v2, 회귀 아님) 에서도 동일 증상 → 장기 paragraph flow 결함. dump-pages 는 page 18 에 pi=395~401 배치되어 있다고 표시하나 SVG emit 누락.

위치: HWP3 TAC big shape (pi=394 다이어그램, h=511px) 다음 paragraph 의 typeset cursor 계산.

Root cause 후보 (typeset.rs):

  • TAC shape 후 vpos 계산이 shape 의 실제 height 를 반영 못 함
  • column 의 used height 가 잘못되어 후속 paragraph 가 다른 column/page 로 분기
  • picture caption ("나. 주요 과업내용") 의 cursor 갱신 영역 결함

Issue 3 — 시험지 page 1 우측 단 문9 vertical 처짐 (HWP5)

증상: samples/3-11월_실전_통합_2022.hwp page 1 우측 단의 문9 가 한컴보다 ~250px 아래.

문제 rhwp y 한컴 y (참조)
문6 103 ~
문7 319 ~
문8 562 ~
문9 1061 ~810 추정

문8→문9 간격 499px (다른 문제 간격 ~250px 대비 2배).

진단: HWP5 format. Issue 2 (HWP3 parser) 와 다른 root cause. HWP5 column 의 vertical layout 또는 endnote/footnote/picture 영향 가능성. 별도 root cause 식별 진행.

진행 상태

  • Issue 1 fix 완료 (paper_based = true)
  • Issue 2 root cause 식별 + fix
  • Issue 3 root cause 식별 + fix
  • 종합 commit + cargo test + PR

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