Skip to content

fix(layout): keep the cached lines of a paragraph of an object and spaces - #391

Merged
airmang merged 1 commit into
mainfrom
fix/page-estimate-cached-lines-of-an-object-and-spaces
Oct 2, 2026
Merged

airmang merged 1 commit into
mainfrom
fix/page-estimate-cached-lines-of-an-object-and-spaces

Conversation

@airmang

@airmang airmang commented Oct 2, 2026

Copy link
Copy Markdown
Owner

바뀐 점

쪽 수 추정(실험, estimate_pages)이 글자처럼 둔 개체 하나와 공백·줄 바꿈만 있는 문단을, 줄 캐시가 유효해도 FormFit 줄 나눔(_Measure.spread_lines)으로 다시 나누던 것을 고친다.

  • 다른 문단은 유효한 캐시가 있으면 그 줄(한/글이 파일을 열 때 쓰는 줄)을 그대로 쓴다. fix(layout): lay spaces after an object set as a character out as Hancom does #380 뒤로 이 문단만 캐시보다 FormFit을 앞세웠다.
    • FormFit이 캐시와 다르게 나누면, 캐시가 있어도 줄 수와 행 높이가 한/글과 달라졌다.
  • 이제 spread_lines(..., caches=True)는 문단에 유효한 캐시가 있으면 그 줄을 돌려준다(두 줄 이상일 때). 한 줄이면 전처럼 개체 높이의 한 줄이다. FormFit은 캐시가 없을 때만 나눈다.
    • 본문 문단(_paragraph), 표 칸의 줄 쌓기(_Measure.stack)와 줄별 높이(_Measure.stack_lines)가 모두 그렇게 부른다.
  • 변경 로그의 fix(layout): lay spaces after an object set as a character out as Hancom does #380 항목에 한 줄을 더한다.

테스트

  • tests/test_layout_page_estimate.py에 test_a_paragraph_of_an_object_and_spaces_keeps_its_cached_lines를 더한다. 한/글 저장본 둘에서 글자처럼 둔 표의 폭만 바꾼다. 캐시는 그대로라서, 캐시와 FormFit이 서로 다른 줄 수를 낸다.
    • 본문에서 표 뒤에 공백 셋이 한 줄에 든 저장본. 표를 1800 넓히면 FormFit은 셋째 공백을 다음 줄로 넘긴다.
    • 표 칸에서 같은 문단이 두 줄인 저장본. 안쪽 표를 2000 좁히면 FormFit은 모두 한 줄에 넣는다.
    • 두 경우 모두 추정이 캐시의 줄대로 한/글의 본문 줄 자리와 같아야 한다.
  • 고치기 전 코드에서는 둘 다 실패한다.

🤖 Generated with Claude Code

…aces

A paragraph holding one object set as a character and, besides it, only
spaces or line breaks was broken into lines by FormFit even when it had a
valid layout cache, in the body and in table cells. It now keeps the
cache's lines, as any other paragraph does and as Hancom does when it
opens the file; FormFit breaks it only without a cache.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@airmang
airmang merged commit 290526d into main Oct 2, 2026
13 checks passed
@airmang
airmang deleted the fix/page-estimate-cached-lines-of-an-object-and-spaces branch October 2, 2026 19:03
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