GNU bug report logs - #26605
25.1; emacs picks unsuitable fallback fonts for monospace default font

Previous Next

Package: emacs;

Reported by: Ralf Jung <post <at> ralfj.de>

Date: Sat, 22 Apr 2017 13:08:01 UTC

Severity: normal

Found in version 25.1

To reply to this bug, email your comments to 26605 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#26605; Package emacs. (Sat, 22 Apr 2017 13:08:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Ralf Jung <post <at> ralfj.de>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sat, 22 Apr 2017 13:08:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Ralf Jung <post <at> ralfj.de>
To: bug-gnu-emacs <at> gnu.org
Subject: 25.1; emacs picks unsuitable fallback fonts for monospace default font
Date: Sat, 22 Apr 2017 15:06:49 +0200
Hi all,

I have my system set up to use "Fira Mono" as the default font for
"Monospace", and my code editors (emacs and Kate) use that font as their
default font.  However, if I use emacs without any further
configuration, it picks unsuitable fallback fonts for characters not
supported my Fira Mono.  "Unsuitable" here means in particular that the
chosen fallback font is not monospace, so lines that contain fallback
characters break the grid.  At the same time, I do have suitable fonts
installed, as witnessed by Kate being able to preserve the grid.

Concretely, consider the following example text (pieced together from a
codebase using unicode characters for mathematical operators):

  mixin_cmra_pcore_mono x y cx :
    x ≼ y → pcore x = Some cx → ∃ cy, pcore y = Some cy ∧ cx ≼ cy;
    ✓{n} x → x ≡{n}≡ y1 ⋅ y2 →
    z1 z2, x ≡ z1 ⋅ z2 ∧ z1 ≡{n}≡ y1 ∧ z2 ≡{n}≡ y2
    ∀ ✓{n} (∅:A).
    }.

(At least) the following characters are not supported by Fira Mono, so a
fallback is picked:
  ≼ ✓ ⋅ ∧ ∅ ∃ ∀

As a result, the above text does not stay within the "monotext grid",
some characters are significantly wider than the majority (e.g., ≼)
while others are much smaller (⋅).  However, all of these characters are
supported by DejaVu Mono, a font I have installed.  I believe that's the
font other editors are using to render these characters.  When I
configure emacs to use DejaVu Mono for characters not supported by Fira
Mono, the text above looks entirely as expected.

Notice that, for example, → is supported by both Fira Mono and DejaVu
Mono.  In these cases, the editor should use the preferred font, which
is Fira Mono in my case.  (Actually, the much prettier arrows are one of
the reasons I prefer Fira Mono over DejaVu Mono.)

Ideally, emacs' default configuration would be such that it prefers
monospace over non-monospace fonts when falling back from a monospace font.

Kind regards,
Ralf

In GNU Emacs 25.1.1 (x86_64-pc-linux-gnu, GTK+ Version 3.22.5)
 of 2017-01-01, modified by Debian built on binet
Windowing system distributor 'The X.Org Foundation', version 11.0.11902000
System Description:	Debian GNU/Linux 9.0 (stretch)

Configured using:
 'configure --build x86_64-linux-gnu --prefix=/usr
 --sharedstatedir=/var/lib --libexecdir=/usr/lib
 --localstatedir=/var/lib --infodir=/usr/share/info
 --mandir=/usr/share/man --with-pop=yes
 --enable-locallisppath=/etc/emacs25:/etc/emacs:/usr/local/share/emacs/25.1/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/25.1/site-lisp:/usr/share/emacs/site-lisp
 --with-sound=alsa --build x86_64-linux-gnu --prefix=/usr
 --sharedstatedir=/var/lib --libexecdir=/usr/lib
 --localstatedir=/var/lib --infodir=/usr/share/info
 --mandir=/usr/share/man --with-pop=yes
 --enable-locallisppath=/etc/emacs25:/etc/emacs:/usr/local/share/emacs/25.1/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/25.1/site-lisp:/usr/share/emacs/site-lisp
 --with-sound=alsa --with-x=yes --with-x-toolkit=gtk3
 --with-toolkit-scroll-bars 'CFLAGS=-g -O2
 -fdebug-prefix-map=/build/emacs25-4Gc0bO/emacs25-25.1+1=.
-fstack-protector-strong
 -Wformat -Werror=format-security -Wall' 'CPPFLAGS=-Wdate-time
 -D_FORTIFY_SOURCE=2' LDFLAGS=-Wl,-z,relro'

