Bug 1175456 - Emacs font loading errors since 26 -> 27.1 upgrade
Summary: Emacs font loading errors since 26 -> 27.1 upgrade
Status: RESOLVED DUPLICATE of bug 1175372
Alias: None
Product: openSUSE Tumbleweed
Classification: openSUSE
Component: X11 Applications (show other bugs)
Version: Current
Hardware: x86-64 openSUSE Tumbleweed
: P5 - None : Normal (vote)
Target Milestone: ---
Assignee: Dr. Werner Fink
QA Contact: E-mail List
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-08-18 14:48 UTC by Philipp Reichmuth
Modified: 2020-08-19 10:26 UTC (History)
2 users (show)

See Also:
Found By: ---
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---
werner: needinfo? (philipp.reichmuth)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Philipp Reichmuth 2020-08-18 14:48:22 UTC
After today's update of Emacs 27.1, I get font loading errors. I'm using Spacemacs, which by default uses the Source Code Pro font. The font files are in ~/.local/share/fonts. 

I'm trying this on a fresh Git checkout of Spacemacs (git clone https://github.com/syl20bnr/spacemacs ~/.emacs.d). Upon launch, Emacs fails to load the font, loads some horrible bitmap fonts and breaks off handling of init.el with the following error message:

-------------------
Warning (initialization): An error occurred while loading ‘/home/r********/.emacs.d/init.el’:

error: Font not available, #<font-spec nil nil Source Code Pro nil nil normal nil normal 13 nil nil nil ((:name . Source Code Pro))>

To ensure normal operation, you should investigate and remove the
cause of the error in your initialization file.  Start Emacs with
the ‘--debug-init’ option to view a complete error backtrace.[/CODE]
-------------------

The font is there, if I do (x-list-fonts "source code pro") I get the following:

("-adobe-source code pro-medium-r-normal--*-*-0-0-m-0-koi8-ru" "-adobe-source code pro-medium-r-normal--*-*-0-0-m-0-koi8-r" "-adobe-source code pro-medium-r-normal--*-*-0-0-m-0-iso8859-9" "-adobe-source code pro-medium-r-normal--*-*-0-0-m-0-iso8859-7" "-adobe-source code pro-medium-r-normal--*-*-0-0-m-0-iso8859-5" "-adobe-source code pro-medium-r-normal--*-*-0-0-m-0-iso8859-4" "-adobe-source code pro-medium-r-normal--*-*-0-0-m-0-iso8859-3" "-adobe-source code pro-medium-r-normal--*-*-0-0-m-0-iso8859-2" "-adobe-source code pro-medium-r-normal--*-*-0-0-m-0-iso8859-16" "-adobe-source code pro-medium-r-normal--*-*-0-0-m-0-iso8859-15" "-adobe-source code pro-medium-r-normal--*-*-0-0-m-0-iso8859-13" "-adobe-source code pro-medium-r-normal--*-*-0-0-m-0-iso8859-10" ...)

This is with both the "develop" (0.300) and "master" (0.200) branches of Spacemacs. The master branched hasn't changed in about a year and people have been using it with Emacs 27 for a while. The identical configuration on the previous OpenSUSE Emacs package (26.3) worked fine.
Comment 1 Philipp Reichmuth 2020-08-18 14:50:42 UTC
For clarity, here is how Spacemacs initializes the fonts (from init.el).
 It first sets a default font as follows (in ~/.emacs.d/core/core-dotspacemacs.el)

(defvar dotspacemacs-default-font '("Source Code Pro"
                                    :size 13
                                    :weight normal
                                    :width normal
                                    :powerline-scale 1.1)
  "Default font, or prioritized list of fonts. `powerline-scale'
allows to quickly tweak the mode-line size to make separators
look not too crappy.

Has no effect when running Emacs in terminal.")

----------------------------------
Then it initializes the font as follows (in ~/.emacs.d/core/core-spacemacs.el):

