1

I have been struggling with the following issue on Windows for the last couple of years. For some reason, certain symbols are not displayed properly:

Screenshot of emacs on Windows

Everything displayed is those ? symbols.

If I place the cursor over any of those ? symbols, describe-font gives the following:

name (opened by): -outline-Fira Code-normal-normal-normal-mono-13-*-*-*-c-*-iso8859-1
       full name: Fira Code-10.0
            size: 13
          height: 15
 baseline-offset:  0
relative-compose:  0
  default-ascent: 12
          ascent: 12
         descent:  3
   average-width:  8
     space-width:  8
       max-width: 39

The following is the relevant code I use to setup fonts and symbols:

(defun font-exists-p (font)
  "Comprueba si una tipografía existe. Sacado de https://redd.it/1xe7vr"
  (if (member font (font-family-list))
      t
    nil))

(add-to-list 'default-frame-alist '(font . "Fira Code-11"))
(add-to-list 'initial-frame-alist '(font . "Fira Code-11"))

;; Para NS/Cocoa
(when (eq system-type 'darwin)
  (set-fontset-font t 'unicode (font-spec :family "Apple Color Emoji") nil 'prepend))
;; Para todos los demas sistemas operativos
(when (not (eq system-type 'darwin)))
  (set-fontset-font t 'unicode (font-spec :size 20 :name "Symbola") nil 'prepend))

I have double-checked and installed all fonts from the all-the-icons project and also Symbola, but it seems that Fira Code overrides other fonts, which are not set.

This issue does not occur on GNU/Linux or MacOS.

EDIT:

This is what describe-font output on GNU/Linux where all symbols are displayed correctly:

name (opened by): -CTDB-Fira Code-normal-normal-normal-*-15-*-*-*-m-0-iso10646-1
       full name: Fira Code:pixelsize=15:foundry=CTDB:weight=normal:slant=normal:width=normal:spacing=100:scalable=true
       file name: /home/jorge/.fonts/FiraCode-Medium.ttf
            size: 15
          height: 19
 baseline-offset:  0
relative-compose:  0
  default-ascent:  0
          ascent: 15
         descent:  4
   average-width: 10
     space-width: 10
       max-width: 10

On GNU/Linux -iso10646- is used instead of -iso8859-. This is the setup for character encoding on Emacs:

(prefer-coding-system       'utf-8)
(set-default-coding-systems 'utf-8)
(set-terminal-coding-system 'utf-8)
(set-keyboard-coding-system 'utf-8)
(setq default-buffer-file-coding-system 'utf-8)
(setq x-select-request-type '(UTF8_STRING COMPOUND_TEXT TEXT STRING))

EDIT 2:

I'm using GNU Emacs 25.3.1 (x86_64-w64-mingw32) of 2017-09-17 installed via Emacs Powerpack ( https://gitlab.com/vancan1ty/emacs_powerpack )

  • Not sure how relevant these are, but I notice a couple of potential issues in your code: 1) By the time after-make-frame-functions run, modifying default-frame-alist has no effect, as the corresponding frame has already been created. 2) set-frame-font acts on the currently selected frame, which is not the same frame as the one passed to shackra-font-set by after-make-frame-functions. – Basil Mar 2 '18 at 1:44
  • 1
    FYI: Not answering to @Basil's comment blocks others from even considering your question. If Basil's comment hit the bulls eye than that would be great. He could post his comment as answer, others could save time, and you would have a solution for your problem. – Tobias Mar 3 '18 at 19:47
  • Thing is than all symbols looks as they should on GNU/Linux, thus my guess is that such code works – shackra Mar 3 '18 at 22:06
  • I have updated/corrected the code that setups the fonts on Emacs, the issue still happens. – shackra Apr 4 '18 at 6:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.