syl20bnr / spacemacs

A community-driven Emacs distribution - The best editor is neither Emacs nor Vim, it's Emacs *and* Vim!
http://spacemacs.org
GNU General Public License v3.0
23.64k stars 4.89k forks source link

Spacemacs does not set the font correctly in daemon mode as in #6197 (workaround included - potential clue as to what is causing the problem) #11321

Closed cyruseuros closed 1 month ago

cyruseuros commented 6 years ago

Description :octocat:

Spacemacs does not set the font correctly in daemon mode as in #6197 (workaround included - a potential clue as to what is causing the problem). This only happens when themes-megapack layer is installed - even with the default spacemacs-dark theme.

Reproduction guide :beetle:

Observed behaviour: :eyes: :broken_heart: The wrong font is set in the Emacs server, while Source Code Pro (the right one) is set in the regular Emacs instance.

The issue disappears if I do either of the following:

  1. I remove themes-megapack
  2. I add the following to user-init. My guess is that themes-megapack tries to load the fonts too early, and this later call in user-init corrects for the problem.
    (spacemacs|do-after-display-system-init
    (spacemacs/set-default-font dotspacemacs-default-font))

Expected behaviour: :heart: :smile: Adobe Source Code Pro is set as the font in both the Emacs server and the regular instance.

System Info :computer:

Backtrace :paw_prints:

gdkrmr commented 6 years ago

I have a couple of problems with daemon mode your particular problem can be solved by adding

  (add-to-list 'default-frame-alist
               '(font . "-ADBE-Source Code Pro-normal-normal-normal-*-13-*-*-*-m-0-iso10646-1"))

to dotspacemacs/user-config. You can find the exact font string by SPC SPC set-frame-font. Does SPC SPC work for you in daemon mode?

cyruseuros commented 6 years ago

It does, although there are times when I restart Emacs and it spits out that it can't read from stdout or something (any permanent fix for that?). However I already resolved my issue with the snippet included above. I am only posting so the issue can be resolved upstream. I would do it myself, but I'm still new to elisp, and would rather spend some more time learning before pitching in. Appreciate the help though!

CarlQLange commented 4 years ago

I still get this issue (also when loading from a dump) and the fix outlined in the post works for me:

(spacemacs|do-after-display-system-init
(spacemacs/set-default-font dotspacemacs-default-font))

in my user-init or user-config.

duianto commented 4 years ago

Confirmed, the default OS font loads without the workaround.

Once while testing, the mode line separators weren't shown and the spacemacs buffer menu colors were incorrect, but that hasn't happened again the last three times a new daemon/client was started.

emacs_2020-06-12_11-04-31

System Info (click to expand)
#### System Info :computer:
- OS: windows-nt
- Emacs: 26.3
- Spacemacs: 0.300.0
- Spacemacs branch: develop (rev. 5fcd84d84)
- Graphic display: t
- Distribution: spacemacs
- Editing style: vim
- Completion: helm
- Layers:
```elisp
(autohotkey
 (auto-completion :variables auto-completion-enable-help-tooltip t auto-completion-enable-snippets-in-popup t)
 (colors :variables colors-enable-nyan-cat-progress-bar t)
 emacs-lisp git helm html javascript lsp
 (markdown :variables markdown-live-preview-engine 'vmd markdown-command "vmd")
 multiple-cursors
 (org :variables org-agenda-files
      '("~/org/notes.org"))
 (python :variables)
 ranger
 (shell :variables shell-default-shell 'eshell shell-default-height 30)
 spell-checking
 (syntax-checking :variables syntax-checking-enable-by-default nil)
 themes-megapack treemacs version-control)
```
- System configuration features: XPM JPEG TIFF GIF PNG RSVG SOUND NOTIFY ACL GNUTLS LIBXML2 ZLIB TOOLKIT_SCROLL_BARS THREADS LCMS2

pamrg1 commented 3 years ago

I still get this issue (also when loading from a dump) and the fix outlined in the post works for me:

(spacemacs|do-after-display-system-init
(spacemacs/set-default-font dotspacemacs-default-font))

in my user-init or user-config.

This has been working until my ArchLinux system upgrade today... :'(

derinsh0 commented 2 years ago

This issue is still valid. As far as I know, there are a few ways to set font in an Emacs Spacemacs distro.

The first is obviously by spacemacs-default-font, this doesn’t work with daemon mode, Spacemacs will warn about invalid family, and fontset will include the courier font.

The next is by ignoring spacemacs and setting Default Face in basic-faces, this works just fine with daemon mode. But spacemacs will still complain and courier will be loaded in the fontset.

I’ve also seen adding a font option to default-frame-alist, but this seems inefficient.

What I’ve noticed is that spacemacs-default-font and default-face will look different, even if they load the same font.

lebensterben commented 2 years ago

@psisis

Do you have themes-megapack enabled as well?

This layer doesn't seem to do anything other than declaring those themes. I don't know why it would cause any issue.

github-actions[bot] commented 4 months ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Please let us know if this issue is still valid!