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

Font changes in dotspacemacs-default-font not getting applied (OS X) (Workaround in comments) #3477

Closed
calebmeyer opened this issue Oct 19, 2015 · 47 comments

Comments

@calebmeyer
Copy link

Emacs Version: GNU Emacs 24.5.1 (x86_64-apple-darwin14.5.0, Carbon Version 157 AppKit 1348.17)
.spacemacs file: https://github.com/calebmeyer/dotfiles/blob/master/spacemacs
messages buffer after launch: https://gist.github.com/calebmeyer/28630f6695723f430f7b

default font

Let me know if you need any more information to debug this. I love spacemacs, and I really want to use it as my default. I have checked, I do have Source Code Pro installed.

@syl20bnr
Copy link
Owner

I cannot see Source Code Pro on your screenshot but I trust you that you have it installed :-)
Honestly I have no idea why it does not work, what does SPC h d c on a character output ?

@calebmeyer
Copy link
Author

I'll tell you in 1000 words

spc h d c

@d12frosted
Copy link
Contributor

I am probably blind, but... are you in terminal or gui? 😄

@calebmeyer
Copy link
Author

I'm in the gui, @d12frosted. Terminal emacs respects my terminal settings (inconsolata-g for powerline, 14pt)

@d12frosted
Copy link
Contributor

Ah sorry, @calebmeyer. I am blind indeed 😄

Terminal emacs respects my terminal settings

Yeah, this is exactly why I asked about terminal vs GUI - cause terminal emacs respects only terminal settings.

@calebmeyer
Copy link
Author

No problem. I appreciate your help. Emacs so far is a series of small frustrations, alongside a series of big wins. The layer concept is a fantastic way of pulling together packages and good defaults.

@StreakyCobra
Copy link
Contributor

What does SPC : describe-font RET give you for Source Code Pro? If you try manually to call SPC : set-frame-font to Source Code Pro, does it work?

I also noticed you have an old .spacemacs:

(Spacemacs) Warning: `dotspacemacs/config' is deprecated, please rename your function to `dotspacemacs/user-config'

Maybe try to update it (hint: SPC f e D).

@calebmeyer
Copy link
Author

Updated my .spacemacs file.

Output of describe-font:

name (opened by): -*-Monaco-normal-normal-normal-*-12-*-*-*-m-0-iso10646-1
       full name: Monaco:pixelsize=12:weight=normal:slant=normal:width=normal:spacing=100:scalable=true
            size: 12
          height: 16
 baseline-offset:  0
relative-compose:  0

Yes, calling set frame font to source code pro switched the font. It kept the size at 12 though.

@calebmeyer
Copy link
Author

Per conversation on the gitter chat, I uninstalled and reinstalled emacs-mac via this sequence of commands:

brew uninstall emacs
brew uninstall emacs-mac
brew tap railwaycat/emacsmacport
brew install emacs-mac --with-spacemacs-icon

This didn't solve the issue , and I still don't have the beautiful spacemacs icon.

Turns out I do have the nice icon, but Mac OS X doesn't reflect it only in the applications drawer on the dock. The finder and the actual opened application both have the pretty icon.

@calebmeyer
Copy link
Author

I was able to work around the official settings via this code in my user-config:

  (set-face-attribute 'default nil :family "Source Code Pro")
  (set-face-attribute 'default nil :height 165)

which I found here: http://emacswiki.org/emacs/SetFonts

@kostajh
Copy link
Contributor

kostajh commented Oct 31, 2015

Same problem for me, same diagnostics (except I'm on Fedora 22), on the latest stable Spacemacs release. Workaround posted by @calebmeyer works for me -- except that if I use SPC T n to switch themes, the original Spacemacs Source Code Pro / 13 pt font combo is restored.

@nixmaniack
Copy link
Contributor

Not sure if it's related, but setting up font using dotspacemacs-default-font had some quirks.
Following went in my user-config some time back.

(when (display-graphic-p)
    (set-face-attribute 'default nil :font "Input Mono Condensed-13" :weight 'ultralight))

@kostajh
Copy link
Contributor

kostajh commented Nov 24, 2015

For me anyway, this issue is fixed in develop.

@calebmeyer
Copy link
Author

I am on develop (0.105.4) and can confirm that this is not fixed. Without the workaround mentioned above staying in my user-config, I still get monaco.

I am able to set the font without the hack on a ubuntu vm, so this appears to be a mac related issue.

@calebmeyer
Copy link
Author

So, I figured I'd look through the code for spacemacs to see if I could do some more debugging myself. I made this change:

diff --git a/core/core-fonts-support.el b/core/core-fonts-support.el
index 5f9b07b..c16375d 100644
--- a/core/core-fonts-support.el
+++ b/core/core-fonts-support.el
@@ -27,6 +27,7 @@ PLIST has the form (\"fontname\" :prop1 val1 :prop2 val2 ...)"
                       :powerline-offset))
          (fontspec (apply 'font-spec :name font font-props)))
     (spacemacs-buffer/message "Setting font \"%s\"..." font)
+    (spacemacs-buffer/warning "Setting fontspec \"%s\"..." fontspec)
     (set-frame-font fontspec nil t)
     (setq-default powerline-scale scale)
     (setq-default powerline-height (spacemacs/compute-powerline-height))
(END)

And just logging out the font spec to my messages buffer has fixed the bug. I verified by unmaking the change, it went back to monaco.

It logs this:
(Spacemacs) Warning: Setting fontspec "#<font-spec nil nil Source Code Pro nil nil normal nil normal 16 nil nil nil ((:name . Source Code Pro))>"...

#heisenbug?

@jalehman
Copy link

I ran into this issue as well, and the above fix by @calebmeyer fixed the issue for me as well. Running OS X 10.11.2, Spacemacs 0.105.9, emacs 24.5.1 installed as per instructions here.

@lehoff
Copy link

lehoff commented Feb 26, 2016

Same issue here. @calebmeyer's solution did the trick for me.

@calebmeyer calebmeyer changed the title Font changes in dotspacemacs-default-font not getting applied (OS X) Font changes in dotspacemacs-default-font not getting applied (OS X) (Workaround in comments) Mar 21, 2016
@strickinato
Copy link

Confirmed worked for me-

  (set-face-attribute 'default nil :family "Source Code Pro")
  (set-face-attribute 'default nil :height 165)

@brettbates
Copy link

FYI: seems osx does not have "source code pro" installed by default, you can pick it up here:

https://github.com/adobe-fonts/source-code-pro

This solved the issue for me. Could be helpful to have an error show up if it doesn't exist?

@calebmeyer
Copy link
Author

Could be even more helpful if we could somehow distribute source code pro with spacemacs. It's licensed under the SIL open font license which the FSF says is kosher.

Might be a nightmare to get fonts installed cross platform though.

@Q-Tran
Copy link

Q-Tran commented Apr 22, 2016

My problem was that I was loading a saved desktop after loading the changes to the font, making the previous desktop's font appear.

remember to reload your desktop!

@d12frosted
Copy link
Contributor

Could be even more helpful if we could somehow distribute source code pro with spacemacs.

There is no need to distribute Source Code Pro. I just realised that there is no mention of Source Code Pro in installation guide inside of README file. This is what we should do - post a link to Source Code Pro download page.

@ajimu
Copy link

ajimu commented May 1, 2016

I've been playing around with this on Arch Linux. After making the change mentioned by @calebmeyer, the first emacsclient instance uses the correct font, but future instances don't

@StreakyCobra
Copy link
Contributor

@ajimu Can you try the develop branch without any tweak for the font, i.e. just customizing dotspacemacs-default-font? The first emacsclient having a different font than subsequent clients should have been fixed there. I'm not sure about what you are saying because the first frame was the wrong font and subsequens were using the right font, so maybe it's not the font you are expecting.

@ajimu
Copy link

ajimu commented May 3, 2016

@StreakyCobra thanks, it is fixed on develop. I was actually using the same font but different sizes and I just got them confused. Bad info on my part.

@StreakyCobra
Copy link
Contributor

@calebmeyer Can you also try last develop without other hack, just dotspacemacs-default-font? The change for user in daemon mode could also have solved this one.

@calebmeyer
Copy link
Author

screen shot 2016-05-03 at 8 16 24 am

Alas, still not fixed for me on develop. I am on El Capitan (OS X 10.11) now, but still seeing menlo instead of Source Code Pro unless I manually set it.

@StreakyCobra
Copy link
Contributor

Ok :-(

@ajimu
Copy link

ajimu commented May 11, 2016

If I make changes that result in having (custom-set-faces ...) in my ~/.spacemacs, my font goes back to being too small

@glimmercn
Copy link

my system is ubuntu 15.4, emacs 24.5, spacemacs develop.

even @calebmeyer 's tweak can't help me.

@danielwuz
Copy link
Contributor

danielwuz commented Sep 19, 2016

I had the same problem on Mac with 24.5. I was able to fix it by resetting custom-set-variables back to default.

(custom-set-variables
 ;; custom-set-variables was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.)
 )

@marcoslhc
Copy link

marcoslhc commented Feb 25, 2017

Before doing something crazy with your .spacemacs make sure you have the font installed in /Library/Fonts not ~/Library/Fonts or force Emacs to search for the fonts also in ~/Library/Fonts
You can install fonts in the global Fonts folder with brew cask by doing

$ brew tap caskroom/fonts
$ brew cask install font-source-code-pro --fontdir=/Library/Fonts

@iesahin
Copy link

iesahin commented May 7, 2017

Can this be related with dotspacemacs-themes ?

Yesterday I set it to

   dotspacemacs-themes (append
                         (cookie-shuffle-vector
                          [adwaita
                           alect-dark-alt
                           ample
                           ample-zen
                           apropospriate-dark
                           apropospriate-light
                           badwolf
                           birds-of-paradise-plus
                           cherry-blossom
                           colorsarenice-light
                           darkburn
                           dichromacy
                           minimal-light
                           farmhouse-dark
                           espresso
                           flatland
                           gandalf
                           hemisu-dark
                           hemisu-light
                           inkpot
                           leuven
                           junio
                           material-light
                           minimal
                           mccarthy
                           spacemacs-dark
                           misterioso
                           naquadah
                           noctilux
                           occidental
                           pastels-on-dark
                           reverse
                           purple-haze
                           sanityinc-tomorrow-bright
                           soft-morning
                           spolsky
                           subatomic
                           tango
                           tango-2
                           tango-dark
                           tango-plus
                           tao-yang
                           tao-yin
                           toxi
                           tsdh-light
                           wheatgrass
                           wombat
                           wilson
                           whiteboard
                           zen-and-art
                           zenburn
                           spacemacs-light]) nil)

and it didn't read the font settings. (It was only increasing the font size to 30.) I checked out develop (afcef9e) to no avail. But then I changed the above setting to

 dotspacemacs-themes '(spacemacs-light
                         spacemacs-dark
                         leuven
                         wombat
                         monokai
                         solarized-light)

and it's resolved both in develop and master (8e1af14) now.

This is on Ubuntu 17.04 with Emacs 24.5.1, on Turkish language locale. This is my third day in Spacemacs, so I'm not fully equipped to dig in but one of the themes seems to be misbehaving.

@vegertar
Copy link

I'm in windows 10 with spacemacs 0.200.9@25.2.1 , this issue is fixed by user-config mentioned by @calebmeyer.

@jb55
Copy link
Contributor

jb55 commented Jul 26, 2017

I fixed this by deleting:

'(default ((t (:background nil)))

from custom-set-faces

¯\_(ツ)_/¯

@wiskey5alpha
Copy link

I fixed this by deleting:
'(default ((t (:background nil)))
from custom-set-faces

Fixed this for me, windows 10 spacemacs 0.200.9@25.2.1

@CarstenKoenig
Copy link

@jb55 solution fixed the issue for me too (on Linux Mint - 0.200.9@25.3.2 (spacemacs) )
thank you

@well1791
Copy link

Thanks @jb55, your solution worked for me! 👏

  • macOS High Sierra 10.13.3
  • Emacs 25.3.1

@non-Jedi
Copy link
Contributor

I was having an issue similar to this one today, but it seems to have been caused by the themes-megapack layer. Went back to behaving as expected when that layer was removed.

@jerome-diver
Copy link

april 2019 .... 4 years after, same problem.... just use a font is a mess.

@rdbeni0
Copy link

rdbeni0 commented Apr 28, 2019

@jerome-diver
yes, in develop i have also problem
but i can confirm that this is working as expected:

(set-face-attribute 'default nil :family "Source Code Pro")
(set-face-attribute 'default nil :height 165)

(you can manipulate height and font type here)

@lukad
Copy link

lukad commented Jul 24, 2019

This is still broken on a fresh spacemacs install on GNU Emacs 26.2 + macOS 10.14.5.

Edit: looks like my installation of Source Code Pro was broken. Setting the font size works fine after reinstalling it.

@pavloo
Copy link

pavloo commented Sep 27, 2019

Had the same problem on latest develop. What helped me was I switched back to master branch, launched Emacs, then switched back to develop branch and restarted it - it began to respect font settings in .spacemacs after all this gymnastics.

@torfjelde
Copy link

I'm currently trying out spacemacs and ran into the same issue as described here.

Spacemacs would not respect dotspacemacs-default-font, but instead fall back to using the font I used for my previous Emacs configuration (which I've moved to ~/.emacs.d.bak).

So somehow it's being overwritten by my Emacs config located in ~/.emacs.d.bak? I dunno; it's very weird to me.

@tigerjack
Copy link

tigerjack commented Nov 5, 2020

For me, the problem was in custom-set-variable, where I had

 '(ispell-program-name "/usr/bin/hunspell")

Deleting this line fixed the issue.

To note that the same configuration was working (in the sense of the font size) on the master branch.

EDIT: just saw that this was for OSX. I had the same problem with ArchLinux.

@alexandergogl
Copy link

Thanks @jb55, your solution worked for me too! 👏

macOS Mojave 10.14.6
Emacs 28.0.5
Spacemacs v.0.300.0 dev branch

@lebensterben
Copy link
Contributor

Closing since this doesn't seem to be a Spacemacs bug.
See discussion above for possible fixes.

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

No branches or pull requests