Configured features:
XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GCONF GSETTINGS
NOTIFY ACL LIBSELINUX GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB
TOOLKIT_SCROLL_BARS GTK3 X11

Important settings:
  value of $LC_MESSAGES: en_US.utf8
  value of $LC_NUMERIC: en_US.utf8
  value of $LANG: de_DE.utf8
  locale-coding-system: utf-8-unix

Major mode: Fundamental

Minor modes in effect:
  tooltip-mode: t
  global-eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  buffer-read-only: t
  line-number-mode: t
  transient-mark-mode: t

Recent messages:
Loading /etc/emacs/site-start.d/50autoconf.el (source)...done
Loading /etc/emacs/site-start.d/50cmake-data.el (source)...done
Loading /etc/emacs/site-start.d/50dictionaries-common.el (source)...
Loading debian-ispell...
Loading /var/cache/dictionaries-common/emacsen-ispell-default.el
(source)...done
Loading debian-ispell...done
Loading /var/cache/dictionaries-common/emacsen-ispell-dicts.el
(source)...done
Loading /etc/emacs/site-start.d/50dictionaries-common.el (source)...done
For information about GNU Emacs and the GNU system, type C-h C-a.
funcall-interactively: Buffer is read-only: #<buffer *GNU Emacs*>

Load-path shadows:
/usr/share/emacs/25.1/site-lisp/debian-startup hides
/usr/share/emacs/site-lisp/debian-startup
/usr/share/emacs25/site-lisp/cmake-data/cmake-mode hides
/usr/share/emacs/site-lisp/cmake-mode

Features:
(shadow sort mail-extr emacsbug message dired format-spec rfc822 mml
mml-sec password-cache epg gnus-util mm-decode mm-bodies mm-encode
mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047
rfc2045 ietf-drums mm-util help-fns mail-prsvr mail-utils finder-inf
info tex-site package epg-config seq byte-opt gv bytecomp byte-compile
cl-extra help-mode easymenu cconv cl-loaddefs pcase cl-lib time-date
mule-util tooltip eldoc electric uniquify ediff-hook vc-hooks
lisp-float-type mwheel x-win term/common-win x-dnd tool-bar dnd fontset
image regexp-opt fringe tabulated-list newcomment elisp-mode lisp-mode
prog-mode register page menu-bar rfn-eshadow timer select scroll-bar
mouse jit-lock font-lock syntax facemenu font-core frame cl-generic cham
georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao
korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech
european ethiopic indian cyrillic chinese charscript case-table epa-hook
jka-cmpr-hook help simple abbrev minibuffer cl-preloaded nadvice
loaddefs button faces cus-face macroexp files text-properties overlay
sha1 md5 base64 format env code-pages mule custom widget
hashtable-print-readable backquote dbusbind inotify dynamic-setting
system-font-setting font-render-setting move-toolbar gtk x-toolkit x
multi-tty make-network-process emacs)

Memory information:
((conses 16 105584 5365)
 (symbols 48 21593 0)
 (miscs 40 98 107)
 (strings 32 21087 4829)
 (string-bytes 1 611322)
 (vectors 16 14637)
 (vector-slots 8 463510 5456)
 (floats 8 194 6)
 (intervals 56 296 0)
 (buffers 976 18))




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#26605; Package emacs. (Sat, 22 Apr 2017 13:46:01 GMT) Full text and rfc822 format available.

Message #8 received at 26605 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Ralf Jung <post <at> ralfj.de>
Cc: 26605 <at> debbugs.gnu.org
Subject: Re: bug#26605: 25.1;
 emacs picks unsuitable fallback fonts for monospace default font
Date: Sat, 22 Apr 2017 16:46:11 +0300
> From: Ralf Jung <post <at> ralfj.de>
> Date: Sat, 22 Apr 2017 15:06:49 +0200
> 
> Notice that, for example, → is supported by both Fira Mono and DejaVu
> Mono.  In these cases, the editor should use the preferred font, which
> is Fira Mono in my case.

Isn't that what happens?  It does here.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#26605; Package emacs. (Sat, 22 Apr 2017 16:26:02 GMT) Full text and rfc822 format available.

Message #11 received at 26605 <at> debbugs.gnu.org (full text, mbox):

From: Ralf Jung <post <at> ralfj.de>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 26605 <at> debbugs.gnu.org
Subject: Re: bug#26605: 25.1; emacs picks unsuitable fallback fonts for
 monospace default font
Date: Sat, 22 Apr 2017 18:24:59 +0200
Hi,

