Skip to content

fix(styles): drop stale line caches when replace_font changes a paragraph's face - #508

Merged
airmang merged 1 commit into
mainfrom
fix/replace-font-clears-stale-line-caches
Oct 18, 2026
Merged

airmang merged 1 commit into
mainfrom
fix/replace-font-clears-stale-line-caches

Conversation

@airmang

@airmang airmang commented Oct 17, 2026

Copy link
Copy Markdown
Owner

무엇

doc.styles.replace_font가 글꼴을 바꾼 뒤에도 본문 문단의 줄 배치 정보(hp:linesegarray)가 그대로 남았다. 한/글은 남은
정보의 줄 나눔을 그대로 따르므로, 새 글꼴의 글자가 옛 글꼴의 줄 폭에 맞춰 눌리거나 겹쳐 그려질 수 있었다.

  • replace_font: 바꾸기 전과 뒤에 글자 모양(hh:charPr)마다 언어별 글꼴 이름을 비교해, 이름이 바뀐 글자 모양을 쓰는
    run이 있는 문단의 줄 배치 정보만 지운다. id만 다시 매겨진 글자 모양은 같은 글꼴을 가리키므로 건드리지 않는다.
  • doc.parts.set_paragraph_auto_spacing: 한글·영문/숫자 자동 간격 값이 실제로 바뀌면 그 문단 모양을 쓰는 문단의 줄 배치
    정보를 지운다.
  • 두 곳이 같이 쓰는 hwpx.oxml.header_fonts.clear_line_caches(document, char_pr_ids=..., para_pr_ids=...).

다른 문단의 줄 배치 정보는 그대로 둔다(한/글이 문서 전체를 다시 배치할 때 생기는 차이를 피한다).

시험

  • tests/test_style_font_border_reads.py: 바뀐 글꼴의 문단만 정보가 지워지고 저장·다시 열기 뒤에도 그렇다. 다른 언어
    블록만 바꿀 때도 같다.
  • tests/test_header_compat_authoring.py: 자동 간격 값이 그대로면 정보가 남고, 바뀌면 그 문단 모양의 문단만 지워진다.
  • 세 시험 모두 고침 전에는 실패한다.

🤖 Generated with Claude Code

@airmang airmang left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exact head: b5839f5.

Reviewed before/after font-face resolution across language blocks, remapped font IDs, dirty/cache invalidation, direct-run paragraph selection, nested paragraph traversal, and the auto-spacing no-op/change path. The helper removes only direct paragraph line-cache children and marks changed sections for serialization. No unresolved code finding. All 104 local style/header compatibility tests passed, including save/reopen preservation and language-specific replacement.

All 13 current CI checks pass; verified successful workflow head SHA and read its test/lint/type/hygiene log (6,931 passed, 18 skipped, 1 xfailed; coverage 90.04%).

Merge held: after #505 merged, git merge-tree against current main 366e25d reproduces a content conflict in CHANGELOG.md. Preserve both entries when resolving against latest main, then revalidate the changed head and integration. No conflicted integration-test pass is claimed. COMMENT because this authenticated account owns the PR.

@airmang
airmang force-pushed the fix/replace-font-clears-stale-line-caches branch from b5839f5 to e7d6f44 Compare October 17, 2026 17:53

@airmang airmang left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed exact head e7d6f44.

Range-diff confirms rebase/CHANGELOG placement only since the prior review. Rechecked face-name comparison across font renumbering/language blocks, direct paragraph-cache removal, section dirty marking and the auto-spacing change/no-op path. All 104 local style/header tests pass, including save/reopen preservation. No unresolved code finding. All 13 current CI checks pass; verified workflow head SHA and read its test/lint/type/hygiene log (6,932 passed, 18 skipped, 1 xfailed; coverage 90.04%).

Merge held: after #506 and #512 merged, git merge-tree against current main 73d68a7 reproduces content conflicts in CHANGELOG.md. Resolve preserving both PRs' changes and fixture coverage, then revalidate the updated head and combined tree. No conflicted integration-test pass is claimed. COMMENT because this account owns the PR.

…nt changed

replace_font rewrote the header's font table but left every paragraph's
hp:linesegarray in place. Hancom keeps a cache's line breaks, so text in
the new face was drawn into the old face's lines, squeezed or overlapping.
It now drops the caches of the paragraphs with a run whose charPr names
another face afterwards. set_paragraph_auto_spacing does the same for the
paragraphs of the paraPr it changes in place.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@airmang
airmang force-pushed the fix/replace-font-clears-stale-line-caches branch from e7d6f44 to dc04d89 Compare October 18, 2026 00:07

@airmang airmang left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-reviewed exact head dc04d89 against current main 73d68a7. Range-diff confirms only rebase/CHANGELOG placement changes. Rechecked face-name comparison across language blocks and font-ID renumbering, selective direct paragraph-cache removal, serialization dirty marking and auto-spacing change/no-op behavior. No unresolved finding; prior conflict is resolved.

All 104 local style/header compatibility tests pass, including font replacement save/reopen and unchanged-paragraph preservation. All 13 current checks pass; CI workflow head SHA verified and test/lint/type/hygiene logs inspected (6,935 passed, 18 skipped, 1 xfailed; coverage 90.05%). Tested head includes current main, tree 4c2bc0127e174735e64f55f97f44305563550ea0. Ready for expected-head-SHA squash merge. COMMENT because this account owns the PR.

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