Task #977: WASM 미등록 폰트 폴백 native EmbeddedTextMeasurer 동기화#1095
Merged
Conversation
59632cd to
063367a
Compare
…loses edwardkim#977) WASM `WasmTextMeasurer` 의 미등록 폰트 폭 폴백 두 경로를 native heuristic 으로 통일: 1. `measure_char_width_hwp` (일반 문자) — JS Canvas 폴백 제거, native compute_char_positions 와 동일 휴리스틱 (CJK/fullwidth=font_size, 일반=0.5em, narrow_punct=0.3em). 2. `measure_hangul_width_hwp` (한글 '가' 대리 측정) — JS cached_js_measure('가') 폴백 제거, 미등록 폰트도 font_size (1.0 em) 휴리스틱. 본질: 한컴은 LEFT tab + tab_extended[0] 에 "tab_pos - 한컴_선행텍스트폭" 으로 행별 tab 폭 저장. 미등록 폰트(예: 나눔바른고딕)에서 우리 한글 폭이 한컴 metric 과 다르면 (= 브라우저 fallback 폰트의 '가' 폭), 같은 ext[0] 더해도 디지트 x 좌표가 행별 한글 개수 차이 × 폭차 만큼 누적 어긋남. PR edwardkim#1026 (narrow_punct 분기) 흡수 + Stage 2 공백 분기 통일 후 잔존 본질. 영향: - 등록 폰트(맑은 고딕, HCR Batang 등): embedded 메트릭 우선 → 본 분기 미진입, 무회귀. - 미등록 폰트(나눔바른고딕 등): native 와 동일 폭 산출 → SVG 와 WASM 일관 정렬. 검증: - issue_874_ktx_toc_page_number_right_align (PR edwardkim#1026 회귀 가드): 1/1 PASS - svg_snapshot (golden SVG 8 종): 8/8 PASS - cargo check --lib --target wasm32-unknown-unknown: OK - Docker WASM 빌드 성공 - 작업지시자 시각 재현 확인 (TOC 페이지 디지트 정렬) closes edwardkim#977 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
063367a to
a8e1f1d
Compare
edwardkim
added a commit
that referenced
this pull request
May 25, 2026
- pr_1095_review.md: 검토 (v3 본질 분리 + 코드 정독 + 메인테이너 검증 계획) - pr_1095_report.md: 최종 결정 — merge 수용 (검증 7/7 + CI 전부 pass) 검증: - 회귀 가드 #874: 1/1 PASS - svg_snapshot: 8/8 PASS - lib 1382 passed / 0 failed - WASM check / clippy / fmt clean - CI 전부 pass 본 PR 의 본질: - v2 #1045 (PR #1026 흡수로 close) 후 잔존 본질 - measure_hangul_width_hwp 도 native heuristic 동기화 (PR #1026 의 measure_char_width_hwp 영역 외 추가) - 영향 영역: 미등록 폰트만 (등록 폰트는 _embedded 가 Some 반환 → 무회귀) merge: 471d5bf (GitHub merge commit), 이슈 #977 close. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
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.
이슈
closes #977 — Skia replay 경로에서 일부 목차 개요번호가
910 px 우측 밀려 정렬 어긋남.본질
WASM
WasmTextMeasurer의 미등록 폰트 폭 폴백이 두 함수 에 분기되어 있는데, 한쪽만 native heuristic 으로 통일하면 잔존:measure_char_width_hwp— 일반 문자 (라틴, 구두점 등)measure_hangul_width_hwp— 한글 '가' 대리 측정종전 두 경로 모두 미등록 폰트에
cached_js_measure(JS CanvasmeasureText) 사용 → 브라우저 fallback 폰트로 측정 → 폰트별로 폭 변동.한컴은 LEFT tab +
tab_extended[0]에 "tab_pos − 한컴_선행텍스트폭" 으로 행별 tab 폭을 미리 계산해 저장. 우리 한글 폭이 한컴 metric 과 다르면, 같은 ext[0] 더해도 디지트 x 좌표가 행별 한글 개수 차이 × 폭차 만큼 누적 어긋남.수정
두 폴백 모두 native
EmbeddedTextMeasurer와 동일 휴리스틱으로 통일:font_size(1.0 em)font_size * 0.3(PR fix(text_measurement): 좁은 구두점 (U+2018/U+2019/U+2027) 폭 분류 + native/WASM 동기화 #1026 narrow_punct 분기 보존)font_size * 0.5font_size(1.0 em, 미등록 폰트 시)JS Canvas 폴백은 폰트별 브라우저 fallback 으로 폭이 변동되어 본질적으로 한컴 metric 과 합치 불가능 → 제거.
영향
measure_char_width_embedded가Some반환 → 본 분기 미진입, 무회귀.검증
issue_874_ktx_toc_page_number_right_align(PR fix(text_measurement): 좁은 구두점 (U+2018/U+2019/U+2027) 폭 분류 + native/WASM 동기화 #1026 회귀 가드): 1/1 PASSsvg_snapshot(golden SVG 8 종): 8/8 PASS (form_002, issue_147/157/267/617/677, table_text, determinism)cargo check --lib --target wasm32-unknown-unknown: OK이력
변경 파일
src/renderer/layout/text_measurement.rs— 핵심 수정 (2 폴백 통일).mydocs/plans/task_m100_977_v3.mdmydocs/working/task_m100_977_v3_stage{1,2,3}.mdmydocs/report/task_m100_977_v3_report.md🤖 Generated with Claude Code