Search code examples
macosemacsfontsemacs24

Cocoa Emacs 24.5 Font Issues Invalid Font Name (Inconsolata-dz)


I am trying to set [Inconsolata-dz][1] as my default font to Emacs. Regular Inconsolata works fine, but the dz version is not working properly. Most functions I use keep throwing this error (followed all the instructions online on how to set Emacs font):

set-face-attribute: Invalid font name: "-*-Inconsolata-dz-normal-normal-normal-*-13-*-*-*-m-0-iso10646-1"

I finally got it to work by doing this in my init.el:

(setq initial-frame-alist '((font . "Inconsolata-dz-13")))
(setq default-frame-alist '((font . "Inconsolata-dz-13")))

I also have this in init.el, which was generated by customize-faces, but it seems to change the font to Helvetica (unless overridden by the code above):

(custom-set-variables
 ;; custom-set-variables was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 '(custom-safe-themes
   (quote
    ("e16a771a13a202ee6e276d06098bc77f008b73bbac4d526f160faa2d76c1dd0e"
     "d677ef584c6dfc0697901a44b885cc18e206f05114c8a3b7fde674fce6180879"
     "8aebf25556399b58091e533e455dd50a6a9cba958cc4ebb0aab175863c25b9a4"
     default))))

(custom-set-faces
 ;; custom-set-faces was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 '(default ((t (:inherit nil :stipple nil :inverse-video nil
             :box nil :strike-through nil :overline nil
             :underline nil :slant normal
             :weight normal :height 140 :width normal
             :foundry "nil" :family "Inconsolata-dz")))))

Now the issue with the first code above is that doing a Ctrl+N, to create a new window will throw the same Invalid font name error.

I installed Inconsolata and Inconsolata-dz the same way on my Mac. Just the regular, default way of installing fonts on OS X.

Does anyone know what I'm doing wrong and how I can use Inconsolata-dz properly?


Solution

  • Recent versions of emacs seem to have issues with dashes in font names.

    This solution fixed it for me:

    https://emacs.stackexchange.com/questions/16818/cocoa-emacs-24-5-font-issues-inconsolata-dz/29397#29397

    Basically had to rename the font to InconsolataDZ.