;; font
(spacemacs|do-after-display-system-init
 ;; If you are thinking to remove this call to `message', think twice. You'll
 ;; break the life of several Spacemacser using Emacs in daemon mode. Without
 ;; this, their chosen font will not be set on the *first* instance of
 ;; emacsclient, at least if different than their system font. You don't
 ;; believe me? Go ahead, try it. After you'll have notice that this was true,
 ;; increase the counter bellow so next people will give it more confidence.
 ;; Counter = 1
 (message "Setting the font...")
 (unless (spacemacs/set-default-font dotspacemacs-default-font)
   (spacemacs-buffer/warning
    "Cannot find any of the specified fonts (%s)! Font settings may not be correct."
    (if (listp (car dotspacemacs-default-font))
        (mapconcat 'car dotspacemacs-default-font ", ")
    (car dotspacemacs-default-font)))))

----------------------------------
And this is the function that actually loads the font (in ~/.emacs.d/core/core-fonts-support.el):

(defun spacemacs/set-default-font (plists)
  "Set the font given the passed PLISTS.

PLISTS has either the form (\"fontname\" :prop1 val1 :prop2 val2 ...)
or is a list of such. The first font that can be found will be used.

The return value is nil if no font was found, truthy otherwise."
  (unless (listp (car plists))
    (setq plists (list plists)))
  (catch 'break
    (dolist (plist plists)
      (when (find-font (font-spec :name (car plist)))
        (let* ((font (car plist))
               (props (cdr plist))
               (scale (plist-get props :powerline-scale))
               (font-props (spacemacs/mplist-remove
                            (spacemacs/mplist-remove props :powerline-scale)
                            :powerline-offset))
               (fontspec (apply 'font-spec :name font font-props)))
          (spacemacs-buffer/message "Setting font \"%s\"..." font)
          (set-frame-font fontspec nil t)
          (push `(font . ,(frame-parameter nil 'font)) default-frame-alist)
          (setq-default powerline-scale scale)
          (setq-default powerline-height (spacemacs/compute-powerline-height))
          ;; fallback font for unicode characters used in spacemacs
          (pcase system-type
            (`gnu/linux
             (setq fallback-font-name "NanumGothic")
             (setq fallback-font-name2 "NanumGothic"))
            (`darwin
             (setq fallback-font-name "Arial Unicode MS")
             (setq fallback-font-name2 "Arial Unicode MS"))
            (`windows-nt
             (setq fallback-font-name "MS Gothic")
             (setq fallback-font-name2 "Lucida Sans Unicode"))
            (`cygwin
             (setq fallback-font-name "MS Gothic")
             (setq fallback-font-name2 "Lucida Sans Unicode"))
            (other
             (setq fallback-font-name nil)
             (setq fallback-font-name2 nil)))
          (when (and fallback-font-name fallback-font-name2)
            ;; remove any size or height properties in order to be able to
            ;; scale the fallback fonts with the default one (for zoom-in/out
            ;; for instance)
            (let* ((fallback-props (spacemacs/mplist-remove
                                    (spacemacs/mplist-remove font-props :size)
                                    :height))
                   (fallback-spec (apply 'font-spec
                                         :name fallback-font-name
                                         fallback-props))
                   (fallback-spec2 (apply 'font-spec
                                          :name fallback-font-name2
                                          fallback-props)))
              ;; window numbers
              (set-fontset-font "fontset-default"
                                '(#x2776 . #x2793) fallback-spec nil 'prepend)
              ;; mode-line circled letters
              (set-fontset-font "fontset-default"
                                '(#x24b6 . #x24fe) fallback-spec nil 'prepend)
              ;; mode-line additional characters
              (set-fontset-font "fontset-default"
                                '(#x2295 . #x22a1) fallback-spec nil 'prepend)
              ;; new version lighter
              (set-fontset-font "fontset-default"
                                '(#x2190 . #x2200) fallback-spec2 nil 'prepend))))
        (throw 'break t)))
    nil))
Comment 2 Torsten Schuetze 2020-08-19 08:22:21 UTC
Just for information. The observed behavior can be seen with a out-of-the box emacs-27.1-1.1.x86_64.rpm and no special fonts loaded (.emacs removed). So, its not specific to Spacemacs and some special font, but seems to occure for all users.

In addition, as a normal user I see the following log output when starting emacs. When I start emacs as root the behavior is normal (as with 26.3).

Warning: game dir '/var/games/emacs': Permission denied
Loading loadup.el (source)...
dump mode: nil
Using load-path (/usr/share/emacs/27.1/site-lisp /usr/share/emacs/site-lisp /usr/share/emacs/27.1/lisp /usr/share/emacs/27.1/lisp/emacs-lisp /usr/share/emacs/27.1/lisp/progmodes /usr/share/emacs/27.1/lisp/language /usr/share/emacs/27.1/lisp/international /usr/share/emacs/27.1/lisp/textmodes /usr/share/emacs/27.1/lisp/vc)
Loading emacs-lisp/byte-run...
Loading emacs-lisp/byte-run...done
Loading emacs-lisp/backquote...
Loading emacs-lisp/backquote...done
Loading subr...
Loading subr...done
Loading version...
Loading version...done
Loading widget...
Loading widget...done
Loading custom...
Loading custom...done
Loading emacs-lisp/map-ynp...
Loading emacs-lisp/map-ynp...done
Loading international/mule...
Loading international/mule...done
Loading international/mule-conf...
Loading international/mule-conf...done
Loading env...
Loading env...done
Loading format...
Loading format...done
Loading bindings (source)...
Loading bindings (source)...done
Loading window...
Loading window...done
Loading files...
Loading files...done
Loading emacs-lisp/macroexp...
Loading emacs-lisp/macroexp...done
Loading cus-face...
Loading cus-face...done
Loading faces...
Loading faces...done
Loading button...
Loading button...done
Loading /usr/share/emacs/27.1/lisp/loaddefs.el (source)...
Loading /usr/share/emacs/27.1/lisp/loaddefs.el (source)...done
Loading emacs-lisp/nadvice...
Loading emacs-lisp/nadvice...done
Loading emacs-lisp/cl-preloaded...
Loading emacs-lisp/cl-preloaded...done
Loading obarray...
Loading obarray...done
Loading abbrev...
Loading abbrev...done
Loading simple...
Loading simple...done
Loading help...
Loading help...done
Loading jka-cmpr-hook...
Loading jka-cmpr-hook...done
Loading epa-hook...
Loading epa-hook...done
Loading international/mule-cmds...
Loading international/mule-cmds...done
Loading case-table...
Loading case-table...done
Loading /usr/share/emacs/27.1/lisp/international/charprop.el (source)...
Loading /usr/share/emacs/27.1/lisp/international/charprop.el (source)...done
Loading international/characters...
Loading international/characters...done
Loading composite...
Loading composite...done
Loading language/chinese...
Loading language/chinese...done
Loading language/cyrillic...
Loading language/cyrillic...done
Loading language/indian...
Loading language/indian...done
Loading language/sinhala...
Loading language/sinhala...done
Loading language/english...
Loading language/english...done
Loading language/ethiopic...
Loading language/ethiopic...done
Loading language/european...
Loading language/european...done
Loading language/czech...
Loading language/czech...done
Loading language/slovak...
Loading language/slovak...done
Loading language/romanian...
Loading language/romanian...done
Loading language/greek...
Loading language/greek...done
Loading language/hebrew...
Loading language/hebrew...done
Loading international/cp51932...
Loading international/cp51932...done
Loading international/eucjp-ms...
Loading international/eucjp-ms...done
Loading language/japanese...
Loading language/japanese...done
Loading language/korean...
Loading language/korean...done
Loading language/lao...
Loading language/lao...done
Loading language/tai-viet...
Loading language/tai-viet...done
Loading language/thai...
Loading language/thai...done
Loading language/tibetan...
Loading language/tibetan...done
Loading language/vietnamese...
Loading language/vietnamese...done
Loading language/misc-lang...
Loading language/misc-lang...done
Loading language/utf-8-lang...
Loading language/utf-8-lang...done
Loading language/georgian...
Loading language/georgian...done
Loading language/khmer...
Loading language/khmer...done
Loading language/burmese...
Loading language/burmese...done
Loading language/cham...
Loading language/cham...done
Loading indent...
Loading indent...done
Loading emacs-lisp/cl-generic...
Loading emacs-lisp/cl-generic...done
Loading minibuffer...
Loading minibuffer...done
Loading frame...
Loading frame...done
Loading startup...
Loading startup...done
Loading term/tty-colors...
Loading term/tty-colors...done
Loading font-core...
Loading font-core...done
Loading facemenu...
Loading facemenu...done
Loading emacs-lisp/syntax...
Loading emacs-lisp/syntax...done
Loading font-lock...
Loading font-lock...done
Loading jit-lock...
Loading jit-lock...done
Loading mouse...
Loading mouse...done
Loading scroll-bar...
Loading scroll-bar...done
Loading select...
Loading select...done
Loading emacs-lisp/timer...
Loading emacs-lisp/timer...done
Loading isearch...
Loading isearch...done
Loading rfn-eshadow...
Loading rfn-eshadow...done
Loading menu-bar...
Loading menu-bar...done
Loading tab-bar...
Loading tab-bar...done
Loading emacs-lisp/lisp...
Loading emacs-lisp/lisp...done
Loading textmodes/page...
Loading textmodes/page...done
Loading register...
Loading register...done
Loading textmodes/paragraphs...
Loading textmodes/paragraphs...done
Loading progmodes/prog-mode...
Loading progmodes/prog-mode...done
Loading emacs-lisp/lisp-mode...
Loading emacs-lisp/lisp-mode...done
Loading progmodes/elisp-mode...
Loading progmodes/elisp-mode...done
Loading textmodes/text-mode...
Loading textmodes/text-mode...done
Loading textmodes/fill...
Loading textmodes/fill...done
Loading newcomment...
Loading newcomment...done
Loading replace...
Loading replace...done
Loading emacs-lisp/tabulated-list...
Loading emacs-lisp/tabulated-list...done
Loading buff-menu...
Loading buff-menu...done
Loading fringe...
Loading fringe...done
Loading emacs-lisp/regexp-opt...
Loading emacs-lisp/regexp-opt...done
Loading image...
Loading image...done
Loading international/fontset...
Loading international/fontset...done
Loading dnd...
Loading dnd...done
Loading tool-bar...
Loading tool-bar...done
Loading dynamic-setting...
Loading dynamic-setting...done
Loading x-dnd...
Loading x-dnd...done
Loading term/common-win...
Loading term/common-win...done
Loading term/x-win...
Loading term/x-win...done
Loading mwheel...
Loading mwheel...done
Loading emacs-lisp/float-sup...
Loading emacs-lisp/float-sup...done
Loading vc/vc-hooks...
Loading vc/vc-hooks...done
Loading vc/ediff-hook...
Loading vc/ediff-hook...done
Loading uniquify...
Loading uniquify...done
Loading electric...
Loading electric...done
Loading emacs-lisp/eldoc...
Loading emacs-lisp/eldoc...done
Loading /usr/share/emacs/27.1/lisp/cus-start.el (source)...
Loading /usr/share/emacs/27.1/lisp/cus-start.el (source)...done
Loading tooltip...
Loading tooltip...done
Loading /usr/share/emacs/27.1/lisp/leim/leim-list.el (source)...
Loading /usr/share/emacs/27.1/lisp/leim/leim-list.el (source)...done
Loading /usr/share/emacs/27.1/lisp/site-load.el (source)...
Loading lpr...
Loading lpr...done
Loading delsel...
Loading delsel...done
Loading /usr/share/emacs/27.1/lisp/site-load.el (source)...done
Finding pointers to doc strings...
Finding pointers to doc strings...done
Comment 3 Dr. Werner Fink 2020-08-19 09:22:46 UTC
Switch Emacs.FontBackend setting off in  /usr/share/X11/app-defaults/Emacs as done for bug boo#1175372 ... does this help?
Comment 4 Philipp Reichmuth 2020-08-19 10:07:52 UTC
It does, thank you.
 
I still have lots of fresh problems since the update - e.g. Quelpa throwing lots of "Error in process sentinel: end of file during parsing errors" messages - but I'm working to figure out whether they're related to 27.1 in general or to the OpenSUSE package in particular.
Comment 5 Dr. Werner Fink 2020-08-19 10:26:14 UTC
(In reply to Philipp Reichmuth from comment #4)
> It does, thank you.
>  
> I still have lots of fresh problems since the update - e.g. Quelpa throwing
> lots of "Error in process sentinel: end of file during parsing errors"
> messages - but I'm working to figure out whether they're related to 27.1 in
> general or to the OpenSUSE package in particular.

OK, this is a duplicated

*** This bug has been marked as a duplicate of bug 1175372 ***