Task #402 inline TAC 그림 페이지네이션 + #404 heading-orphan 보정#408
Closed
planet6897 wants to merge 14 commits into
Closed
Task #402 inline TAC 그림 페이지네이션 + #404 heading-orphan 보정#408planet6897 wants to merge 14 commits into
planet6897 wants to merge 14 commits into
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 (분할로 인한 정상 증가)
기존 task_404.md(영문 줄바꿈 역공학 미실행 초안)는 archives로 이동. 신규 task_404 = orphan heading vpos 기반 분할 추가.
TypesetState.page_first_vpos 필드 추가 + typeset_section 메인 루프에 진단 로그 삽입. 타겟 샘플 분석 결과: - pi=83 가설 확정: vpos overflow=886 HU, curr_h=906.6/avail=933.5 (cumulative fit) + next pi=84 표 190.9px fit 불가 → orphan - False positive 41건 중 40건은 wrap-around 페이지에서 vpos↔px 비율 어긋남 (페이지 8 pi=57 TAC 그림 + 빈 문단 19개) Stage 2 전략 재정의: heading-orphan 패턴 (current fit + next block 못 fit + vpos overflow + single column) 4조건 모두 만족 시 push. 단순 vpos overflow check은 다수 회귀 위험.
typeset_section 메인 루프에 vpos 기반 보정 추가. 5개 조건 AND (current fits + vpos overflow + next substantial + next doesn't fit + single column non-wrap) 으로 false positive 차단. 설계 변경: page_top_vpos 는 TypesetState 필드 대신 current_items 첫 item 의 para_index 로 즉시 계산 (typeset_paragraph 내부 페이지 flush 와 동기 안 되는 문제 회피). 검증: - pi=83 heading 이 페이지 9 → 페이지 10 으로 이동 (pi=84/85 표와 함께 배치) - 1073개 테스트 모두 통과 - 10개 샘플 LAYOUT_OVERFLOW: 회귀 없음 + 타겟 -15, kps-ai -1 개선
SVG 시각 검증으로 pi=83 "(7) 다수 기부자 현황" 이 페이지 10 첫 본문 라인으로 이동하고 후속 표 pi=84/85 와 함께 배치됨을 확인. 검증 기준 충족: 1. 페이지 9 SVG 에 pi=83 heading 미표시 2. 페이지 10 SVG 가 pi=83 + pi=84/85 표 함께 표시 3. 회귀 테스트 1073개 모두 통과 4. 10개 샘플 LAYOUT_OVERFLOW 회귀 없음 + 2개 샘플 개선 closes edwardkim#404
6 tasks
edwardkim
added a commit
that referenced
this pull request
Apr 28, 2026
Owner
|
@planet6897 님 PR 감사드립니다. 메인테이너가 cherry-pick 으로 devel 에 적용 완료했습니다. 처리본 PR 의 14 commits 분석:
작성자 attribution 보존 4 commits:
devel 머지 commit: 검증
시각 판정 (작업지시자 직접)한컴 hwpx + PDF 정답지 vs rhwp 출력 비교:
메모리 원칙 부합 — 5 조건 AND triggervpos overflow 41건 중 1건만 진짜 orphan 인 정황에서, 단순 vpos check 가 아닌 5 조건 AND (current fit + vpos overflow + next substantial + next 못 fit + single column non-wrap) 로 false positive 차단한 점이 본 저장소의 메모리 이슈 #404 도 함께 close 됩니다. 감사합니다. 비범위 (별도 후속)
|
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
(
samples/2025년 기부·답례품 보고서 양식.hwpx7쪽 파이차트)(
samples/2025년 기부·답례품 보고서 양식.hwpx9쪽 pi=83 "(7) 다수 기부자 현황")#402: inline TAC 그림 페이지네이션 수정
원인
layout.rs::layout_shape_item이 표 옆에 그림이 있을 때para_start_y를 갱신하지 않아 그림 y 가 표 영역과 겹침typeset.rs::typeset_table_paragraph가 선행 TAC 그림의 line_seglh를current_height에 누적하지 않아 페이지 초과 시 분할 미발동수정
layout.rs::layout_shape_item: 선행 TAC 컨트롤 존재 시para_start_y = y_offset로 갱신typeset.rs::typeset_table_paragraph: 선행 TAC 그림의lh를current_height에 누적 + 페이지 초과 시 분할#404: heading-orphan 보정 (vpos 기반)
원인
수정 (
typeset.rs::typeset_section메인 루프)heading-orphan trigger 5 조건 AND:
!current_items.is_empty()wrap_around_cs < 0 && col_count == 1current_height + para_h_px <= availvpos_end > page_bottom_vpos + 283next_h_px > 30 && current+para+next > avail발동 시
st.advance_column_or_new_page()로 push.설계 노트
page_top_vpos는TypesetState필드 추적 대신current_items첫 item 의para_index로 매 iteration 즉시 계산. (typeset_paragraph 내부 페이지 flush 와필드 setter 가 동기 안 되는 문제 회피.)
False Positive 차단
Stage 1 진단 로그에서 vpos overflow paragraph 41건 중 1건만 진짜 orphan.
조건 E (
next_substantial && next_doesnt_fit) 가 핵심 필터:Test plan
cargo build --release통과cargo test --release— 1073 테스트 통과 (1023 lib + 6 svg_snapshot + 14 paragraphs + 25 tables + 2 gugeo + 1 tab_cross_run + 그 외 통합)samples/2025년 기부·답례품 보고서 양식.hwpx:Commits
0054a27Task 동일 문단 내 두 번째 line의 inline 그림이 첫 line과 겹침 (페이지 분할 누락) #402 Stage 1: 진단 로깅으로 가설 확정38bea10Task 동일 문단 내 두 번째 line의 inline 그림이 첫 line과 겹침 (페이지 분할 누락) #402 Stage 2: inline TAC 그림 페이지네이션 수정f710732Task 동일 문단 내 두 번째 line의 inline 그림이 첫 line과 겹침 (페이지 분할 누락) #402 Stage 3: 회귀 검증 통과 + 최종 보고서36a457cTask 헤딩 문단이 후속 콘텐츠와 다른 페이지로 분리됨 (orphan heading) #404: 수행계획서 + 구현계획서 작성25b27b2Task 헤딩 문단이 후속 콘텐츠와 다른 페이지로 분리됨 (orphan heading) #404 Stage 1: vpos 진단 + 가설 확정42b5136Task 헤딩 문단이 후속 콘텐츠와 다른 페이지로 분리됨 (orphan heading) #404 Stage 2: heading-orphan trigger 구현3a1c9d6Task 헤딩 문단이 후속 콘텐츠와 다른 페이지로 분리됨 (orphan heading) #404 Stage 3: 회귀 검증 통과 + 최종 보고서c43f6c8samples: 2025년 기부·답례품 PDF 갱신비범위 (별도 후속)
높이 트래킹 압축 + 빈 문단 line-height 압축 누적이 원인. 사전 존재 이슈로
Task 동일 문단 내 두 번째 line의 inline 그림이 첫 line과 겹침 (페이지 분할 누락) #402/헤딩 문단이 후속 콘텐츠와 다른 페이지로 분리됨 (orphan heading) #404 회귀 아님. 별도 이슈로 등록 예정.
engine.rs::paginate_with_measured(fallback 경로) — 동일 보정 미적용. 별도후속.
closes #402, closes #404