Emacs의 Face-font-rescale-alist에서 예기치 않은 결과가 발생했습니다.

Emacs의 Face-font-rescale-alist에서 예기치 않은 결과가 발생했습니다.

다음을 사용하여 글꼴의 기본 크기를 수정하려고 합니다.

(add-to-list 'face-font-rescale-alist (cons "^.*STIXGeneral.*$" 0.95) t)

이것은 STIXGeneral이라는 이름을 가진 모든 글꼴의 크기를 0.95로 조정해야 합니다. 왜냐하면 저에게는 해당 글꼴이 표준 글꼴보다 약간 더 크기 때문입니다. 결과 값은 face-font-rescale-alist다음과 같습니다.

(("-cdac$" . 1.3) ("^.*STIXGeneral.*$" . 0.95))

그러나 emacs 24.3(git 버전 및 사전 릴리스 24.3.92.1)에서는 위 내용을 추가한 결과 .emacs초기 프레임을 제외한 모든 프레임에서 글꼴이 잘못되었습니다. 다음을 제공 하여 24.3을 실행합니다 -Q --eval="<expression above>".

(message "%s" (face-all-attributes 'default (selected-frame)))
New frame: ((:family . Geneva) (:foundry . apple) (:width . normal) (:height . 120) (:weight . normal) (:slant . normal) (:underline) (:overline) (:strike-through) (:box) (:inverse-video) (:foreground . Black) (:background . White) (:stipple) (:inherit))
Initial frame: ((:family . Menlo) (:foundry . apple) (:width . normal) (:height . 120) (:weight . normal) (:slant . normal) (:underline) (:overline) (:strike-through) (:box) (:inverse-video) (:foreground . Black) (:background . White) (:stipple) (:inherit))

내 정규 .emacsgit 버전을 사용하면 다음과 같습니다.

New frame: "((:family . Helvetica) (:foundry . nil) (:width . normal) (:height . 110) (:weight . normal) (:slant . normal) (:underline) (:overline) (:strike-through) (:box) (:inverse-video) (:foreground . #000000) (:background . AliceBlue) (:stipple) (:inherit))"
Initial frame: ((:family . Source Code Pro) (:foundry . nil) (:width . normal) (:height . 110) (:weight . normal) (:slant . normal) (:underline) (:overline) (:strike-through) (:box) (:inverse-video) (:foreground . #000000) (:background . AliceBlue) (:stipple) (:inherit))

초기 프레임의 얼굴은 제가 기대했던 얼굴입니다. face-font-rescale-alist글꼴에 영향을 미치는 곳 font_scorefont.c(링크). (add-to-list ...)로 교체하면 git 버전에서도 동일한 문제가 발생합니다 (setq face-font-rescale-alist nil).

내가 여기서 뭘 잘못하고 있는 걸까?

답변1

흠. startup.el다음 코드 에서는 의 변경 사항을 감지 face-font-rescale-alist하고 기본 글꼴을 재설정하는 동시에 에서 오는 변경 사항도 무시합니다 custom-set-face(이것이 사용자 정의 인터페이스로 글꼴을 설정한 방법입니다).

;; startup.el:670
(unless (eq face-font-rescale-alist old-face-font-rescale-alist)
 (set-face-attribute 'default nil :font (font-spec)))

face-font-rescale-alist따라서 사용자 정의 내용을 지우려는 코드 뒤에 설정해야 합니다 . 이는 frame-notice-user-settings얼굴 재설정 코드 다음에 실행되는 어드바이스를 첨부하여 수행할 수 있습니다 .

;; in .emacs
(defadvice frame-notice-user-settings (before my:rescale-alist)
  (message "Set face-font-rescale-alist")
  (add-to-list 'face-font-rescale-alist
               (cons (font-spec :family "STIXGeneral") 0.95) t))
(ad-activate 'frame-notice-user-settings)

이는 face-font-rescale-alist문서를 읽음으로써 작동할 것으로 예상했기 때문에 적용됩니다.

관련 정보