#StackBounty: #microsoft-windows #fonts Symbols display on Windows

Bounty: 200

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."
  (find-font (font-spec :name font)))

(defun shackra-arregla-emojis (&optional frame)
  "Arregla la visualizacion de los emojis."
  (if (eq system-type 'darwin)
      ;; Para NS/Cocoa
      (set-fontset-font t 'symbol (font-spec :family "Apple Color Emoji")
                        frame 'prepend)
    ;; Para todos los demas sistemas operativos
    (when (font-exists-p "Symbola")
      (set-fontset-font t 'symbol (font-spec :size 20 :name "Symbola")
                        frame 'prepend))))

(defun shackra-font-set (&optional frame)
  "Establece una tipografia para el nuevo marco creado."
   ((font-exists-p "Fira Code")
    (set-frame-font "Fira Code 10")
    (add-to-list 'default-frame-alist '(font . "Fira Code-10")))
   ((font-exists-p "Monoisome")
    (set-frame-font "Monoisome 9")
    (add-to-list 'default-frame-alist '(font . "Monoisome-9")))
   ((font-exists-p "Monoid")
    (set-frame-font "Monoid 9")
    (add-to-list 'default-frame-alist '(font . "Monoid-9")))
   ((font-exists-p "Source Code Pro")
    (set-frame-font "Source Code Pro 10")
    (add-to-list 'default-frame-alist '(font . "Source Code Pro-10")))))

(add-hook 'after-make-frame-functions #'shackra-arregla-emojis)
(add-hook 'after-make-frame-functions #'shackra-font-set)

(unless (daemonp)
  (shackra-arregla-emojis (selected-frame))
  (shackra-font-set (selected-frame)))

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.

Get this bounty!!!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.