Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,9 @@
- 쪽 수 추정이 글 뒤에 둔 어울림(`textWrap="SQUARE"`) 개체의 자리가 문단 둘째 줄 이후에 오는 경우도 따른다. 한/글처럼
문단을 단 폭 그대로 나눴을 때 그 자리가 든 줄을 찾고, 개체를 그 줄 위에서부터 놓는다. 그 앞 줄은 단 폭 그대로이고,
그 줄부터 개체 곁으로 좁아진다. 전에는 첫 줄에 드는 경우만 따르고 나머지는 지원하지 않았다.
- 위의 어울림 개체 자리가 앞 줄을 꼭 채운 바로 뒤(다음 줄의 시작)에 오면, 한/글처럼 그 글이 끝나는 앞 줄에 든 것으로 센다.
예를 들어 첫 줄을 꼭 채운 글 뒤의 개체는 문단 위에서부터 놓인다. 전에는 줄 배치 정보가 없는 문서에서 다음 줄에 든
것으로 세어, 개체와 그 곁 줄이 한 줄 아래로 내려갔다.

## [6.8.0] - 2026-10-06

Expand Down
5 changes: 3 additions & 2 deletions src/hwpx/layout/pages.py
Original file line number Diff line number Diff line change
Expand Up @@ -2412,7 +2412,8 @@ def _square_object(objects: list[Any], runs: list[Any], column: int) -> Any:

def _square_anchor_line(measure: _Measure, page: _Page, paragraph: Any, runs: list[Any], obj: Any) -> int:
"""The line *obj*'s control falls on, the paragraph laid out the column's whole width (FormFit's lines,
the object taking no room in them): Hancom places a square-wrapped object from that line's top."""
the object taking no room in them): Hancom places a square-wrapped object from that line's top. A control
right where a line starts, the line before full, falls on that line before, where its text ends."""

place = 0
for child in (child for run in runs for child in run):
Expand All @@ -2424,7 +2425,7 @@ def _square_anchor_line(measure: _Measure, page: _Page, paragraph: Any, runs: li
style = measure.style(paragraph.get("paraPrIDRef"), refs, paragraph)
shape = measure.shape(paragraph.get("paraPrIDRef"))
starts = measure.line_starts(_run_text(runs), _line_widths(shape, page.column_width, style), size, style)
return sum(1 for start in starts[1:] if start <= place)
return sum(1 for start in starts[1:] if start < place)


def _square_sides(obj: Any, page: _Page) -> tuple[int, int]:
Expand Down
Binary file not shown.
Binary file not shown.
3 changes: 3 additions & 0 deletions tests/test_layout_page_estimate.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,9 @@
"pages_square_table_after_text_on_the_second_line": 1, # after 60 characters, on the second line laid
# out the whole width: from that line's top (9600),
# the first line the whole width
"pages_square_table_after_a_full_first_line": 1, # after 43, which fill the first line: on that line, where
# its text ends, so from the paragraph's top
"pages_square_table_after_two_full_lines": 1, # after 86: on the second line, from its top
"pages_picture_1319_down_moved_to_the_next_page": 3, # a picture 8000 tall placed top and bottom 1319
# below its empty paragraph's line: alone at the
# next page's top, the line staying, the lines
Expand Down
Loading