Skip to content

fix(form-fit): measure a cell's slot at its width on the table grid - #395

Merged
airmang merged 1 commit into
mainfrom
fix/form-fit-cell-width-from-the-table-grid
Oct 2, 2026
Merged

airmang merged 1 commit into
mainfrom
fix/form-fit-cell-width-from-the-table-grid

Conversation

@airmang

@airmang airmang commented Oct 2, 2026

Copy link
Copy Markdown
Owner

바뀐 점

FormFit(resolve_slot_metrics)이 칸의 자리를 칸 자신의 hp:cellSz 폭에서 재던 것을 고친다. 한/글은 칸의 글을 표 격자 위의 폭으로 놓는다(#392). 그래서 같은 열의 다른 행 칸이 더 넓으면, 그 칸도 그 폭으로 놓인다.

  • #392가 쪽 수 추정에 넣은 격자 계산을 hwpx.oxml.table_sizes.grid_widths_of로 옮긴다. 칸 여백 규칙(cell_margins_of) 옆이다. 쪽 수 추정과 FormFit이 함께 쓴다.
  • resolve_slot_metrics의 폭(SlotMetrics.raw_width)이 이제 그 칸의 격자 폭이다. 표를 읽을 수 없으면 전처럼 칸 자신의 폭이다(_grid_width).
  • 모듈 소유 문서(docs/architecture/module-ownership.json)의 table_sizes 설명에 격자를 더한다.
  • 변경 로그의 fix(layout): lay a table cell out at its width on the table grid #392 항목에 FormFit 줄을 더한다.

테스트

  • tests/test_form_fit_hancom_rules.py에 test_a_cell_slot_is_as_wide_as_its_columns_on_the_table_grid를 더한다. #392의 한/글 저장본 셋에서 다음 칸을 잰다.
    • 30000·32000·31000 열의 첫 칸: 32000
    • 8000|30000 아래 7683|30500 행의 30000 칸: 30500
    • 31000으로 합친 칸 아래 10000|20000 행의 20000 칸: 21000
  • 칸마다 raw_width가 격자 폭인지 본다. 안전 계수 1.0에서 쓸 수 있는 폭이 한/글 줄 폭(horzsize)과 2 안쪽인지도 본다.
  • 고치기 전 코드에서는 셋 다 실패한다(raw_width가 칸 자신의 폭).

🤖 Generated with Claude Code

FormFit measured a cell at its own hp:cellSz width. Hancom lays a cell's
text out at its width on the table's column grid, wider than its own when
another row's cells push its columns' ends apart. The grid the page
estimate uses moves to hwpx.oxml.table_sizes.grid_widths_of, and
resolve_slot_metrics() measures the slot there (SlotMetrics.raw_width).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@airmang
airmang merged commit 97280ff into main Oct 2, 2026
13 checks passed
@airmang
airmang deleted the fix/form-fit-cell-width-from-the-table-grid branch October 2, 2026 21:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant