Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Symbol being rendered from wrong font when face is modified #207

Open
TikhonJelvis opened this issue May 6, 2020 · 16 comments
Open

Symbol being rendered from wrong font when face is modified #207

TikhonJelvis opened this issue May 6, 2020 · 16 comments

Comments

@TikhonJelvis
Copy link

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
Copy link
Author

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
Copy link
Author

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.

@andreyorst
Copy link

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

@wyuenho
Copy link
Collaborator

wyuenho commented May 27, 2020

@andreyorst that looks like a bug in orgmode.

@TikhonJelvis have you read the readme?

@TikhonJelvis
Copy link
Author

@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.

@hskalin
Copy link

hskalin commented Jul 12, 2020

@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.

@CastixGitHub
Copy link

CastixGitHub commented Nov 14, 2020

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

@wyuenho
Copy link
Collaborator

wyuenho commented Jan 6, 2021

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.

@andreyorst
Copy link

andreyorst commented Jan 6, 2021

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.

@Arian-D
Copy link

Arian-D commented Jan 31, 2022

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

@fast-90
Copy link

fast-90 commented Aug 1, 2022

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?

@Thaodan
Copy link
Contributor

Thaodan commented Oct 30, 2022

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
Copy link
Contributor

Thaodan commented Oct 30, 2022

Screenshot_20221030_232429

@Thaodan
Copy link
Contributor

Thaodan commented Oct 30, 2022

Same issue without GDK scaling.

@real-or-random
Copy link

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
Copy link

real-or-random commented Nov 26, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants