Repository navigation
fix(text): KoPub 한자·전각 기호를 한글이 아닌 글꼴 자신의 전진폭으로 잰다 (#8099) - #8111
Open
planet6897 wants to merge 2 commits into
Open
planet6897 wants to merge 2 commits into
planet6897 wants to merge 2 commits into
Conversation
KoPub돋움체·바탕체는 한자·전각 기호를 한글 전진폭(0.872 · 0.94)으로 쟀고, 「」『』·× 등은 KoPub 표 밖이라 공통 폴백으로 갔다. 글꼴(cmap+hmtx)은 한자·기호 900, 낫표 450 이고, 한/글 Print 내장 서브셋과 실제 전진이 같은 값을 증언한다. - 공통 갈래(KoPub·KoPubWorld): 한자 · 옛 자모(ㆍ 포함) · 전각 FF01–FF5E·FFE0–FFE6 · CJK 기호(、。〈〉《》「」『』【】〔〕 450, 〃〓 900) · is_fullwidth_symbol 900 · ◦ 600 · ₩ 894 · £¥ 계열별. - KoPub돋움체·바탕체는 U+0080–U+2FFF 를 글꼴 표(668자, 세 굵기 동일)로 잰다. 상자 그리기는 rhwp 의 PUA 글머리표 표시 대체(━ 등)가 생기는 블록이고 한/글은 그 글리프를 KoPub 으로 그리지 않아(정본 383쪽 중 0건) 표에서 뺐다.
Collaborator
|
@planet6897 korpub 폰트는 웹폰트로 이미 cdn 에서 다운받아서 사용하는데 이 pr 이 과연 유용한가요? 현재 샘플 png 파일들도 전부 폰트가 깨져서 보이는데요? 현재 메인터너 보정으로 기존에 korpub 폰트 없을때 pdf 로 산출해서 회귀테스트 하는것도 다 제거증입니다. |
Contributor
Author
|
@jangster77 확인 감사합니다. 세 가지로 답드립니다.
|
This branch has not been deployed
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 #8099
무엇을 고쳤나
KoPub돋움체·바탕체의 한자·전각 기호를 rhwp 가 한글 전진폭(돋움 0.872 · 바탕 0.94)으로 쟀고, 「」『』·
×등은 KoPub 표 밖이라 공통 폴백으로 갔다. 글꼴과 한/글 Print 는 이 글자들을 한글과 다른 900/1000em(낫표 450)으로 전진시킨다. 한자·기호가 많은 줄에서 바탕은 넓게, 돋움은 좁게 잡혀 줄 안 배치가 한컴과 갈렸다.근거
① 글꼴
cmap+hmtx직독 — KOPUS 배포 KoPub·KoPubWorld 바탕·돋움 × Light·Medium·Bold 12개 프로그램:② 한/글 Print — 정본
pdf/2025 행정업무운영 편람(최종)-2020-kopub.pdf(Hwp 2020 11.0.0.9136, KoPub 서브셋 내장, 383쪽)의 글자 전진(원점 차이)을 같은 줄 한글 전진으로 나눈 비가 글꼴 비와 맞는다.×도 PDF 57쪽(문서 49쪽)(×)에서 ○·→ 와 같은 0.804em(장평·자간 포함)으로 놓인다.변경
text_measurement.rskopub_cjk_symbol_units: KoPub·KoPubWorld 공통 갈래 — 한자 · 옛 자모 · 전각 FF01–FF5E·FFE0–FFE6 · CJK 기호(450 / 〃〓 900) ·is_fullwidth_symbol900 · ◦·₩·£·¥ 개별값.※는 이 갈래로 옮겼다(값 0.9 그대로).text_measurement/kopub_symbol_advances.rs(생성 표): KoPub돋움체·바탕체의 U+0080–U+2FFF 전진폭 668자(세 굵기 동일).× ± ¶·그리스·키릴·수학 기호 등이 글꼴 값으로 잡힌다. 다른 규칙이 소유하는 글자(좁은 구두점··‧, 곡선 따옴표, 공백류, U+00A0·U+00AD)는 넣지 않았다.×559 등) 공통 갈래만 쓴다.map_pua_bullet_char: U+F080F →━등)로 생기고, 한/글은 그 PUA 글리프를 KoPub 이 아닌 기호 글꼴로 그린다(편람 PDF 140쪽 글머리표: Haansoft Batang 0.46em). 정본 383쪽 전체에서 KoPub 으로 그려진 상자 그리기 글자는 0건이다. 이 블록을 표에 넣었을 때 PDF 139·140·297쪽(글머리표━줄)이 1~3%p 떨어지는 것을 확인하고 뺐다.검증 (code head
fd28c3bd2, 증적 head84bdfc4bb, base devel5e2b9bfbf)회귀 검사
tests/cases/issue_8099_kopub_cjk_symbol_advance.rs편람 HWP 의 쪽(아래 쪽 번호는 모두 PDF 쪽)마다 KoPub 글자 전진을 같은 쪽·같은 글꼴·같은 크기 한글 전진의 중앙값으로 나눈 비(한자는 언어 슬롯이 달라 한글과 다른 run 이 된다)를 정본에서 같은 방법으로 잰 값과 ±0.015 로 대조한다. 절대 px 이 아니라 비라서 줄 위치와 무관하다.
×시험을 둔 채 src 만 되돌리면 첫 사례(38쪽 바탕 한자)부터 1.0070 으로 FAIL, 수정 후 PASS.
전쪽 Native / fresh WASM 2px 실루엣 — 편람 383쪽(정본 383쪽)
(×)줄은×가 ○·→ 와 같은 폭으로 잡힌다.측정:
visual_sweep.py --silhouette-only --dpi 96 --compat 2022, Native(native-skiaPNG 래스터)와 fresh WASM(scripts/wasm-pack-locked.sh로 같은 소스에서 새로 빌드,rhwp_bg.wasmsha2562fe597341ecb7c22…).RHWP_FONT_PATH앞에 KOPUS 배포 KoPub돋움체·바탕체 TTF(Light·Medium·Bold) 폴더를 넣어 devel·head 를 모두 다시 돌렸다(이전 판은 그 폴더를 경로에 넣지 않았다). Native 는 검증 기계의 사용자 글꼴(fontconfig)로 이미 같은 KoPub 을 쓰고 있어 결과가 같았고, fresh WASM 은 평균이 0.01 낮아졌다. 위 그림은 이 재실행의 산출물이다(head84bdfc4bb).코퍼스·게이트
samples/**1,252문서layout-anomalyA/B(devel 대비): 바뀐 문서 0.issue_6520_svg_layer_contract::subset_font_bytes_are_deterministic_for_multiple_codepoints는 검증 기계에 한컴돋움(HDOTUM.TTF)이 사용자 글꼴로 설치돼 있어 시험이 그 TTF 를 임베드하면서font/opentype확인에 실패한 환경 문제다(그 글꼴이 없는 CI·devel 에서는 통과, 이 PR 무관).🤖 Generated with Claude Code