Skip to content

fix(layout): count objects set as characters in a cell paragraph without a layout cache - #359

Merged
airmang merged 7 commits into
mainfrom
fix/page-estimate-objects-as-characters-in-cells
Oct 1, 2026
Merged

airmang merged 7 commits into
mainfrom
fix/page-estimate-objects-as-characters-in-cells

Conversation

@airmang

@airmang airmang commented Oct 1, 2026

Copy link
Copy Markdown
Owner

바뀐 점

쪽 수 추정(실험, estimate_pages)이 줄 캐시 없는 표 칸 문단에서 글자처럼 둔 개체(그림·도형·수식 등)를 센다.

  • 전에는 칸 문단에 혼자 든 표만 그 높이로 쟀다. 다른 개체는 없는 것처럼 글자만으로 줄을 세어, 그런 칸이 든 행이 한/글보다 낮았다.
  • 한/글은 칸 문단의 글자처럼 둔 개체를 본문에서처럼 줄 안에 둔다.
    • 개체가 든 줄은 개체와 글 가운데 높은 쪽만큼 높다.
    • 줄 간격은 개체 높이가 아니라 글자 크기로 센다. 고정 간격이면 그 간격이다.
    • 개체 둘이 칸 폭에 함께 들어가면 한 줄, 아니면 줄을 나눈다.
  • 이제 _Measure.stack은 개체 하나만 든 칸 문단(_object_alone)을 표 혼자일 때처럼 개체 높이의 한 줄로 센다.
  • 개체가 글 사이에 있거나 여럿이면(_objects_among) marked_lines가 본문과 같은 줄 나누기(_inline_content, _line_metrics)로 줄마다 높이를 낸다.
  • 줄 캐시가 있는 문단은 전처럼 캐시를 따른다.
  • 변경 로그를 고친다.

테스트

  • tests/test_layout_page_estimate.py에 한/글 저장본 열하나를 더한다(HANCOM_PAGES). 모두 흐르는 표 칸의 문단이다.
    • 혼자 든 그림·사각형·수식
    • 2줄 글의 앞·가운데·뒤에 든 그림
    • 한 줄에 들어가는 그림 둘과 들어가지 않는 그림 둘
    • 고정 줄 간격, 글자처럼 둔 바깥 표, 그림 문단 뒤 글 문단
    • 캐시가 있을 때와 없을 때 모두 줄 위치와 쪽 수가 한/글과 같다.
  • 고치기 전 코드에서는 새 테스트 열하나(캐시 없는 판)가 실패한다.

🤖 Generated with Claude Code

airmang and others added 4 commits October 1, 2026 16:36
…out a layout cache

Without line caches a cell paragraph holding a picture, drawing or equation set as a character was measured
as if the object were not there, so the row came out shorter than Hancom's. Such an object alone is now one
line as tall as it, spaced from the text's size, as a table alone already was; objects among the text, or
several of them, take their width and height in the paragraph's lines as in the body.

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

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

airmang commented Oct 1, 2026

Copy link
Copy Markdown
Owner Author

main(9e0d02b, 6.7.0 릴리스)을 합쳤습니다. 릴리스로 [Unreleased] 머리가 [6.7.0]이 되어, 그대로 합치면 이 PR의 변경 로그 항목이 6.7.0 절에 들어갑니다. 그래서 항목을 새 ## [Unreleased] / ### 고침 아래로 옮겼습니다. 코드는 바뀌지 않았습니다.

…ects-as-characters-in-cells

# Conflicts:
#	CHANGELOG.md
#	tests/test_layout_page_estimate.py
@airmang

airmang commented Oct 1, 2026

Copy link
Copy Markdown
Owner Author

main(505bb2f, #356 병합)을 다시 합쳤습니다. 변경 로그는 main의 [Unreleased] / ### 고침 목록에 이 PR 항목만 더했고, 시험 목록(HANCOM_PAGES)은 #356과 자리가 겹쳐 두 묶음을 모두 두었습니다. 코드는 바뀌지 않았고, 쪽 수 추정 테스트와 게이트를 다시 통과했습니다.

…ects-as-characters-in-cells

# Conflicts:
#	CHANGELOG.md
#	tests/test_layout_page_estimate.py
@airmang

airmang commented Oct 1, 2026

Copy link
Copy Markdown
Owner Author

main(e64c194e, #340·#342 병합)을 합쳤습니다(baddc6ab). 충돌은 변경 로그와 시험 목록(HANCOM_PAGES)뿐이었고, 둘 다 양쪽 항목을 모두 두었습니다. pages.py는 충돌 없이 합쳐졌고 이 PR의 변경은 그대로입니다. 쪽 수 추정 테스트와 게이트를 다시 통과했습니다.

@airmang
airmang merged commit f214e9b into main Oct 1, 2026
13 checks passed
@airmang
airmang deleted the fix/page-estimate-objects-as-characters-in-cells branch October 1, 2026 17:07
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