
Estou tentando modificar o tamanho padrão de uma fonte usando
(add-to-list 'face-font-rescale-alist (cons "^.*STIXGeneral.*$" 0.95) t)
Isso supostamente redimensiona todas as fontes com o nome STIXGeneral em 0,95, porque para mim essa fonte é um pouco mais alta que a fonte padrão. O valor resultante de face-font-rescale-alist
é:
(("-cdac$" . 1.3) ("^.*STIXGeneral.*$" . 0.95))
No entanto, com o emacs 24.3 (também a versão git e também o pré-lançamento 24.3.92.1), o resultado da adição do acima .emacs
é que a fonte está errada em todos os quadros, exceto no quadro inicial. Executar 24.3 com -Q --eval="<expression above>"
dá:
(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))
Com minha .emacs
versão regular no git:
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))
O rosto no quadro inicial é o que eu esperava. O local onde face-font-rescale-alist
influencia a fonte está font_score
em font.c
(link). O mesmo problema ocorre na versão git se eu substituir (add-to-list ...)
por (setq face-font-rescale-alist nil)
.
O que estou fazendo de errado aqui?
Responder1
Hum. No startup.el
código a seguir, detecta alterações em face-font-rescale-alist
e redefine a fonte padrão, ao mesmo tempo que ignora as alterações provenientes de custom-set-face
(que é como eu estava configurando a fonte com a interface de personalização):
;; startup.el:670
(unless (eq face-font-rescale-alist old-face-font-rescale-alist)
(set-face-attribute 'default nil :font (font-spec)))
Portanto, é necessário definir face-font-rescale-alist
após o código que tenta apagar as customizações. Isso pode ser feito anexando um conselho a frame-notice-user-settings
, que é executado após o código de redefinição facial:
;; 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)
Isso se aplica face-font-rescale-alist
como eu esperava que funcionasse lendo a documentação.