Repository navigation
Conversation
add_picture wrote any align it was given into hp:pos@horzAlign ("BOGUS",
" RIGHT ", "TOP"), which Hancom reads as LEFT; a non-string failed only after
the image and its paragraph were added. The alignment is now checked first,
in any case, against the schema's horizontal alignments, and anything else is
refused with shape-position-frame before anything is stored.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A negative width or height of a rectangle, ellipse, arc, picture or equation box, or a negative rectangle corner ratio, was written as given; Hancom reads it as 0. Such values, and sizes of 2**31 or more, are now refused with typed errors before any paragraph, run or image is added (shape-size-value, shape-rect-ratio-value). An equation's base_unit outside 1..2**31-1 raises shape-equation-base-unit-value (a ValueError, as before) before its paragraph is added. HwpxOxmlShape.resize refuses a negative size too, and HwpxOxmlParagraph.add_picture builds the picture before adding its run. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Hancom reads a caption's gap and the gap between columns of the same width as signed 16-bit numbers and a new number as an unsigned one, wrapping anything else (a column gap of 32768 makes the columns overlap; a negative one written as text is read as 0). set_caption's gap outside -32768..32767, a same_gap (or page setup column_gap_mm) outside 0..32767 and a restart number outside 0..65535 are now refused before anything changes (shape-caption-gap-value, page-column-gap-value, page-new-num-value). The caption side check moves to shape_position unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Hancom reads a column's width and gap (hp:colSz) as a share of the text width out of 32768 and lays the column out width * text width / 32768 wide, whatever the shares add up to. column_widths were written as given, so widths in HWP units adding up to the text width came out about 1.3 times as wide and ran off the paper. They are now taken as proportions and written as shares adding up to 32768 (column_shares); widths that already add up to 32768 are written unchanged. Negative, non-int, all-zero or malformed pairs are refused before anything changes (page-column-widths-value). The page estimate takes a column's width as its share of 32768 of the text width. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Hancom draws a table column at least its cells' left and right margins and 283 wide (1303 in a new table), keeps the narrower width written in the cells and saves the table as wide as it draws the columns. A new table now gives each column at least that floor (a nested table without a width in a narrow cell too), and set_column_widths writes a column below its floor at the floor and widens the table by as much. A new table width that is no int in 0 < width < 2**31 is refused before any paragraph, run or border fill is added (table-width-value). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
add_equation's base unit check now raises a typed error, so oxml/paragraph.py raises one untyped error fewer. The census lock records 202 untyped raises (paragraph.py 18), as the ratchet's self-test expects the lock to match the tree. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
new_table_width returns None only when no width is given. Overloads now say so, so the width HwpxOxmlTable.create builds the table with is an int for mypy and pyright. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
# Conflicts: # CHANGELOG.md
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
바뀐 점
새 표와 열 너비 바꾸기가, 한/글이 그리는 것보다 좁은 열을 그대로 쓰던 것을 고친다. 이제 한/글이 그리고 저장하는 폭으로 쓴다. 새 표 폭이 양의 int가 아니면 거부한다.
한/글의 동작
고치기 전
doc.add_table(2, 2, width=0)(또는 음수)은 표 폭과 칸 폭을 0으로 썼다.set_column_widths([0, 1])은 열 0을 0으로 썼다.모두 한/글에서는 더 넓게 그려지고 표 폭이 바뀌어 저장됐다.
코드
oxml/table_sizes.pyCOLUMN_FLOOR_EXTRA(283)와NEW_TABLE_COLUMN_FLOOR(새 표 여백 510 + 510 + 283)를 더한다.new_table_width: 새 표 폭을 적어도 열마다 바닥 폭으로 늘린다. 0 초과 2³¹ 미만의 int가 아니면 거부한다(table-width-value, bool도 거부).set_column_widths: 나눈 열 폭이 그 열 칸들의 바닥(가장 넓은 좌우 여백 + 283)보다 좁으면 바닥으로 쓰고, 표 폭(sz)을 늘어난 합으로 쓴다. 한 열짜리 칸만 바닥을 정한다.HwpxOxmlTable.create,HwpxOxmlParagraph.add_table, 칸의add_table,HwpxDocument.add_tableerrors.py와docs/error-codes.md에 코드를 등록하고, 변경 로그 항목을 더한다.테스트
tests/test_table_column_floor.py를 더하고, 한/글 저장본 여섯을 함께 넣는다.add_table을 모두 본다.set_column_widths([0, 1])이 한/글이 저장한 표 폭(43823)을 쓰는지 시험한다.tests/test_set_column_widths_uniform_split.py: 반올림을 고정하던 폭 13짜리 두 열 표는 이제 바닥 폭으로 늘어난다. 같은 반올림(짝수 쪽, 나머지는 마지막 열)을 바닥 위의 폭 2609로 시험한다.이 PR은 #415, #416, #417, #418 위에 쌓았다. 앞 PR이 병합되면 그 커밋들은 이 PR의 diff에서 빠진다.
🤖 Generated with Claude Code