fix: 동일 문단 내 두 번째 line의 inline 그림이 첫 line과 겹침 (#402)#406
Closed
planet6897 wants to merge 8 commits into
Closed
Conversation
- row_block_start/end 필드 + compute_row_blocks 헬퍼 - row_block_for / snap_to_block_boundary 메서드 - 신규 단위 테스트 7개 (rowspan 단일/겹침/비인접 + 폴백 + 스냅) 회귀 검증용 샘플 hwpx/pdf 동반 커밋.
- pagination/engine.rs::split_table_rows: pre-loop first_block_h, snap_to_block_boundary, cur/next 블록 단일성 가드 - typeset.rs::paginate_table: 동일 패턴 적용 (실제 SVG 내보내기 경로) - 다중 행 블록이 페이지에 들어가지 않으면 블록 전체를 한 단위로 배치 본 샘플 검증: 1쪽에서 표 분할 사라지고 2쪽에 표 전체 시작. cargo test --lib: 1023 passed.
- cargo test --tests: 1073 passed (lib 1023 + integration 50) - svg_snapshot 골든 6건 통과 (table-text, issue-147/157/267, form-002, deterministic) - cargo build --release 성공 - 본 샘플 외 다른 표 샘플 (table-vpos-01, 표-텍스트) 정상 closes edwardkim#398
같은 paragraph 안에 TAC 컨트롤이 2개 이상 있을 때 두 번째 이후 그림의 pic_y가 paragraph 시작 y로 고정되어 표와 겹침. - pi=51 ci=0 (단독 그림): pic_y=94.49 (정상, 선행 TAC 없음) - pi=57 ci=1 (Table 뒤 그림): pic_y=578.09 (버그, y_offset=919.40 사용해야) 선행 TAC 존재 여부가 핵심 판별 조건임을 확인. Stage 2 구현 방향 확정.
같은 paragraph에 TAC 컨트롤(표/그림/도형) 2개 이상이 서로 다른 line_seg에 배치된 경우, 두 번째 이후 inline 그림이 첫 번째와 같은 y 좌표에 그려져 겹침/오버플로 발생하던 문제 수정. - layout.rs::layout_shape_item: 선행 TAC 컨트롤이 있으면 para_start_y를 진행된 y_offset으로 갱신하여 그림 y 좌표를 표 아래로 정확히 배치. - typeset.rs::typeset_table_paragraph: 선행 TAC 그림의 line_seg 높이를 current_height에 누적하고, 페이지 초과 시 다음 페이지로 분할. 기본 페이지네이션 엔진은 typeset.rs(TypesetEngine). engine.rs는 현재 RHWP_USE_PAGINATOR=1 fallback 경로이므로 typeset.rs만 수정. 회귀 테스트: 1023 passed, 0 failed. 샘플 비교: 7쪽 표 + 파이 차트 겹침 해소, 파이 차트가 8쪽 정상 배치.
closes edwardkim#402 검증 결과: - 7쪽: 표 + 파이 차트 겹침 해소 (PDF 일치) - 8쪽: 파이 차트 정상 배치 - cargo test 1023 passed, 0 failed - 10개 대표 샘플 LAYOUT_OVERFLOW 카운트 회귀 없음 - 페이지 수 27→30 (분할로 인한 정상 증가)
edwardkim
added a commit
that referenced
this pull request
Apr 28, 2026
…pick @planet6897 3 commits)
edwardkim
added a commit
that referenced
this pull request
Apr 28, 2026
Owner
|
@planet6897 님 PR 감사드립니다. 메인테이너가 cherry-pick 으로 devel 에 적용 완료했습니다. 처리본 PR 의 8 commits 중 Task #398 (3 commits) 은 이미 PR #401 v2 cherry-pick 으로 devel 에 흡수되어 있어, Task #402 핵심 3 commits 만 분리 cherry-pick 했습니다 (작성자 attribution 보존):
devel 머지 commit: 검증
시각 판정 (작업지시자 직접)한컴 hwpx + PDF 정답지 vs rhwp 출력 비교:
이슈 #402 도 함께 close 됩니다. 9쪽 orphan heading 분리 등록한 #404 도 PR #408 로 진행 중인 점 확인했습니다 — 후속 검토 진행하겠습니다. 감사합니다. |
This was referenced Apr 28, 2026
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
같은 paragraph(
treat_as_char=true)에 inline 컨트롤 2개 이상이 서로 다른 line_seg에 배치된 경우, 두 번째 이후 그림이 첫 번째와 같은 y 좌표에 그려져 표 위에 겹치고 페이지 영역을 초과하던 문제 수정.샘플:
samples/2025년 기부·답례품 실적 지자체 보고서_양식.hwpx7쪽원인
같은 paragraph에 inline 컨트롤(
treat_as_char=true) 2개가 서로 다른 line_seg(ls[0]=표, ls[1]=그림)에 배치된 구조에서 두 가지 누락:레이아웃의 y 좌표 결정 누락 (
layout.rs::layout_shape_item)pic_y가para_start_y[para_index]단일값에 고정.y_offset은 진행됐지만para_start_y는 paragraph 시작 y에 머무름.페이지네이션의 높이 누적 누락 (
typeset.rs::typeset_table_paragraph)PageItem::Shape로 push만 되고current_height누적 없음.변경 사항
src/renderer/layout.rs::layout_shape_itemcontrol_index보다 앞선 인덱스에 같은 paragraph의 TAC 컨트롤이 존재하면para_start_y를 진행된y_offset으로 갱신. 단순y_offset > existing + 1.0비교만으로는 단일 inline 그림 케이스(FullParagraph + Shape 구조)를 잘못 갱신하므로, 선행 TAC 존재 여부를 추가 조건으로 사용.src/renderer/typeset.rs::typeset_table_paragraph기본 페이지네이션 엔진은
paginate_with_measured(engine.rs)가 아닌TypesetEngine::typeset_section(typeset.rs)임을 진단 로깅으로 확인 (RHWP_USE_PAGINATOR=1일 때만 engine.rs로 fallback).inline TAC 그림이 같은 paragraph에 선행 TAC 컨트롤을 가질 때:
line_segs[prior_tac_count]의line_height + line_spacing을 line 높이로 산출current_height + line_h > available_height + 0.5이면advance_column_or_new_page()호출 → 다음 페이지로 분할PageItem::Shapepush,current_height += line_hTest plan
cargo test --quiet— 1023 passed, 0 failed, 1 ignoredaift,biz_plan,endnote-01,equation-lim,exam_math,exam_kor,footnote-01,group-box,hwp_table_test,field-01)wasm-pack build --target web) 성공, rhwp-studio dev 서버에서 동작 확인알려진 비범위
engine.rs::process_controls(현재 fallback 경로)의 동일 누락은 본 PR 수정 범위 밖. 추후 paginator 사용 시 동일 패치 필요. → 별도 이슈 추적 가능.samples/2025년 기부·답례품 실적 지자체 보고서_양식.hwpx9쪽 하단 헤딩 "(7) 다수 기부자 현황"이 후속 표(10쪽)와 분리되는 orphan heading 문제는 본 수정 전후 모두 동일하게 발생하는 기존 버그. → #404로 분리 등록.cargo clippy에러 2건(commands/table_ops.rs:1007,commands/object_ops.rs:298의panicking_unwrap)은 base 브랜치에 이미 존재하는 기존 문제로 본 PR과 무관 (git stash후 비교 빌드로 확인).관련 문서
mydocs/plans/task_402.mdmydocs/plans/task_402_impl.mdmydocs/working/task_402_stage1.mdmydocs/working/task_402_stage2.mdmydocs/report/task_402_report.md커밋
0054a27Task 동일 문단 내 두 번째 line의 inline 그림이 첫 line과 겹침 (페이지 분할 누락) #402 Stage 1: 진단 로깅으로 가설 확정38bea10Task 동일 문단 내 두 번째 line의 inline 그림이 첫 line과 겹침 (페이지 분할 누락) #402 Stage 2: inline TAC 그림 페이지네이션 수정f710732Task 동일 문단 내 두 번째 line의 inline 그림이 첫 line과 겹침 (페이지 분할 누락) #402 Stage 3: 회귀 검증 통과 + 최종 보고서Closes #402