Skip to content

fix(layout): follow objects set as characters in a line reaching a band - #368

Open
airmang wants to merge 2 commits into
mainfrom
fix/page-estimate-objects-as-characters-beside-bands
Open

airmang wants to merge 2 commits into
mainfrom
fix/page-estimate-objects-as-characters-beside-bands

Conversation

@airmang

@airmang airmang commented Oct 1, 2026 •

Copy link
Copy Markdown
Owner

바뀐 점

쪽 수 추정(실험, estimate_pages)이 개체의 띠에 닿는 줄에 글자처럼 둔 개체가 있을 때를 한/글처럼 따른다.

  • 위아래 개체의 띠(앞 문단에서 아래로 띄운 위아래 개체가 아래 문단 줄을 밀어내는 띠)
    • 전에는 그 띠에 닿는 문단에 글자처럼 둔 개체가 있으면 지원 밖(a page break or another object beside a square-wrapped object)이었다.
    • 한/글은 그런 줄도 글 줄처럼 띠 아래로 보낸다. 개체가 글보다 낮으면 줄 높이는 글 높이 그대로다.
    • 이제 문단 기준으로 둔 개체(글자처럼 두지 않은 것)가 있을 때만 전처럼 지원 밖이다.
  • 어울림(SQUARE) 개체 곁 띠
    • 글자처럼 둔 개체 하나만 든 빈 문단은 전에는 지원 밖(an object beside a square-wrapped object)이었다. 한/글은 개체가 곁 자리보다 넓으면 그 줄을 띠 아래(개체 아랫선)로 보내 전체 폭에 두고, 좁으면 곁에 둔다(_room_beside).
    • 글 사이에 글자처럼 둔 개체가 든 문단은 띠가 없는 것처럼 줄을 셌다(곁 자리보다 넓은 표가 든 한 판은 한/글 2쪽을 1쪽으로).
      • 이제 띠 안에서 시작하는 줄은 곁 자리 폭으로 나눈다.
      • 곁 자리보다 넓은 개체가 든 첫 줄은 띠 아래로 보내 전체 폭에 두고, 곁의 남은 자리는 비운다. 그 앞 줄의 간격이 그만큼 늘거나, 첫 줄이면 문단이 그만큼 아래에서 시작한다.
      • 캐시가 없으면 _banded_object_lines가 이렇게 줄을 나눈다. 처음에는 모든 줄을 좁다고 보고, 좁은 줄이 정해질 때까지 다시 나눈다. 캐시가 있으면 캐시의 줄 위치를 따른다(_cached_jumps).
      • 글이 개체 양쪽에 놓이는 띠는 지원 밖(objects set as characters among text beside a square-wrapped object)이다.
  • 변경 로그를 고친다.

테스트

  • tests/test_layout_page_estimate.py에 한/글 저장본 열을 더한다(HANCOM_PAGES).
    • 빈 문단에서 2000 아래로 띄운 위아래 사각형(20000×8000)의 띠에 닿는 다음 문단 넷: 글 한 자, 글과 묶음 개체, 글과 그림, 묶음 개체만(글 없음). 모두 띠 아래 전체 폭이다.
    • 빈 문단의 왼쪽에 어울림으로 둔 그림(41631×27112, 곁 자리 6557) 다음 문단 여섯
      • 글자처럼 둔 표만: 47058 폭은 그림 아래 전체 폭, 5000 폭은 곁에
      • 글 사이의 표·그림: 47058 폭 표(2쪽)와 그림(47058×5000)은 그 줄이 그림 아래로, 5000 폭 표는 곁에, 그림이 5000 높이로 짧으면 표 줄이 띠 뒤에 그대로
    • 캐시가 있을 때와 없을 때 모두 줄 위치와 쪽 수가 한/글과 같다.
  • 그림을 단 왼쪽에서 3000 옮겨 글이 양쪽에 놓이게 한 판이 지원 밖인지 확인한다.
  • 고치기 전 코드에서는 새 테스트 스물하나 가운데 열일곱이 실패한다. 글 한 자 판, 그리고 캐시가 있는 5000 폭 표 판과 짧은 띠 판은 전에도 맞는다.

🤖 Generated with Claude Code

airmang and others added 2 commits October 2, 2026 07:20
A line reaching a top-and-bottom object's band was refused when it held objects set as characters; Hancom moves it below the band like a line of text (an object no taller than the text not making it taller). An empty paragraph holding one object set as a character beside a square-wrapped object's band was refused; Hancom sets its line below the band, the whole width, when the object is wider than the room beside it, and beside it otherwise.

Text with objects set as characters beside a square-wrapped object's band was laid out as if the band were not there. Hancom moves the line holding one wider than the room beside the object below the object, leaving the rest of the room empty; that is not followed yet, so such a paragraph is now refused instead.

Seven Hancom-saved documents: a rectangle's band reached by a line holding a group, a picture, or a group alone, and by text; a picture's band beside a wide and a narrow table set as a character alone, and beside text holding such a table.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…wrapped object

Text with objects set as characters beside a square-wrapped object's band, refused in the commit before, is now laid out as Hancom does: a line whose top is in the band is as wide as the room beside the object, and the first line holding an object wider than that room goes below the band, the whole width, leaving the rest of the room empty (the line before is spaced that much more, or the paragraph's first line starts that much lower). Without a layout cache _banded_object_lines breaks the lines so, every line taken as narrow at first until the narrow ones settle; with one, the cache's own positions are followed (_cached_jumps). Text on both sides of the object is still refused.

Three more Hancom-saved documents: a narrow table and a picture among the text, and a table after a short band; the document of a wide table among text, refused before, is now a HANCOM_PAGES entry.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@airmang

airmang commented Oct 2, 2026

Copy link
Copy Markdown
Owner Author

커밋 8ac3853e을 더했습니다. 앞 커밋에서 지원 밖으로 돌렸던 경우, 곧 어울림 개체 곁 띠에서 글 사이에 글자처럼 둔 개체가 든 문단을 이제 한/글처럼 따릅니다.

  • 띠 안에서 시작하는 줄은 곁 자리 폭으로 나눕니다.
  • 곁 자리보다 넓은 개체가 든 첫 줄은 띠 아래 전체 폭으로 보내고, 곁의 남은 자리는 비웁니다.
  • 캐시가 있으면 캐시의 줄 위치를 따릅니다.
  • 글이 개체 양쪽에 놓이는 띠는 여전히 지원 밖입니다.

한/글 저장본 셋을 더 넣었고, 지원 밖을 확인하던 저장본은 이제 HANCOM_PAGES 항목입니다. 본문을 고쳤습니다. 전체 테스트와 게이트를 다시 통과했습니다.

This branch has not been deployed

No deployments
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