Skip to content

기능: convert에 --font-dir 플래그 추가 — PDF 변환 외부 폰트 CLI 제어 - #22

Merged
YeolHanMyeong merged 1 commit into
mainfrom
feat/convert-font-dir
Jul 24, 2026
Merged

기능: convert에 --font-dir 플래그 추가 — PDF 변환 외부 폰트 CLI 제어#22
YeolHanMyeong merged 1 commit into
mainfrom
feat/convert-font-dir

Conversation

@YeolHanMyeong

Copy link
Copy Markdown
Collaborator

요약

render/diff/mcp에는 있던 --font-dirconvert(PDF 출력)에는 없어 HWP_FONT_DIR 환경변수로만 외부 폰트를 지정할 수 있던 비대칭을 해소한다.

  • convert--font-dir <FONT_DIR> 추가 — 반복 지정 가능. help 표기는 md 전용 옵션들의 (md) 관례에 맞춘 (pdf) 접두.
  • 두 PDF 경로 모두 관통 — ① 확장자 .pdf 추론 시 render 위임 경로(기존 Vec::new() 하드코딩 제거), ② 명시적 --to pdf match 팔(pdf_render_opts(font_dirs)).
  • 하위 호환 — 미지정 시 기존과 동일하게 HWP_FONT_DIRfonts/ 폴백(resolve_font_dirs).
  • 범위 밖write_by_ext(edit/new/MCP 저장 공용)의 PDF 경로는 기존 환경변수 기본값 유지. 호출처 4곳 관통은 별도 작업.
  • docs/manual/cli-reference.md는 드리프트 게이트 bless(HWP_UPDATE_DOCS=1 cargo test -p hwp-cli --test cli_reference)로 재생성.
  • clippy too_many_arguments(8/7)는 동급 명령 핸들러(edit·diff) 관례대로 #[allow] 처리.

검증

  • scripts/check.sh 통과 (fmt / clippy -D warnings / test 전체).
  • 격리 실기 테스트fonts/ 없는 CWD + HWP_FONT_DIR 미설정에서 플래그 유무 대조:
    • 플래그 없음: 함초롬바탕 → AppleMyungjo 시스템 폰트 대체, PDF 136,561B
    • --font-dir <외부 디렉터리>: 글꼴 일치: 함초롬바탕/돋움, PDF 123,990B (임베드 폰트 상이)
    • 확장자 추론·--to pdf 두 경로 모두 동일하게 확인.

🤖 Generated with Claude Code

render/diff/mcp에만 있던 --font-dir가 convert(PDF)에는 없어 HWP_FONT_DIR
환경변수로만 폰트를 지정할 수 있던 비대칭 해소.

- Convert 명령에 --font-dir <FONT_DIR> 추가 (반복 가능, pdf 전용 표기)
- convert::run에 font_dirs 관통: 확장자 .pdf 추론 시 render 위임 경로
  (기존 Vec::new() 하드코딩)와 명시적 --to pdf 팔 모두
- 미지정 시 기존 HWP_FONT_DIR → fonts/ 폴백 유지 (하위 호환)
- write_by_ext(edit/new/MCP 저장 공용)의 PDF 경로는 범위 밖 — 기존 동작 유지
- cli-reference.md 드리프트 게이트 bless로 재생성
- clippy too_many_arguments는 edit/diff 관례대로 #[allow] 처리

검증: 격리 테스트로 플래그 유무 대조 — fonts/ 없는 CWD에서 미지정 시
시스템 폰트 대체(함초롬바탕→AppleMyungjo), --font-dir 지정 시 글꼴 일치.
확장자 추론·--to pdf 두 경로 모두 확인. scripts/check.sh 통과.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@YeolHanMyeong
YeolHanMyeong merged commit 9f9fb7b into main Jul 24, 2026
3 checks passed
@YeolHanMyeong
YeolHanMyeong deleted the feat/convert-font-dir branch July 24, 2026 16:19
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