Skip to content

fix(layout): follow a table offset down from a line at a page end - #346

Merged
airmang merged 4 commits into
mainfrom
fix/page-estimate-offset-table-at-a-page-end
Oct 1, 2026
Merged

airmang merged 4 commits into
mainfrom
fix/page-estimate-offset-table-at-a-page-end

Conversation

@airmang

@airmang airmang commented Sep 30, 2026

Copy link
Copy Markdown
Owner

바뀐 점

쪽 수 추정(실험, estimate_pages)이 글 문단의 첫 줄에서 아래로 띄운 흐르는 위아래 표를 쪽 끝에서도 따른다. 전에는 아래 세 경우 모두 지원 밖(a top-and-bottom table offset down from a line at a page end)이었다.

  • 그 줄이 쪽 바닥 위에 들어가지 않는 경우
    • 줄과 표가 함께 다음 쪽으로 간다. 표는 거기서 줄 윗선부터 띄운 만큼 아래에서 흐른다.
    • _banded()가 _next_frame()으로 줄을 다음 쪽에 두고 나서 띠를 잡는다. 흐르는 표만 든 문단의 _flow()와 같은 모양이다.
  • 줄은 들어가는데 표 윗선이 바닥을 넘는 경우, 행 단위로 옮기는(TABLE) 표의 첫 행이 들어가지 않는 경우
    • 표만 다음 쪽 맨 위에서 시작한다. 이때 띄운 거리는 없다.
    • 문단의 글은 그 줄 아래로 이어지고, 표가 차지하는 쪽에서는 표 아래로 간다.
    • 새 _band_on_next_page()가 표가 차지하는 쪽을 잡아 두고(reserved) 문단의 줄을 놓는다. 흐르는 표가 앵커 다음 쪽에서 시작할 때의 _starts_next_page()와 같은 방식이다.
  • 첫 줄이 아닌 줄에서 띄운 표는 전처럼 지원 밖이다.
  • 모듈 설명과 변경 로그를 고친다.

테스트

tests/test_layout_page_estimate.py

  • 한/글이 저장한 fixture 3개를 HANCOM_PAGES에 더한다. 모두 3행 표를 한 줄짜리 글 문단의 윗선에서 아래로 띄운 것이다.
    • 문단 줄이 바닥을 넘는 것(1517 띄움).
    • 줄은 들어가고 표 윗선이 바닥을 넘는 것(2000 띄움).
    • TABLE 모드에서 두 줄짜리 첫 행이 들어가지 않는 것. 표 뒤 문단의 첫 줄은 그 쪽에 남는다.
  • 캐시가 있을 때와 지웠을 때 모두 쪽 수와 모든 줄의 세로 위치가 한/글과 같다.

고치기 전 코드에서는 새 테스트 6개가 모두 실패한다.

🤖 Generated with Claude Code

airmang and others added 3 commits October 1, 2026 06:15
A table flowing top and bottom, offset down from the first line of a
paragraph of text: when that line does not fit above the page's foot it
goes on to the next page with its table, which flows the offset below it
there; when the line fits but the table's top falls past the foot, or its
first row moved row by row does not fit under it, the table starts at the
next page's top while the paragraph's lines go on under its line, below
the table on the pages it takes. All three were not followed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
# Conflicts:
#	tests/test_layout_page_estimate.py
…set-table-at-a-page-end

# Conflicts:
#	CHANGELOG.md
#	src/hwpx/layout/pages.py
@airmang

airmang commented Oct 1, 2026

Copy link
Copy Markdown
Owner Author

main(e64c194e, #340·#342 병합)을 합쳤습니다(2121326a). 충돌은 두 곳이었습니다.

  • 변경 로그: main의 [Unreleased] / ### 고침 목록에 이 PR 항목을 그대로 두었습니다.
  • pages.py: 이 PR이 더한 _band_on_next_page와 main이 바꾼 _clear_of_paper의 서명(below 인자)이 맞닿았습니다. 둘 다 두었습니다. 새 메서드는 _clear_of_paper를 기본값으로 부르므로 동작은 같습니다.

쪽 수 추정 테스트와 게이트를 다시 통과했습니다.

# Conflicts:
#	tests/test_layout_page_estimate.py
@airmang
airmang merged commit 16ff2ed into main Oct 1, 2026
13 checks passed
@airmang
airmang deleted the fix/page-estimate-offset-table-at-a-page-end branch October 1, 2026 15:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant