Skip to content

fix(#1300): 수식 위첨자를 base 상단에 정렬 — 키 큰 base 윗줄 침범 해소#1301

Closed
planet6897 wants to merge 2 commits into
edwardkim:develfrom
planet6897:fix/equation-superscript-top-align-1300
Closed

fix(#1300): 수식 위첨자를 base 상단에 정렬 — 키 큰 base 윗줄 침범 해소#1301
planet6897 wants to merge 2 commits into
edwardkim:develfrom
planet6897:fix/equation-superscript-top-align-1300

Conversation

@planet6897

Copy link
Copy Markdown
Contributor

개요

괄호 분수 등 키 큰 base의 위첨자(지수)가 baseline 위로 과하게 치솟아 윗줄을 침범하던 문제를 해소합니다. (예: (1/6)⁴4가 윗줄 "의 2가지 경우이므로"로 떠올라 "이므₄로"처럼 보임)

원인

src/renderer/equation/layout.rs layout_superscript: base_y(base 밀어내기)가 b.baseline에 비례 → 키 큰 base에서 합성 baseline이 자연 baseline의 약 2배가 되어 위첨자가 한 줄 위로 치솟음.

수정

위첨자 상단을 base 상단에 정렬(base를 아래로 밀지 않음):

// before: base_y = sup_shift.max(s.height - b.height).max(0.0);
// after:
base_y = (s.height - b.height).max(0.0);
  • 키 큰 base: base_y=0 → 합성 baseline = base 자연 baseline, 위첨자 상단 = base 상단.
  • 짧은 base(x⁴,6⁴): 정상 우상단 첨자.

검증

커밋

  1. docs(#1297) — 미주 수식 겹침 조사(현재 코드 재현 안 됨, 옛 WASM 빌드 원인) + stale-WASM 재발방지 기록
  2. fix(#1300) — 위첨자 상단 정렬 + 회귀 테스트

🤖 Generated with Claude Code

- 17쪽 [다른 풀이] 수식 겹침은 현재 devel SVG/캔버스에서 재현 안 됨
- 원인: studio가 옛 WASM 빌드로 동작(미주 겹침은 edwardkim#1256/edwardkim#1257/#1261에서 수정됨)
- 재발 방지: stale WASM phantom-bug 트러블슈팅 기록
괄호 분수 등 키 큰 base의 위첨자가 baseline 위로 과하게 치솟아 윗줄을 침범하던
문제(예: (1/6)^4 의 4 가 윗줄로 떠오름)를 해소. layout_superscript 에서 base 를
baseline 비례로 밀던 것을 제거하고 위첨자 상단을 base 상단에 정렬.

- base_y = (s.height - b.height).max(0.0)
- 회귀 테스트 test_superscript_tall_base_no_overshoot 추가
- cargo test 2037 passed, 0 failed. 한글 2022 PDF 정합(SVG·studio 캔버스 확인)
@edwardkim edwardkim self-requested a review June 5, 2026 11:35
@edwardkim edwardkim added the enhancement New feature or request label Jun 5, 2026
@edwardkim edwardkim added this to the v1.0.0 milestone Jun 5, 2026
@edwardkim

Copy link
Copy Markdown
Owner

Maintainer review completed.

Applied the code change from this PR to devel with the maintainer integration path:

  • accepted src/renderer/equation/layout.rs
  • added a sanitized troubleshooting note for stale WASM build checks
  • excluded contributor-local planning/report/working docs from the merge

Verification:

  • cargo fmt --all -- --check
  • cargo test --lib renderer::equation -- --nocapture
    • 134 passed
  • cargo test --lib
    • 1587 passed, 0 failed, 6 ignored
  • cargo clippy --lib -- -D warnings
  • maintainer visual judgment passed

The change has been merged and pushed to devel.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants