all-the-icons.el icon indicating copy to clipboard operation
all-the-icons.el copied to clipboard

Symbol being rendered from wrong font when face is modified

Open TikhonJelvis opened this issue 4 years ago • 16 comments

Certain symbols are showing up incorrectly when the face is modified with font-lock or as part of my mode-line. I've run into this problem with a few different symbols like the Haskell logo and some of the link symbols (but not the one from the material font):

all-the-icons-font-lock-bug

The behavior is not consistent. When I set up my modeline to render a symbol using all-the-icons-icon-for-buffer, *.el files rendered the Emacs symbol correctly, but my .emacs file didn't.

all-the-icons-weird-modeline

Just for reference, here's the function I used to set the major mode icon:

(defun mode-line/major-mode (face)
  "Display the icon for the major mode of the current buffer."
  (let ((icon (propertize
               (format "%s "(all-the-icons-icon-for-buffer))
               'face `(:inherit ,face :height 1.1)
               'display '(raise -0.1))))
    (powerline-raw icon face 'l)))

I am using version 20200411.520 of this package from Melpa with Emacs 26.3 on Linux. This problem seems to be related to #106, but my version of the package has the changes from that PR, and I don't know what else to try.

TikhonJelvis avatar May 06 '20 05:05 TikhonJelvis

I'm particularly confused by the difference between *.el files and .emacs. I understand that all-the-icons-icon-for-buffer relies on the file name for *.el and on the mode for .emacs, but the settings for the two seem exactly the same:

("\\.el$"           all-the-icons-fileicon "elisp"                  :height 1.0 :v-adjust -0.2 :face all-the-icons-purple)
(emacs-lisp-mode           all-the-icons-fileicon "elisp"              :height 1.0 :v-adjust -0.2 :face all-the-icons-purple)

TikhonJelvis avatar May 06 '20 05:05 TikhonJelvis

I just tried exactly the same Emacs setup on a macbook, and still had one of the symbols render incorrectly:

Screen Shot 2020-05-06 at 9 11 21 AM

On both macOS and Linux, I installed the fonts using M-x all-the-icons-install-fonts.

TikhonJelvis avatar May 06 '20 16:05 TikhonJelvis

I guess I'm having this issue too:

image This is result of using the same call to (insert (all-the-icons-icon-for-file "foo.js" :height 2 :face 'all-the-icons-lred)) outside and inside of source block. If I disable font lock mode: image And call that insert function again: image And enable font-lock-mode back: image And disable it again: image

andreyorst avatar May 07 '20 09:05 andreyorst

@andreyorst that looks like a bug in orgmode.

@TikhonJelvis have you read the readme?

wyuenho avatar May 27 '20 19:05 wyuenho

@wyuenho I looked through the Readme and especially the troubleshooting guide when I was first setting this up. I'm pretty sure that it isn't an installation or caching issue, and I couldn't understand how to apply the suggestions in part 3 of the troubleshooting guide (Emacs configuration) when it seems to be a problem with font-lock overriding something (not sure what) rather than the icons not working in general.

TikhonJelvis avatar May 27 '20 19:05 TikhonJelvis

@wyuenho

@andreyorst that looks like a bug in orgmode.

I don't think so. I tried this in .spacemacs file: image both of them inserted using (insert (all-the-icons-icon-for-file "foo.js" :height 2 :face 'all-the-icons-lred))

Also the "org" symbol displays fine but changes to a circle like symbol when I restart emacs.

hskalin avatar Jul 12 '20 10:07 hskalin

any update on this? I'm experiencing the same font-lock issue

I see that:

  1. in emacs-lisp mode
  • icons are visible in plain text
  • icons are visible in symbols '
  • icons are not visible in strings ""
  1. in org mode
  • icons are visible in plain text outside code blocks #+BEGIN_SRC emcs-lisp
  • icons are not visible in code blocks at all

CastixGitHub avatar Nov 14 '20 21:11 CastixGitHub

I can't reproduce this issue. This package has nothing to do with font-locking whatsoever, but it is possible for external code to change the text properties of certain glyphs.

There are a couple of ways to debug this.

  1. Use font-lock-studio
  2. Use the process of elimination to nail down the exact offending piece of code.

I can't help anyone unless someone provides me with the exact reproduction steps.

wyuenho avatar Jan 06 '21 10:01 wyuenho

I can't help anyone unless someone provides me with the exact reproduction steps.

@wyuenho here: bug.zip Reproduces with emacs -q, and freshly installed all-the-icons fonts. The steps are actually the same as in my previous comment:

  1. Download this repro archive, wich contains minimal repro-init.el and bug.org.
  2. unzip bug.zip; cd bug; emacs -q -l repro-init.el bug.org
  3. Follow the instructions in the bug.org:
    1. insert icon before first <-: screenshot 1
    2. insert icon before second <-: screenshot 2
    3. Note, that the second icon is wrong.
    4. Go to fundamental mode: screenshot 3
    5. Note that the second icon is now correct.
    6. Go to Org mode, second icon is incorrect again. screenshot 4
    7. Optional step, go into python-mode, or perl-mode, or sh-mode and observe the same behavior in comments. Hence this is not a bug in Org mode.

andreyorst avatar Jan 06 '21 12:01 andreyorst

Any updates on this? I'm getting :cheese: instead of the title "T" icon in elisp strings and org source block header faces. image

Arian-D avatar Jan 31 '22 20:01 Arian-D

I have the same issues as @Arian-D on WSL. I don't seem to have the issue on MacOS.

In org-mode, the correct battery icon is only displayed correctly in the normal org-mode text. The wrong icon is displayed in the org source blocks (whether or not it is in a string):

image

In elisp mode, the correct icon is normally correctly displayed, but it shows the wrong icon if I put it in a string (also not sure why this is different from an elisp source block in org-mode):

image

Inspecting the symbol using what-cursor-position:

image

For some reason the fontset is changed in the string... I tried to set use-default-font-for-symbols to nil but it still doesn't work. Anyone know how to fix this?

fast-90 avatar Aug 01 '22 10:08 fast-90

I have the same issue on Emacs 29 but I think I had it with Emacs 28 too. I'm using Pgtk with these GDK settings:

Environment=GDK_DPI_SCALE=0.8
Environment=GDK_SCALE=2

For example the folder icon in dired is wrong. Some icons show wrong in eshell but right in describe variable.

Thaodan avatar Oct 30 '22 21:10 Thaodan

Screenshot_20221030_232429

Thaodan avatar Oct 30 '22 21:10 Thaodan

Same issue without GDK scaling.

Thaodan avatar Oct 30 '22 21:10 Thaodan

emacs seems to pick up some installed fonts that then override the icons:

I had this in M-x describe-fontset RET RET, and I was getting math symbols instead of the icons:

 ..  (#xE000 .. #xF6D8)
    -*-*-*-*-*-*-*-*-*-*-*-*-iso10646-1
	[-UKWN-Iosevka Custom-regular-normal-normal-*-20-*-*-*-d-0-iso10646-1]
	[-UKWN-NewComputerModernSans08-regular-normal-normal-*-20-*-*-*-*-0-iso10646-1]
	[-UKWN-NewComputerModern10-regular-normal-normal-*-20-*-*-*-*-0-iso10646-1]

The "fix" was to remove /etc/fonts/conf.d/09-texlive-fonts.conf, which was a symlink to /usr/share/fontconfig/conf.avail/09-texlive-fonts.conf and is supposed to make some TexLive fonts available to font-config.

real-or-random avatar Nov 26 '23 09:11 real-or-random

I suspected that Computer Modern is used due to the unicode-fonts package, but no: At least for spacemacs users, the reason are probably these lines: https://github.com/syl20bnr/spacemacs/blob/8f7019340ec38c2cd70df37739a0adf77ff1e788/core/core-fonts-support.el#L96-L107

edit: No, commenting these out doesn't change anything... I don't know, something sets these fontsets. I'll stop investigating for now, but spacemacs also contains more calls to set-fontset-font.

real-or-random avatar Nov 26 '23 14:11 real-or-random