I'm trying to use custom icons from https://materialdesignicons.com/.

(defface mdi-face
  `((t (:family "Material Design Icons")))
  "Face for Material design icons.")

(insert (propertize "\f004" 'face 'mdi-face)))

The font is installed system-wide and is available to Emacs. All I see is a sequence of little squares as if the font wasn't installed.

  • It seems I should escape with the hexadecimal character \xf004. However that specific example gives me a heart instead of a mdi-account. Apr 24 '17 at 20:39
(insert (propertize "\xf004" 'face 'mdi-face)))

I'm not sure if you've resolved the problem or not. FWIW, I ran into what you mentioned as your second problem (characters not showing up correctly in spite of using proper hexadecimal) a while ago. I noticed this when adding material icons to all-the-icons.el:

From https://github.com/domtronn/all-the-icons.el/pull/35 :

Note that at the font package version on Debian (1.4.57) has different unicode mappings that the current version that I have included (3.0.1). Icons may not render correctly if a user has an outdated version of the material design icons font. I haven't checked into when this mapping shifted.

If you have a version incongruent with the documentation you are referring to some characters will render as an unexpected character and some will render as tofu ([]).

  • Thanks for the details. However, I had a completely different problem (a silly one at that). When trying to insert a specific icon from mdi, another completely different icon would show up. I still had an old (set-fontset-font "fontset-default" '(#xf000 . #xffff) "Font Awesome") in effect. Add to that, that the escape was done incorrectly like in the question (missing the x). May 25 '17 at 22:27

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.