fix: HWPX preset lineSegArray line_spacing double-count 해소 — sample16-hwp5 +1 페이지 감소 (closes #969, partial #942)#989
Closed
jangster77 wants to merge 2 commits into
Closed
Conversation
…t 해소 (partial) format_paragraph 의 composed branch 에서 ParaShape line_spacing_type (Percent/Fixed/SpaceOnly/Minimum) 재계산이 발동할 때 preset LineSeg 의 line_spacing 을 별도 가산하던 double-count 버그 해소. Root cause: HWPX 파서가 <hp:linesegarray> 의 vertsize/spacing 을 IR LineSeg 로 emit (lh=1299 HU, ls=779 HU = 합 160% of 13pt font). composer 가 ComposedLine 으로 복사 → format_paragraph 가 `raw_lh < max_fs` 판정 → lh = max_fs * 1.6 = 27.7 px 로 재계산 (이미 160% 포함) → 그러나 preset ls = 10.4 px 별도 가산 → 38.1 px / line (= 220% double-count). Fix: 재계산이 발동했을 때 (recompute_lh = true) line_spacing = 0 으로 처리. HWP5 (preset 없음, ls=0) 와 동일 동작 정합. 효과: - HWPX sample16-hwp5: 72 → 71 페이지 (-1) - HWP5/HWP3 변종: 변동 없음 - 240 샘플 회귀: 1 건 (hwpx-02.hwpx 6→5, side effect) - cargo test --release 전체 통과 잔존: +8 페이지 inflate 의 1/8 해소. 잔존 +7 페이지는 typeset_paragraph page break / table path / wrap_around 영역 — 별도 edwardkim#988 분리. 부모 edwardkim#942 의 증상 B/C 는 D6 만으로 해소 안 됨 (drift 해소 필요). closes edwardkim#969 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This was referenced May 18, 2026
edwardkim
pushed a commit
that referenced
this pull request
May 19, 2026
- cherry-pick 631cf97 검증: test 1487 passed, clippy 0, fmt 0, WASM ok - sample16-hwp5 72→71, hwpx-02 6→5 페이지 수 정확 - 시각 판정 통과, HWPX preset 한정 격리 (HWP5 무영향) Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
edwardkim
pushed a commit
that referenced
this pull request
May 19, 2026
…ine_spacing double-count 해소 외부 기여 (jangster77). cherry-pick + 검증 + 시각 판정 통과. - recompute_lh 시 line_spacing 별도 가산 차단 (HWPX preset double-count) - sample16-hwp5 72→71, hwpx-02 6→5 (side effect) - HWPX preset 한정 격리, HWP5 무영향 - test 1487 passed, clippy 0, fmt 0, WASM ok, 골든 svg 변동 없음 - 잔존 +7 페이지는 #988 분리 검토: mydocs/pr/archives/pr_989_review.md / 보고: pr_989_report.md Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Owner
|
cherry-pick 으로 origin/devel 반영 완료 (merge 09b1bdf). 검증: cargo test 1487 passed, clippy 0, fmt 0, WASM 빌드 성공. 보고: mydocs/pr/archives/pr_989_report.md |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
<hp:linesegarray>preset 이 ParaShapeline=160/Percent와 결합될 때format_paragraph의 재계산 분기에서line_spacing이 이중계산되던 버그 해소samples/hwp3-sample16-hwp5.hwpx: 72 → 71 페이지 (-1)Root cause
HWPX 파서가 XML
<hp:linesegarray>의vertsize=1299 HU(= 13pt font),spacing=779 HU(= 60% extra) 를 IR LineSeg 로 emit (합 = 160% of font).format_paragraph의 composed branch (typeset.rs:~1190):raw_lh = composer.line_height = 17.32 px(= 1299 HU)max_fs = 17.33 px(CharShape font_size = 13pt)raw_lh < max_fs판정 (1 HU 미만 차이) → recompute 진입lh = max_fs * 1.6 = 27.7 px(= 160% — 이미 ls 의 60% 흡수)line_spacing = 10.4 px별도 가산 → 합 38.1 px / line (= 220% double-count)HWP5 (preset 없음) 는 composer 가
line_spacing=0으로 두므로 double-count 없음 → 일관성 깨짐.Fix
src/renderer/typeset.rs — composed branch:
Verification
cargo test --release전체 통과 (lib 1288 + integration svg_snapshot 8 + tab_cross_run 1, exit 0)cargo fmt --check통과 (rustfmt policy 정합)Residual + 후속
D6 는 +8 페이지 inflate 의 1/8 해소 (1 페이지). 잔존 +7 페이지는 format_paragraph 영역 밖:
→ 별도 #988 로 분리.
부모 #942 의 증상 B/C (z-order, 다이어그램 분리) 는 #988 해소 시 자연 회복 기대.
Test plan
cargo test --release통과 확인cargo fmt --check통과 확인samples/hwp3-sample16-hwp5.hwpx71 페이지 확인🤖 Generated with Claude Code