Skip to content

fix(layout): count the shadow of an object set as a character - #424

Open
airmang wants to merge 2 commits into
mainfrom
fix/page-estimate-inline-shadow
Open

airmang wants to merge 2 commits into
mainfrom
fix/page-estimate-inline-shadow

Conversation

@airmang

@airmang airmang commented Oct 6, 2026

Copy link
Copy Markdown
Owner

바뀐 점

쪽 수 추정(실험, estimate_pages)이 글자처럼 둔 도형의 그림자를 줄 높이에 넣는다. 전에는 도형 크기만 세어, 그림자가 있는 도형 뒤의 줄들이 그만큼 위에 놓였다.

한/글의 동작

  • 글자처럼 둔 도형의 줄은 도형 높이에 평행 그림자의 세로 이동을 더한 만큼 높다.
  • 세로 이동은 그림자 종류의 기본 거리 600에 offsetY(아래가 양수)를 더한 값이다.
    • 아래쪽 그림자(PARELLEL_RIGHTBOTTOM, PARELLEL_LEFTBOTTOM)는 offsetY + 600이다. 예: 283이면 883, −283이면 317.
    • 위쪽 그림자(PARELLEL_LEFTTOP, PARELLEL_RIGHTTOP)는 offsetY - 600이다. 예: 283이면 −317(위로 317), 1000이면 400(아래로).
    • 줄 높이는 도형 높이 + |세로 이동|이다. 그림자가 위로 가면 도형이 그만큼 아래에 그려지고 그림자가 원래 자리에 놓인다.
  • 선 굵기는 줄 높이에 더하지 않는다. 굵은 선은 테두리 가운데에 그려진다.
  • 기본 거리 600은 도형 크기, 줄 간격, 선 굵기, 글상자 유무와 상관없다.

코드

layout/pages.py

  • _shadow_drop: 개체의 평행 그림자(hp:shadow)가 위나 아래로 움직이는 거리를 구한다. 그림자가 없거나 다른 종류면 0이다. offsetY가 32비트 밖이면 지원 밖으로 둔다.
  • 글자처럼 둔 개체에만 더한다.
    • 개체만 든 문단의 줄(_object_line)
    • 글 사이 개체의 크기(_object_extent)
    • 떠 있는 개체의 띠는 그대로 둔다.
  • 변경 로그 항목을 더한다.

테스트

tests/test_layout_page_estimate.py의 HANCOM_PAGES에 한/글 저장본 일곱을 더한다. 캐시가 있을 때와 없을 때 모든 줄 위치와 쪽 수를 시험한다.

  • 공통 꼴: 10pt 160% 글 사이에, 30000×5000 사각형을 글자처럼 둔 문단 하나
  • 그림자 없음
  • 오른쪽 아래 283(883 아래), 오른쪽 아래 −283(317 아래, 부호 있는 글로 쓴 꼴)
  • 왼쪽 아래 283(883 아래), 왼쪽 위 283(317 위), 왼쪽 위 1000(400 아래)
  • 굵은 선 283과 오른쪽 아래 283 그림자(883 아래)

고치기 전에는 그림자가 있는 여섯 판이 두 모드에서 틀렸다. 그림자 없는 판은 고치기 전에도 맞다.

🤖 Generated with Claude Code

airmang and others added 2 commits October 6, 2026 13:45
Hancom lays the line of a drawing set as a character out as tall as the
drawing and its parallel shadow's move up or down: offsetY + 600 for a
shadow at the bottom, offsetY - 600 for one at the top (the drawing is
drawn that much lower when the shadow goes up); the width of its line
adds nothing. The page estimate counted the drawing's size alone, so the
lines after such a drawing came too high.

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

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