bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#21028: Slow font rendering in emacs


From: Ralf Jung
Subject: bug#21028: Slow font rendering in emacs
Date: Tue, 14 Mar 2017 20:17:00 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0

Hi again,

> Note that the above is probably relevant to Emacs 25.1 and later (the
> first item definitely), so I suggest to upgrade, because this stuff
> should work much better in Emacs 25, and some of your problems might
> just go away without any need for customization.

All right, I am on emacs 25.1.1 in Debian testing now.  If I just remove
all font configuration, I still see emacs picking the wrong characters:
While the Latin and Greek letters and the arrows are all Fira Sans Mono
(my system-wide default monospace font), emacs still picks STIX to
render ∃ and "DejaVu Math TeX Gyre" for ↦ and ∖.  (Actually the
situation with ∖ is even more weird -- once I *select* that character
(i.e., I use shift+arrow key to mark it -- sorry, I don't know the emacs
terminology here), it actually changes to some other font, which I can
tell because it suddenly is only half the width.  Unfortunately I don't
know how to query that font because that would remove the selection, but
it looks a lot like the one from Symbola.)

So I want to tell emacs to use DejaVu for everything the default font
doesn't support.  I tried

(set-fontset-font "fontset-default" 'unicode (font-spec :name "DejaVu
Sans Mono" :size 11.0))

but that just results in *fewer* characters being rendered in Fira Sans.
 For example, Σ is now rendered in TeX Gyre Schola Math. (How can
setting DejaVu as the 'unicode font result in emacs switching from Fira
Sans to TeX Gyre?!?)  For additional confusion, if I select the Σ, it
switches to some other font; I can't tell which.

This brings me back to

(set-fontset-font "fontset-default" 'unicode (font-spec :name
"Monospace" :size 11.0))
(set-fontset-font "fontset-default" 'unicode (font-spec :name "DejaVu
Sans Mono" :size 11.0) nil 'append)

which fixes Σ, but still leaves all the other characters with their
wrong fonts.
So I do

(dolist (ft (fontset-list))
  ; Main font
  (set-fontset-font ft 'unicode (font-spec :name "Monospace" :size 11.0))
  ; Fallback font
  (set-fontset-font ft 'unicode (font-spec :name "DejaVu Sans Mono"
:size 11.0) nil 'append)
)

And now it uses the right font for things supported by either Fira or
DejaVu. For ∖, it picks STIXVariants, which is slightly too high so the
line grid is not perfect; that's why I usually try to make Symbola the
fallback-fallback font.
In any case, the above configuration is *slow*.  As in, way slower than
Emacs 24 was.  Just clicking somewhere results in a noticeably delay of
~0.5s until the cursor actually moves.  Same for C-v.  C-n is still
instantaneous.  This is all at the top of
<https://gitlab.mpi-sws.org/FP/LambdaRust-coq/raw/master/theories/typing/lib/rc.v>.
 The way larger list.v file I mentioned earlier is less affected, i.e.,
it is still slow but not slower than Emacs 24.  This may be related to
the fact that rc.v uses much more unicode characters than list.v.

Lucky enough, my work-around still works; I can keep my old "weird"
configuration.

Kind regards,
Ralf





reply via email to

[Prev in Thread] Current Thread [Next in Thread]