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>
Hancom starts new columns only from a column definition ahead of the paragraph's text (its own documents give it the paragraph's first run, after a section's settings); one behind the text starts a new area but not its columns, so the text after it stays at the text width. add_column_definition (doc.page.set_columns with a paragraph) appended its run after the paragraph's text; it now goes ahead of it. 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>
A paragraph holding a column definition after the section's first starts a new area of columns in Hancom: on the page where the one before ends, 1134 (4 mm) below its lowest line whatever the spacing, or at the next page's top; its lines are counted from the area's top there. An area followed by another has the columns of its last page balanced by height, as short as they can be with every line still on that page, and a column break in balanced columns starts such an area too. A definition behind its paragraph's text starts the area but not its columns. The page estimate reported such sections as unsupported; it now lays them out area by area (footnotes and objects placed on the page or the paper in them stay unsupported). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A paragraph holding two column definitions started two areas, one of them empty; the first definition now starts the paragraph's area. 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>
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.
바뀐 점
쪽 수 추정(실험,
estimate_pages)이 구역 안에서 단이 바뀌는 문서를 지원 밖(the columns change inside the section)으로 두던 것을 고친다. 이제 한/글처럼 단 영역별로 놓는다.한/글의 동작
hp:lineseg@vertpos)는 그 쪽에서 영역 위쪽부터 센다. 영역이 다음 쪽으로 넘어가면 그 쪽 본문 위부터 센다.NEWSPAPER)도 그렇다.BALANCED_NEWSPAPER)의 단 나누기는 영역 안에 새 균형 블록을 연다. 새 블록은 앞 블록 아래 1134에서 시작하고 줄 위치를 0부터 센다.코드
layout/pages.py_column_areas: 구역 최상위 문단에서 단 정의(구역 설정 런의 것 빼고)와 균형 다단의 단 나누기를 찾는다. 글 뒤의 단 정의는 단을 바꾸지 않는다._lay_areas: 영역마다 그 단 설정으로_Page를 바꿔 문단을 잰다(캐시 없는 문단은 그 단 폭에서 줄을 나눈다)._lay_area_columns는 단 설정 하나를 읽는_column_layout으로 나누고, 구역의 첫 단 설정을 쓴다._SectionLayout에 줄마다의 쪽·단(places)과 구역의 쪽 수를 더하고,_assemble이 이를 쓴다.테스트
tests/test_layout_page_estimate.py의HANCOM_PAGES에 한/글 저장본 아홉을 더한다. 캐시가 있을 때와 없을 때 모든 줄 위치와 쪽 수를 시험한다.고치기 전에는 아홉 모두 두 모드에서 지원 밖이었다.
_column_areas단위 시험도 더한다. 문단의 첫 단 정의만 영역을 열고, 글 뒤의 정의는 단을 바꾸지 않으며, 균형 다단의 단 나누기도 영역을 여는지 본다.이 PR은 #415, #416, #417, #418, #419, #420 위에 쌓았다. 앞 PR이 병합되면 그 커밋들은 이 PR의 diff에서 빠진다.
🤖 Generated with Claude Code