Skip to content

fix(layout): split a square-wrapped table over the page end as Hancom does - #389

Merged
airmang merged 1 commit into
mainfrom
fix/page-estimate-square-table-split-over-pages
Oct 2, 2026
Merged

airmang merged 1 commit into
mainfrom
fix/page-estimate-square-table-split-over-pages

Conversation

@airmang

@airmang airmang commented Oct 2, 2026

Copy link
Copy Markdown
Owner

바뀐 점

쪽 수 추정(실험, estimate_pages)이 글과 함께 움직이고 나뉠 수 있는 어울림(SQUARE) 표가 본문 바닥을 넘을 때, 줄 캐시가 없으면 지원 밖(a square-wrapped or offset top-and-bottom object past the page foot)으로 두던 것을 고친다.

  • 한/글은 그런 표를 옮기지 않고, 흐르는 표처럼 쪽 끝에서 행 사이나 칸 줄 사이로 나눈다.
    • 표가 걸친 쪽마다 곁 줄은 그 쪽 부분 곁으로 간다.
    • 첫 쪽은 표 위부터 바닥까지다. 그 위 줄(띄운 표의 기준 문단 줄 등)은 전체 폭이다.
    • 표가 쪽을 다 덮으면 그 쪽의 모든 줄이 곁 줄이다.
    • 마지막 쪽은 맨 위부터 표 끝까지이고, 그 아래는 전체 폭이다.
  • 이제 바닥을 넘는 개체를 옮길 때처럼 구역을 한 번 더 놓는다.
    • 표 문단은 표 없이 만들고, 표는 따로 둔다(_spans).
    • 쪽 나누기(_Paginator._span_bands)는 그 문단을 놓을 때 표를 흐르는 표처럼 흘려(_flow_table) 걸친 쪽을 구하고, 쪽마다 표 부분의 띠를 둔다.
    • 띠에 닿는 줄은 띠 곁에서 다시 나눈다(_at_band).
  • 한 쪽에 띠가 둘일 수 있다(앞 표의 끝과 그 아래 다음 표의 시작). 쪽마다 띠를 여럿 두고, 문단은 처음 만나는 띠 곁에서 나눈다. 한 문단이 두 띠에 걸치면 지원 밖이다.
  • 글 없는 줄이 띠 위에 있으면 두 조각으로 세지 않는다(띠에 닿을 때만).
  • 모듈 설명과 변경 로그를 고친다.

테스트

  • tests/test_layout_page_estimate.py의 HANCOM_PAGES에 한/글 저장본 여섯을 더한다(캐시 있음·없음). 표는 2열이고 단 왼쪽에 두었다. 10pt 글에 줄 간격 160%다.
    • 폭 15000 표가 4줄 행의 줄 사이에서 나뉜다(3쪽).
    • 세 행을 합친 칸에서 나뉜다(3쪽).
    • 25행 표가 세 쪽에 걸친다. 가운데 쪽은 모든 줄이 곁 줄이다.
    • 문단에서 1548 아래로 띄운 표: 기준 문단 줄은 표 위라서 전체 폭이다(3쪽).
    • 가운데 둔 표: 곁 줄이 두 조각이다(3쪽).
    • 폭 45626 표(곁 2562): 곁에 한 줄 두 글자씩 들어간다(2쪽).
  • 기존 시험 test_a_square_object_past_the_page_foot_goes_on_at_the_next_page
    • 어울림 표 저장본(pages_table_square_past_the_page_foot)도 이제 캐시 없이 한/글과 같다. 그래서 매개변수 followed를 없앴다.
  • 고치기 전 코드에서는 새 저장본 여섯의 캐시 없는 시험과 기존 표 저장본의 캐시 없는 기대가 실패한다.

🤖 Generated with Claude Code

… does

A table wrapped square, flowing with the text and allowed to split, whose
band passed the body's foot was followed only through the layout caches.
Hancom splits it over the page end as a flowing table, between rows or
cell lines, and the lines on each page it reaches go beside its part
there: on its first page from its top to the foot, on a page it fills all
of them, on its last page from the top down to its end. Without the
caches the section is now laid out again with the table flowing as a
flowing table and its bands set page by page, the lines reaching them
broken again beside them. A page may hold two such bands (one table's end
and another's start); a paragraph reaching both is not followed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@airmang
airmang merged commit 826db70 into main Oct 2, 2026
13 checks passed
@airmang
airmang deleted the fix/page-estimate-square-table-split-over-pages branch October 2, 2026 17:45
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