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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,8 @@
다음 줄이 쪽 끝을 넘으면 다음 쪽 맨 위에서 시작한다(개체 아래 간격은 그 쪽으로 가져가지 않는다). 개체의 앵커 줄이
다음 쪽으로 넘어가면 개체도 그 줄과 함께 넘어가, 그 줄 위에서 오프셋만큼 아래에 선다. 전에는 앞의 경우를 지원하지
않았고, 뒤의 경우 개체를 다음 쪽 맨 위에, 앵커 줄을 그 아래에 놓았다.
- 쪽 수 추정이 단 간격(`hp:colPr@sameGap`)을 부호 있는 32비트 수로 읽는다. 2³¹ 이상으로 쓰인 값은 음수 간격이고, 한/글은
단이 겹치도록 단 폭을 그만큼 넓힌다. 전에는 아주 큰 간격으로 읽어 단 폭이 거의 없었다.
- 쪽 수 추정이 빈 문단에 홀로 든 위아래 배치 개체(그림·도형) 뒤의 다음 문단을 한/글처럼 놓는다. 개체가
글과 함께 움직이고 겹침을 허용하며 빈 줄의 글자 높이 안에서 시작할 때만 빈 줄이 개체 아래로 내려간다.
그 밖에는 빈 줄이 문단 위에 그대로 있고, 다음 문단은 개체의 아래끝과 빈 줄에 두 문단 간격(앞 문단 아래·다음
Expand Down
2 changes: 2 additions & 0 deletions src/hwpx/layout/pages.py
Original file line number Diff line number Diff line change
Expand Up @@ -1442,6 +1442,8 @@ def _column_layout(settings: Any, text_width: int) -> tuple[int, int, tuple[int,
for size in sizes)
return count, min(widths), widths, 0
gap = int(settings.get("sameGap", 0))
if gap >= 1 << 31: # a signed 32-bit number written unsigned: Hancom takes a negative gap so
gap -= 1 << 32
return count, (text_width - (count - 1) * gap) // count // 4 * 4, (), gap


Expand Down
Binary file modified tests/fixtures/hancom_saved/columns_gap_wrapped.hwpx
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 @@ -240,6 +240,9 @@
"pages_line_ends_1_above_page_foot": 2, # and one ending 1 above it
"pages_line_ends_100_above_page_foot": 2, # and 100 above it: no room is kept below lines
"pages_keep_keep_with_next": 3, # keep with next
# Two columns whose gap is written 2**32 - 2**15: a signed 32-bit number, -32768, so the columns overlap and
# each is (42520 + 32768) / 2 wide, as Hancom lays them out.
"columns_gap_wrapped": 1,
"pages_columns_2_break": 4, # two columns and a column break
# Columns changing inside the section (10 pt lines spaced 160%): three lines in one column, a paragraph
# starting two columns (gap 1200) and the lines after it, then one starting one column and three lines.
Expand Down
Loading