unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#26605: 25.1; emacs picks unsuitable fallback fonts for monospace default font
@ 2017-04-22 13:06 Ralf Jung
  2017-04-22 13:46 ` Eli Zaretskii
  2019-11-17  7:50 ` Lars Ingebrigtsen
  0 siblings, 2 replies; 7+ messages in thread
From: Ralf Jung @ 2017-04-22 13:06 UTC (permalink / raw)
  To: 26605

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))





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#26605: 25.1; emacs picks unsuitable fallback fonts for monospace default font
  2017-04-22 13:06 bug#26605: 25.1; emacs picks unsuitable fallback fonts for monospace default font Ralf Jung
@ 2017-04-22 13:46 ` Eli Zaretskii
  2017-04-22 16:24   ` Ralf Jung
  2019-11-17  7:50 ` Lars Ingebrigtsen
  1 sibling, 1 reply; 7+ messages in thread
From: Eli Zaretskii @ 2017-04-22 13:46 UTC (permalink / raw)
  To: Ralf Jung; +Cc: 26605

> From: Ralf Jung <post@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.





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#26605: 25.1; emacs picks unsuitable fallback fonts for monospace default font
  2017-04-22 13:46 ` Eli Zaretskii
@ 2017-04-22 16:24   ` Ralf Jung
  2017-04-22 19:25     ` Eli Zaretskii
  0 siblings, 1 reply; 7+ messages in thread
From: Ralf Jung @ 2017-04-22 16:24 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 26605

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





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#26605: 25.1; emacs picks unsuitable fallback fonts for monospace default font
  2017-04-22 16:24   ` Ralf Jung
@ 2017-04-22 19:25     ` Eli Zaretskii
  2017-04-22 19:26       ` Ralf Jung
  0 siblings, 1 reply; 7+ messages in thread
From: Eli Zaretskii @ 2017-04-22 19:25 UTC (permalink / raw)
  To: Ralf Jung; +Cc: 26605

> Cc: 26605@debbugs.gnu.org
> From: Ralf Jung <post@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?





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#26605: 25.1; emacs picks unsuitable fallback fonts for monospace default font
  2017-04-22 19:25     ` Eli Zaretskii
@ 2017-04-22 19:26       ` Ralf Jung
  0 siblings, 0 replies; 7+ messages in thread
From: Ralf Jung @ 2017-04-22 19:26 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 26605

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





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#26605: 25.1; emacs picks unsuitable fallback fonts for monospace default font
  2017-04-22 13:06 bug#26605: 25.1; emacs picks unsuitable fallback fonts for monospace default font Ralf Jung
  2017-04-22 13:46 ` Eli Zaretskii
@ 2019-11-17  7:50 ` Lars Ingebrigtsen
  2019-11-17 15:50   ` Eli Zaretskii
  1 sibling, 1 reply; 7+ messages in thread
From: Lars Ingebrigtsen @ 2019-11-17  7:50 UTC (permalink / raw)
  To: Ralf Jung; +Cc: 26605

Ralf Jung <post@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





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#26605: 25.1; emacs picks unsuitable fallback fonts for monospace default font
  2019-11-17  7:50 ` Lars Ingebrigtsen
@ 2019-11-17 15:50   ` Eli Zaretskii
  0 siblings, 0 replies; 7+ messages in thread
From: Eli Zaretskii @ 2019-11-17 15:50 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 26605, post

> From: Lars Ingebrigtsen <larsi@gnus.org>
> Date: Sun, 17 Nov 2019 08:50:53 +0100
> Cc: 26605@debbugs.gnu.org
> 
> Ralf Jung <post@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).





^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2019-11-17 15:50 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-22 13:06 bug#26605: 25.1; emacs picks unsuitable fallback fonts for monospace default font Ralf Jung
2017-04-22 13:46 ` Eli Zaretskii
2017-04-22 16:24   ` Ralf Jung
2017-04-22 19:25     ` Eli Zaretskii
2017-04-22 19:26       ` Ralf Jung
2019-11-17  7:50 ` Lars Ingebrigtsen
2019-11-17 15:50   ` Eli Zaretskii

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).