>> Notice that, for example, → is supported by both Fira Mono and DejaVu
>> Mono.  In these cases, the editor should use the preferred font, which
>> is Fira Mono in my case.
> 
> Isn't that what happens?  It does here.

Yes, sorry if that was unclear.  With the default setup, → is picking
the font I expected it to pick.
I mentioned this just because when changing the configuration to use
DejaVu Mono as a fallback font, it often happened to me that then emacs
also used DejaVu Mono for →.

Kind regards,
Ralf




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#26605; Package emacs. (Sat, 22 Apr 2017 19:25:02 GMT) Full text and rfc822 format available.

Message #14 received at 26605 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Ralf Jung <post <at> ralfj.de>
Cc: 26605 <at> debbugs.gnu.org
Subject: Re: bug#26605: 25.1; emacs picks unsuitable fallback fonts for
 monospace default font
Date: Sat, 22 Apr 2017 22:25:01 +0300
> Cc: 26605 <at> debbugs.gnu.org
> From: Ralf Jung <post <at> ralfj.de>
> Date: Sat, 22 Apr 2017 18:24:59 +0200
> 
> >> Notice that, for example, → is supported by both Fira Mono and DejaVu
> >> Mono.  In these cases, the editor should use the preferred font, which
> >> is Fira Mono in my case.
> > 
> > Isn't that what happens?  It does here.
> 
> Yes, sorry if that was unclear.  With the default setup, → is picking
> the font I expected it to pick.
> I mentioned this just because when changing the configuration to use
> DejaVu Mono as a fallback font, it often happened to me that then emacs
> also used DejaVu Mono for →.

Shouldn't happen in Emacs 25, AFAIK.  We specifically made a change in
that version to stick to the default font for symbols and punctuation
characters, as long as the default font supports them.  Maybe your
experience comes from older versions?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#26605; Package emacs. (Sat, 22 Apr 2017 19:28:01 GMT) Full text and rfc822 format available.

Message #17 received at 26605 <at> debbugs.gnu.org (full text, mbox):

From: Ralf Jung <post <at> ralfj.de>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 26605 <at> debbugs.gnu.org
Subject: Re: bug#26605: 25.1; emacs picks unsuitable fallback fonts for
 monospace default font
Date: Sat, 22 Apr 2017 21:26:56 +0200
Hi,

> Shouldn't happen in Emacs 25, AFAIK.  We specifically made a change in
> that version to stick to the default font for symbols and punctuation
> characters, as long as the default font supports them.  Maybe your
> experience comes from older versions?

Fair enough, I tested this before upgrading.
So just ignore this part for now, the bug is about the default behavior
only.

; Ralf




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#26605; Package emacs. (Sun, 17 Nov 2019 07:52:02 GMT) Full text and rfc822 format available.

Message #20 received at 26605 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Ralf Jung <post <at> ralfj.de>
Cc: 26605 <at> debbugs.gnu.org
Subject: Re: bug#26605: 25.1; emacs picks unsuitable fallback fonts for
 monospace default font
Date: Sun, 17 Nov 2019 08:50:53 +0100
Ralf Jung <post <at> ralfj.de> writes:

> Ideally, emacs' default configuration would be such that it prefers
> monospace over non-monospace fonts when falling back from a monospace font.

That does sound reasonable.  Has Emacs grown such a feature in the years
since this bug was reported?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#26605; Package emacs. (Sun, 17 Nov 2019 15:52:01 GMT) Full text and rfc822 format available.

Message #23 received at 26605 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 26605 <at> debbugs.gnu.org, post <at> ralfj.de
Subject: Re: bug#26605: 25.1;
 emacs picks unsuitable fallback fonts for monospace default font
Date: Sun, 17 Nov 2019 17:50:51 +0200
> From: Lars Ingebrigtsen <larsi <at> gnus.org>
> Date: Sun, 17 Nov 2019 08:50:53 +0100
> Cc: 26605 <at> debbugs.gnu.org
> 
> Ralf Jung <post <at> ralfj.de> writes:
> 
> > Ideally, emacs' default configuration would be such that it prefers
> > monospace over non-monospace fonts when falling back from a monospace font.
> 
> That does sound reasonable.  Has Emacs grown such a feature in the years
> since this bug was reported?

No, I don't think so.  The fallback uses the fontsets, so defining
those to put monospaced fonts before variable-pitch ones is the way to
go.  AFAIK, there's no logic in Emacs to select fallback fonts without
using the fontsets (the default ones if the user didn't customize
them).




This bug report was last modified 5 years and 217 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.