domtronn / all-the-icons.el

A utility package to collect various Icon Fonts and propertize them within Emacs.
MIT License
1.45k stars 174 forks source link

Boxes and ? signs displayed instead of icons on Windows with Emacs 25.3.1 #89

Open shackra opened 6 years ago

shackra commented 6 years ago

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))
preetpalS commented 6 years ago

This should not happen. I am using this library without any issues on Windows.

wyuenho commented 6 years ago

Have you installed the fonts?

shackra commented 6 years ago

Yes, I did install them on Windows

preetpalS commented 6 years ago

What version of Emacs are you using on Windows?

For your reference, I am using GNU Emacs 25.2.1 (x86_64-w64-mingw32) of 2017-05-13 (M-x version) installed via msys2 (pacman -S mingw-w64-x86_64-emacs) and have no issues with this library.

shackra commented 6 years ago

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 ) I have reported this problem on Emacs Stackexchange with hopes of getting a clue or a solution, but nothing has happened sadly, I'm going to reproduce the question from Emacs Stackexchange above.

preetpalS commented 6 years ago

@shackra Do you still have problems if you don't use the Fira Code font?

Does it work if you execute the following lines of code in Emacs (this is my font config; it uses system fonts by default on Windows):

(cond
 ((and (find-font (font-spec :name "Consolas")) (not (init-os-macOS-p)))
  (set-face-attribute 'default nil :font "Consolas-12:antialias=natural"))
 ((find-font (font-spec :name "Menlo"))
  (set-face-attribute 'default nil :font "Menlo-12:antialias=natural"))
 ((find-font (font-spec :name "DejaVu Sans Mono"))
  (set-face-attribute 'default nil :font "DejaVu Sans Mono-12:antialias=natural")))
(when (and (functionp 'set-fontset-font)
           (find-font (font-spec :name "DejaVu Sans Mono-11:antialias=natural")))
  (set-fontset-font "fontset-default" 'unicode
                    (font-spec :family "DejaVu Sans Mono")))
(when (and (functionp 'set-fontset-font)
           (find-font (font-spec :name "Segoe UI Emoji-11:antialias=natural")))
  (set-fontset-font "fontset-default" 'unicode
                    (font-spec :family "Segoe UI Emoji")))

Try installing Emacs directly using msys2 if none of the above works for you.

preetpalS commented 6 years ago

Also make sure you are able to see the fonts you installed for all-the-icons in the fonts selection menu (Options -> Set Default Font...).

shackra commented 6 years ago

With:

(dolist (font (font-family-list))
  (insert (format ";; %s\n" font)))

I report the following installed fonts, all-the-icons font is almost at the end of the list:

;; System
;; Terminal
;; Fixedsys
;; Modern
;; Roman
;; Script
;; Courier
;; MS Serif
;; MS Sans Serif
;; Small Fonts
;; Fira Sans Condensed
;; Fira Sans Condensed Book
;; Fira Sans Condensed Eight
;; Fira Sans Condensed ExtraBold
;; Fira Sans Condensed ExtraLight
;; Fira Sans Condensed Four
;; Fira Sans Condensed Hair
;; Fira Sans Condensed Heavy
;; Fira Sans Condensed Light
;; Fira Sans Condensed Medium
;; Fira Sans Condensed SemiBold
;; Fira Sans Condensed Thin
;; Fira Sans Condensed Two
;; Fira Sans Condensed Ultra
;; Fira Sans Condensed UltraLight
;; Fira Mono
;; Fira Mono Medium
;; Nachlieli CLM
;; Frank Ruhl Hofshi
;; Miriam Libre
;; Marlett
;; Arial
;; Arial Black
;; Bahnschrift Light
;; Bahnschrift SemiLight
;; Bahnschrift
;; Bahnschrift SemiBold
;; Calibri
;; Calibri Light
;; Cambria
;; Cambria Math
;; Candara
;; Comic Sans MS
;; Consolas
;; Constantia
;; Corbel
;; Courier New
;; Ebrima
;; Franklin Gothic Medium
;; Gabriola
;; Gadugi
;; Georgia
;; Impact
;; Javanese Text
;; Leelawadee UI
;; Leelawadee UI Semilight
;; Lucida Console
;; Lucida Sans Unicode
;; Malgun Gothic
;; Malgun Gothic Semilight
;; Microsoft Himalaya
;; Microsoft JhengHei
;; Microsoft JhengHei UI
;; Microsoft JhengHei Light
;; Microsoft JhengHei UI Light
;; Microsoft New Tai Lue
;; Microsoft PhagsPa
;; Microsoft Sans Serif
;; Microsoft Tai Le
;; Microsoft YaHei
;; Microsoft YaHei UI
;; Microsoft YaHei Light
;; Microsoft YaHei UI Light
;; Microsoft Yi Baiti
;; MingLiU-ExtB
;; PMingLiU-ExtB
;; MingLiU_HKSCS-ExtB
;; Mongolian Baiti
;; MS Gothic
;; MS UI Gothic
;; MS PGothic
;; MV Boli
;; Myanmar Text
;; Nirmala UI
;; Nirmala UI Semilight
;; Palatino Linotype
;; Segoe MDL2 Assets
;; Segoe Print
;; Segoe Script
;; Segoe UI
;; Segoe UI Black
;; Segoe UI Emoji
;; Segoe UI Historic
;; Segoe UI Light
;; Segoe UI Semibold
;; Segoe UI Semilight
;; Segoe UI Symbol
;; SimSun
;; NSimSun
;; SimSun-ExtB
;; Sitka Small
;; Sitka Text
;; Sitka Subheading
;; Sitka Heading
;; Sitka Display
;; Sitka Banner
;; Sylfaen
;; Symbol
;; Tahoma
;; Times New Roman
;; Trebuchet MS
;; Verdana
;; Webdings
;; Wingdings
;; Yu Gothic
;; Yu Gothic UI
;; Yu Gothic UI Semibold
;; Yu Gothic Light
;; Yu Gothic UI Light
;; Yu Gothic Medium
;; Yu Gothic UI Semilight
;; HoloLens MDL2 Assets
;; Permanent Marker
;; Fira Sans UltraLight
;; Fira Sans
;; Fira Sans Book
;; Fira Sans Eight
;; Fira Sans ExtraBold
;; Fira Sans ExtraLight
;; Fira Sans Four
;; Fira Sans Hair
;; Fira Sans Heavy
;; Fira Sans Light
;; Fira Sans Medium
;; Fira Sans SemiBold
;; Fira Sans Thin
;; Fira Sans Two
;; Fira Sans Ultra
;; Symbola
;; Avara
;; Jellee Roman
;; Caladea
;; Amiri
;; Gentium Basic
;; Linux Biolinum G
;; Scheherazade
;; OpenSymbol
;; KacstBook
;; Liberation Mono
;; Liberation Sans Narrow
;; David Libre
;; Alef
;; Carlito
;; Noto Kufi Arabic
;; DejaVu Math TeX Gyre
;; Reem Kufi Regular
;; David CLM
;; Source Sans Pro Black
;; EmojiOne Color
;; Source Code Pro Black
;; Amiri Quran
;; Frank Ruehl CLM
;; Miriam CLM
;; Miriam Mono CLM
;; DejaVu Sans
;; DejaVu Sans Light
;; DejaVu Sans Condensed
;; DejaVu Sans Mono
;; DejaVu Serif
;; DejaVu Serif Condensed
;; Gentium Book Basic
;; KacstOffice
;; Liberation Sans
;; Liberation Serif
;; Linux Libertine Display G
;; Linux Libertine G
;; Rubik
;; Noto Mono
;; Noto Naskh Arabic
;; Noto Naskh Arabic UI
;; Noto Sans
;; Noto Sans Cond
;; Noto Sans Light
;; Noto Sans Arabic
;; Noto Sans Arabic UI
;; Noto Sans Armenian
;; Noto Sans Georgian
;; Noto Sans Hebrew
;; Noto Sans Lao
;; Noto Sans Lisu
;; Noto Serif
;; Noto Serif Cond
;; Noto Serif Light
;; Noto Serif Armenian
;; Noto Serif Georgian
;; Noto Serif Hebrew
;; Noto Serif Lao
;; Source Code Pro
;; Source Code Pro ExtraLight
;; Source Code Pro Light
;; Source Code Pro Medium
;; Source Code Pro Semibold
;; Source Sans Pro
;; Source Sans Pro ExtraLight
;; Source Sans Pro Light
;; Source Sans Pro Semibold
;; COUTURE
;; Fira Code Retina
;; Fira Code Light
;; Fira Code Medium
;; Fira Code
;; Weather Icons
;; all-the-icons
;; file-icons
;; FontAwesome
;; Material Icons
;; github-octicons
shackra commented 6 years ago

Setting the font with:

(set-face-attribute 'default nil :font "Source Code Pro-12:antialias=natural")

The issue is still there:

imagen

preetpalS commented 6 years ago

Try executing the following Emacs Lisp interactively (it works for me):

(insert (all-the-icons-wicon "tornado"))
shackra commented 6 years ago

Using emacs from MSYS2, installed just as you installed it on your machine improves the font display but the issue remains with all-the-icons

imagen

The following is the list of fonts detected from MSYS2's emacs:

;; System
;; Terminal
;; Fixedsys
;; Modern
;; Roman
;; Script
;; Courier
;; MS Serif
;; MS Sans Serif
;; Small Fonts
;; Fira Sans Condensed
;; Fira Sans Condensed Book
;; Fira Sans Condensed Eight
;; Fira Sans Condensed ExtraBold
;; Fira Sans Condensed ExtraLight
;; Fira Sans Condensed Four
;; Fira Sans Condensed Hair
;; Fira Sans Condensed Heavy
;; Fira Sans Condensed Light
;; Fira Sans Condensed Medium
;; Fira Sans Condensed SemiBold
;; Fira Sans Condensed Thin
;; Fira Sans Condensed Two
;; Fira Sans Condensed Ultra
;; Fira Sans Condensed UltraLight
;; Fira Mono
;; Fira Mono Medium
;; Nachlieli CLM
;; Frank Ruhl Hofshi
;; Miriam Libre
;; Marlett
;; Arial
;; Arial Black
;; Bahnschrift Light
;; Bahnschrift SemiLight
;; Bahnschrift
;; Bahnschrift SemiBold
;; Calibri
;; Calibri Light
;; Cambria
;; Cambria Math
;; Candara
;; Comic Sans MS
;; Consolas
;; Constantia
;; Corbel
;; Courier New
;; Ebrima
;; Franklin Gothic Medium
;; Gabriola
;; Gadugi
;; Georgia
;; Impact
;; Javanese Text
;; Leelawadee UI
;; Leelawadee UI Semilight
;; Lucida Console
;; Lucida Sans Unicode
;; Malgun Gothic
;; Malgun Gothic Semilight
;; Microsoft Himalaya
;; Microsoft JhengHei
;; Microsoft JhengHei UI
;; Microsoft JhengHei Light
;; Microsoft JhengHei UI Light
;; Microsoft New Tai Lue
;; Microsoft PhagsPa
;; Microsoft Sans Serif
;; Microsoft Tai Le
;; Microsoft YaHei
;; Microsoft YaHei UI
;; Microsoft YaHei Light
;; Microsoft YaHei UI Light
;; Microsoft Yi Baiti
;; MingLiU-ExtB
;; PMingLiU-ExtB
;; MingLiU_HKSCS-ExtB
;; Mongolian Baiti
;; MS Gothic
;; MS UI Gothic
;; MS PGothic
;; MV Boli
;; Myanmar Text
;; Nirmala UI
;; Nirmala UI Semilight
;; Palatino Linotype
;; Segoe MDL2 Assets
;; Segoe Print
;; Segoe Script
;; Segoe UI
;; Segoe UI Black
;; Segoe UI Emoji
;; Segoe UI Historic
;; Segoe UI Light
;; Segoe UI Semibold
;; Segoe UI Semilight
;; Segoe UI Symbol
;; SimSun
;; NSimSun
;; SimSun-ExtB
;; Sitka Small
;; Sitka Text
;; Sitka Subheading
;; Sitka Heading
;; Sitka Display
;; Sitka Banner
;; Sylfaen
;; Symbol
;; Tahoma
;; Times New Roman
;; Trebuchet MS
;; Verdana
;; Webdings
;; Wingdings
;; Yu Gothic
;; Yu Gothic UI
;; Yu Gothic UI Semibold
;; Yu Gothic Light
;; Yu Gothic UI Light
;; Yu Gothic Medium
;; Yu Gothic UI Semilight
;; HoloLens MDL2 Assets
;; Permanent Marker
;; Fira Sans UltraLight
;; Fira Sans
;; Fira Sans Book
;; Fira Sans Eight
;; Fira Sans ExtraBold
;; Fira Sans ExtraLight
;; Fira Sans Four
;; Fira Sans Hair
;; Fira Sans Heavy
;; Fira Sans Light
;; Fira Sans Medium
;; Fira Sans SemiBold
;; Fira Sans Thin
;; Fira Sans Two
;; Fira Sans Ultra
;; Symbola
;; Avara
;; Jellee Roman
;; Caladea
;; Amiri
;; Gentium Basic
;; Linux Biolinum G
;; Scheherazade
;; OpenSymbol
;; KacstBook
;; Liberation Mono
;; Liberation Sans Narrow
;; David Libre
;; Alef
;; Carlito
;; Noto Kufi Arabic
;; DejaVu Math TeX Gyre
;; Reem Kufi Regular
;; David CLM
;; Source Sans Pro Black
;; EmojiOne Color
;; Source Code Pro Black
;; Amiri Quran
;; Frank Ruehl CLM
;; Miriam CLM
;; Miriam Mono CLM
;; DejaVu Sans
;; DejaVu Sans Light
;; DejaVu Sans Condensed
;; DejaVu Sans Mono
;; DejaVu Serif
;; DejaVu Serif Condensed
;; Gentium Book Basic
;; KacstOffice
;; Liberation Sans
;; Liberation Serif
;; Linux Libertine Display G
;; Linux Libertine G
;; Rubik
;; Noto Mono
;; Noto Naskh Arabic
;; Noto Naskh Arabic UI
;; Noto Sans
;; Noto Sans Cond
;; Noto Sans Light
;; Noto Sans Arabic
;; Noto Sans Arabic UI
;; Noto Sans Armenian
;; Noto Sans Georgian
;; Noto Sans Hebrew
;; Noto Sans Lao
;; Noto Sans Lisu
;; Noto Serif
;; Noto Serif Cond
;; Noto Serif Light
;; Noto Serif Armenian
;; Noto Serif Georgian
;; Noto Serif Hebrew
;; Noto Serif Lao
;; Source Code Pro
;; Source Code Pro ExtraLight
;; Source Code Pro Light
;; Source Code Pro Medium
;; Source Code Pro Semibold
;; Source Sans Pro
;; Source Sans Pro ExtraLight
;; Source Sans Pro Light
;; Source Sans Pro Semibold
;; COUTURE
;; Fira Code Retina
;; Fira Code Light
;; Fira Code Medium
;; Fira Code
;; Weather Icons
;; all-the-icons
;; file-icons
;; FontAwesome
;; Material Icons
;; github-octicons
;; Fira Sans Condensed
;; Fira Sans Condensed Book
;; Fira Sans Condensed Eight
;; Fira Sans Condensed ExtraBold
;; Fira Sans Condensed ExtraLight
;; Fira Sans Condensed Four
;; Fira Sans Condensed Hair
;; Fira Sans Condensed Heavy
;; Fira Sans Condensed Light
;; Fira Sans Condensed Medium
;; Fira Sans Condensed SemiBold
;; Fira Sans Condensed Thin
;; Fira Sans Condensed Two
;; Fira Sans Condensed Ultra
;; Fira Sans Condensed UltraLight
;; Fira Mono
;; Fira Mono Medium
;; Frank Ruhl Hofshi
;; Miriam Libre
;; Arial
;; Arial Black
;; Bahnschrift Light
;; Bahnschrift SemiLight
;; Bahnschrift
;; Bahnschrift SemiBold
;; Calibri
;; Calibri Light
;; Cambria
;; Cambria Math
;; Candara
;; Comic Sans MS
;; Consolas
;; Constantia
;; Corbel
;; Courier New
;; Ebrima
;; Franklin Gothic Medium
;; Gabriola
;; Gadugi
;; Georgia
;; Impact
;; Javanese Text
;; Leelawadee UI
;; Leelawadee UI Semilight
;; Lucida Console
;; Lucida Sans Unicode
;; Malgun Gothic
;; Malgun Gothic Semilight
;; Microsoft Himalaya
;; Microsoft JhengHei
;; Microsoft JhengHei UI
;; Microsoft JhengHei Light
;; Microsoft JhengHei UI Light
;; Microsoft New Tai Lue
;; Microsoft PhagsPa
;; Microsoft Sans Serif
;; Microsoft Tai Le
;; Microsoft YaHei
;; Microsoft YaHei UI
;; Microsoft YaHei Light
;; Microsoft YaHei UI Light
;; Microsoft Yi Baiti
;; MingLiU-ExtB
;; PMingLiU-ExtB
;; MingLiU_HKSCS-ExtB
;; Mongolian Baiti
;; MS Gothic
;; MS UI Gothic
;; MS PGothic
;; MV Boli
;; Myanmar Text
;; Nirmala UI
;; Nirmala UI Semilight
;; Palatino Linotype
;; Segoe MDL2 Assets
;; Segoe Print
;; Segoe Script
;; Segoe UI
;; Segoe UI Black
;; Segoe UI Emoji
;; Segoe UI Historic
;; Segoe UI Light
;; Segoe UI Semibold
;; Segoe UI Semilight
;; Segoe UI Symbol
;; SimSun
;; NSimSun
;; SimSun-ExtB
;; Sitka Small
;; Sitka Text
;; Sitka Subheading
;; Sitka Heading
;; Sitka Display
;; Sitka Banner
;; Sylfaen
;; Tahoma
;; Times New Roman
;; Trebuchet MS
;; Verdana
;; Yu Gothic
;; Yu Gothic UI
;; Yu Gothic UI Semibold
;; Yu Gothic Light
;; Yu Gothic UI Light
;; Yu Gothic Medium
;; Yu Gothic UI Semilight
;; HoloLens MDL2 Assets
;; Permanent Marker
;; Fira Sans UltraLight
;; Fira Sans
;; Fira Sans Book
;; Fira Sans Eight
;; Fira Sans ExtraBold
;; Fira Sans ExtraLight
;; Fira Sans Four
;; Fira Sans Hair
;; Fira Sans Heavy
;; Fira Sans Light
;; Fira Sans Medium
;; Fira Sans SemiBold
;; Fira Sans Thin
;; Fira Sans Two
;; Fira Sans Ultra
;; Symbola
;; Avara
;; Jellee Roman
;; Caladea
;; Amiri
;; Gentium Basic
;; Linux Biolinum G
;; Scheherazade
;; OpenSymbol
;; Liberation Mono
;; Liberation Sans Narrow
;; David Libre
;; Alef
;; Carlito
;; Noto Kufi Arabic
;; DejaVu Math TeX Gyre
;; Source Sans Pro Black
;; EmojiOne Color
;; Source Code Pro Black
;; DejaVu Sans
;; DejaVu Sans Light
;; DejaVu Sans Condensed
;; DejaVu Sans Mono
;; DejaVu Serif
;; DejaVu Serif Condensed
;; Gentium Book Basic
;; Liberation Sans
;; Liberation Serif
;; Linux Libertine Display G
;; Linux Libertine G
;; Rubik
;; Noto Mono
;; Noto Naskh Arabic
;; Noto Naskh Arabic UI
;; Noto Sans Georgian
;; Noto Sans Lao
;; Noto Sans Lisu
;; Noto Serif Georgian
;; Noto Serif Lao
;; Source Code Pro
;; Source Code Pro ExtraLight
;; Source Code Pro Light
;; Source Code Pro Medium
;; Source Code Pro Semibold
;; Source Sans Pro
;; Source Sans Pro ExtraLight
;; Source Sans Pro Light
;; Source Sans Pro Semibold
;; COUTURE
;; Fira Code Retina
;; Fira Code Light
;; Fira Code Medium
;; Fira Code
;; all-the-icons
;; file-icons
;; Material Icons
preetpalS commented 6 years ago

I am not to sure what's going on, but I would recommend disabling your configuration emacs --no-init, and then manually requiring the all-the-icons library and trying the interactive insert again in the scratch buffer. Right now I am using a preview version of Emacs that I compiled using msys2 (mingw64) but I had this working on the pre-compiled mingw64 emacs version available from msys2 (as mentioned earlier). Also what version of Windows are you using (I am using Windows 10 for your reference). I attached a screenshot to show that it does work on Windows.

emacs all the icons capture

shackra commented 6 years ago

In the following screenshot, the font display got improvements by using MSYS2's Emacs

imagen

Basically, Symbola is correctly set:

imagen

But something like:

(insert (propertize
         (format " %s" (all-the-icons-faicon "pencil")) 'face
         '(:height 1.3 :family (all-the-icons-faicon-family))
         'display '(raise -0.1) 'help-echo "Buffer modificado.")).")

Outputs an incorrectly displayed glyph:

imagen

             position: 211 of 211 (100%), column: 66
            character:  (displayed as ) (codepoint 61504, #o170100, #xf040)
    preferred charset: unicode (Unicode (ISO10646))
code point in charset: 0xF040
               syntax: w    which means: word
             category: L:Left-to-right (strong)
             to input: type "C-x 8 RET f040"
          buffer code: #xEF #x81 #x80
            file code: #xEF #x81 #x80 (encoded by coding system utf-8)
              display: no font available

Character code properties: customize what to show
  general-category: Co (Other, Private Use)
  decomposition: (61504) ('')

There are text properties here:
  display              (raise -0.1)
  face                 font-lock-warning-face
  font-lock-ignore     t
  fontified            t
  help-echo            "Hidden behind deeper element; move to another line?"
  rear-nonsticky       t
  ws-butler-chg        chg

[back]
wyuenho commented 5 years ago

I suspect Symbola is messing with your fontset since it's a universal fallback font. I've just updated the README. Can you diagnose the problem according to this troubleshooting guide? Let me know if you still can't solve this problem.