fix(layout): tell an ideographic space typed in the text from a fixed-width one - #352
Merged
Merged
Conversation
…-width one python-hwpx reads hp:fwSpace as U+3000, and FormFit measures U+3000 as the fixed-width space: a quarter of the em that hangs once at a line end. An ideographic space typed in the text of hp:t is another thing to Hancom: the glyph U+3000 at the face's advance (a full em in most faces), which a line may start after, and which hangs at a line end however many follow each other. The page estimate now passes it to FormFit as one of its own. A fixed-width space that starts at or past the margin begins the next line, even right after a word; FormFit hung it when the word ended exactly at the margin. The new fixture holds 30 cells Hancom laid out and saved: rows of "가나다라마" with one or two typed ideographic spaces, and with fixed-width spaces, in cells of narrowing widths. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
# Conflicts: # src/hwpx/layout/pages.py # tests/test_layout_page_estimate.py
…graphic-space # Conflicts: # CHANGELOG.md # tests/test_layout_page_estimate.py
Owner
Author
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)이hp:t글 안에 글자로 든 전각 공백(U+3000)을 고정폭 빈칸(hp:fwSpace)과 구별한다._t_text는hp:t의 글과 꼬리 글에 든 U+3000만 FormFit의 표시 글자_GLYPH_SPACE(U+FDD0, 유니코드 비문자)로 넘긴다.hp:fwSpace는 전처럼 U+3000이다. 길이가 같으므로 글자 위치는 바뀌지 않는다.char_advance는_GLYPH_SPACE를 U+3000 글자로 잰다. 표에 있는 글꼴은 그 설계 폭을 쓰고, 그 밖의 글꼴은 온폭 글자 평균(1 em)을 쓴다.hancom_line_starts는 이 글자를 줄 끝에 매다는 빈칸으로 보되, 이어져도 다음 줄로 넘기지 않는다. 최소 공백으로 줄이지도 않는다.FormFit은 또 고정폭 빈칸이 여백에서(또는 넘어서) 시작하면 낱말 바로 뒤라도 다음 줄로 넘긴다. 전에는 낱말이 여백에 딱 맞을 때 그 뒤 고정폭 빈칸을 줄 끝에 매달았다. 여백 앞에서 시작한 고정폭 빈칸은 전처럼 매달린다.
변경 로그를 고친다.
테스트
tests/test_layout_page_estimate.pypages_typed_ideographic_spaces.hwpx를 더한다. 맑은 고딕 10 pt 칸 30개이고, 칸 폭만 줄여 가며 놓았다.KEEP_WORD·BREAK_WORDHANCOM_PAGES에 더한다. 캐시가 있을 때와 없을 때 모두 줄 위치와 쪽 수(5쪽)가 한/글과 같다.🤖 Generated with Claude Code