From: Eli Zaretskii <eliz@gnu.org>
To: "Clément Pit--Claudel" <clement.pitclaudel@live.com>
Cc: 21028@debbugs.gnu.org
Subject: bug#21028: Performance regression in revision af1a69f4d17a482c359d98c00ef86fac835b5fac (Apr 2014).
Date: Thu, 16 Mar 2017 17:27:09 +0200 [thread overview]
Message-ID: <83ziglz1gy.fsf@gnu.org> (raw)
In-Reply-To: <abcb1806-0928-1bdb-58c0-73d171e0e51a@live.com> (message from Clément Pit--Claudel on Wed, 15 Mar 2017 16:46:33 -0400)
> Cc: 21028@debbugs.gnu.org
> From: Clément Pit--Claudel <clement.pitclaudel@live.com>
> Date: Wed, 15 Mar 2017 16:46:33 -0400
>
> > The problem here is that opening a font and looking up a character is
> > very expensive, certainly when there are hundreds of fonts installed.
> > So Emacs filters the fonts according to the scripts they claim to
> > support, and only opens those which appear to be valid candidates for
> > the script of the character it needs to display. By using 'unicode as
> > the script when you set up your fontset, you actually trip Emacs by
> > telling it to try this font for every character it needs to display.
> > You should instead specify the scripts which the fonts supports well.
>
> Ok — but why wasn't it slow in 24.3?
That's the question about the significance of the zero_vector in the
font-cache, the patch you want to apply. I'm still struggling with
understanding why it speeds up the font search.
> And why does the number of fonts matter,
> if I'm only adding one (Symbola) with 'unicode?
Any font has several variants, and they are all checked. Moreover,
checking too many fonts conses a lot of Lisp data, which is likely to
trigger GC, which is likely to throw away font caches, which will then
require us to check those fonts again.
> > That shouldn't be a problem in Emacs 25: it by default uses the
> > default face's font for any punctuation and symbol characters for
> > which the font has glyphs, even if the fontset specifies a different
> > font for punctuation and symbol blocks.
>
> Neat. Though of course that doesn't help for Emacs < 24.
Users who care about fonts and exotic characters shouldn't stay with
Emacs 24.
> > So using more accurate scripts gives a major improvement. Good.
>
> It also seems to negate the previous conclusion, right?
Not really.
> In these fast example I'm still adding Symbola with 'unicode — but
> adding Ubuntu Mono with 'latin.
Ubuntu Mono _is_ the problem. Symbola has very good coverage of
almost all Unicode blocks, so it is not the problem.
> > That could sometimes be the case, but I have found that in some cases
> > omitting the registry for characters beyond Latin-1 can be a major
> > setback. So I recommend to always use it.
>
> Ok. Could Emacs not infer it?
I think Emacs still goes by the XLFD rules, which require iso8859-1 be
the default. I don't know how important it is to keep that
compatibility.
> > You can use a font utility, such as Fontforge, to see which blocks the
> > font supports, and how many characters from each block it can display.
> > My conclusion from looking at Ubuntu Mono is that the above 3 scripts
> > are the only ones it supports well; the rest are not covered well at
> > all. You can, of course, add more scripts if you need them, but the
> > downside will be that some of those scripts will be displayed by a mix
> > of more than one font, which I think will make the display ugly.
>
> I don't care about the display being pretty as much as it being properly align
> (vertically), which means that using Ubuntu Mono helps a lot.
That's fine, just don't tell Emacs Ubuntu Mono supports the entire
Unicode.
> > Moreover, Emacs cannot compose glyphs that come from different fonts,
> > so you will sometimes see decomposed display if you request a font for
> > scripts where its support is incomplete. I think this is an important
> > factor for users of prettify-symbols-mode in particular.
>
> Why? prettify-symbols-mode composes strings (typically) into single characters,
> so why would this matter?
I imagine that prettify-symbols-mode is not limited to single existing
characters, but if it is, this issue is indeed not relevant to that
mode.
> >> (dolist (ft (fontset-list))
> >> (set-fontset-font ft 'unicode (font-spec :name "YOUR-USUAL-FONT"))
> >> (set-fontset-font ft 'unicode (font-spec :name "Symbola") nil 'append))
> >
> > Well, maybe with the new insights you have now, you can recommend them
> > better setups which don't use 'unicode'.
> I think I still have a blurry picture of the whole process, or at least it
> sounds very complicated. Is it really the following?
>
> * Pick a good monospace font. Set that as the default Emacs font (this is easy)
Yes.
> * Pick a good math font. Symbola is easier than others, because Emacs knows
> about it.
Yes.
> * Download and install fontforge. Figure out which ranges the math font
> support, and all the characters that it supports that are not punctuation or
> symbols, too
Not needed, as long as the default font is set up via
default-frame-alist.
> * Create a set-fontset-font rule for each range and character. Figure out the
> font's registry too. Add all these rules with 'append, though for better
> performance you can use 'prepend, but for that you'll need to know which ranges
> the first font supports, too.
Should not be needed at all, as math symbols are already set up in the
default fontset (if I understand correctly what you need the math font
for, see below). Definitely not needed if Symbola is to be used. For
other Math fonts, I expect the default to just work; if it doesn't,
I'd like to see bug reports.
> In Emacs 25, given that symbols use the default font, it looks like the
> following should work, at least with your patch:
>
> 25.1/src/emacs -Q --eval "(set-fontset-font \"fontset-default\" 'unicode
> (font-spec :name \"XITS Math\") nil 'prepend)"
What happens if you don't do this? Which font is used for math
symbols? Or are the problems with symbols other than math symbols?
IOW, I don't understand fully why you need to set up XITS Math in the
fontset, what is missing/incorrect/ugly if you don't?
next prev parent reply other threads:[~2017-03-16 15:27 UTC|newest]
Thread overview: 89+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-10 10:34 bug#21028: Performance regression in revision af1a69f4d17a482c359d98c00ef86fac835b5fac (Apr 2014) Clément Pit--Claudel
2015-07-10 12:30 ` Eli Zaretskii
2015-07-10 16:02 ` Clément Pit--Claudel
2015-07-10 12:41 ` Eli Zaretskii
2015-07-10 16:55 ` Clément Pit--Claudel
2015-07-15 12:32 ` Dmitry Antipov
2015-07-18 10:24 ` Clément Pit--Claudel
2015-07-18 11:16 ` Clément Pit--Claudel
2015-07-18 11:26 ` Eli Zaretskii
2015-07-18 20:08 ` Clément Pit--Claudel
2016-03-03 6:12 ` Clément Pit--Claudel
2016-03-03 6:42 ` Clément Pit--Claudel
2016-03-03 7:08 ` Clément Pit--Claudel
2016-03-03 7:33 ` Clément Pit--Claudel
2016-03-03 17:10 ` Glenn Morris
2016-03-03 17:28 ` Clément Pit--Claudel
2016-03-03 20:27 ` Eli Zaretskii
2016-07-20 21:26 ` Clément Pit--Claudel
2016-07-21 14:21 ` Eli Zaretskii
2016-07-21 14:33 ` Clément Pit--Claudel
2016-07-23 20:50 ` Clément Pit--Claudel
2016-10-04 22:17 ` Clément Pit--Claudel
2016-10-26 17:15 ` Clément Pit--Claudel
2016-10-27 14:38 ` Eli Zaretskii
2016-10-27 15:29 ` Clément Pit--Claudel
2016-10-27 15:55 ` Eli Zaretskii
2016-10-28 14:23 ` Clément Pit--Claudel
2016-10-28 14:33 ` Eli Zaretskii
2016-11-18 8:55 ` Eli Zaretskii
2016-12-18 17:33 ` Clément Pit--Claudel
2016-12-18 17:37 ` Eli Zaretskii
2016-12-18 18:04 ` Clément Pit--Claudel
2016-12-18 19:52 ` Eli Zaretskii
2016-12-18 20:44 ` Clément Pit--Claudel
2016-12-19 15:50 ` Eli Zaretskii
2016-12-19 16:25 ` Clément Pit--Claudel
2016-12-19 16:39 ` Eli Zaretskii
2016-12-19 16:55 ` Clément Pit--Claudel
2016-12-19 16:58 ` Eli Zaretskii
2016-12-19 17:13 ` Clément Pit--Claudel
2016-12-22 16:25 ` Eli Zaretskii
2016-12-22 16:49 ` Clément Pit--Claudel
2016-12-22 18:04 ` Eli Zaretskii
2016-12-22 19:08 ` Clément Pit--Claudel
2017-02-10 4:45 ` Clément Pit--Claudel
2017-03-12 11:38 ` Clément Pit--Claudel
2017-03-12 15:49 ` Eli Zaretskii
2017-03-12 17:24 ` Clément Pit--Claudel
2017-03-12 17:48 ` Eli Zaretskii
2017-03-12 19:19 ` Clément Pit--Claudel
2017-03-13 15:46 ` Eli Zaretskii
2017-03-13 16:36 ` Clément Pit--Claudel
2017-03-13 17:22 ` Eli Zaretskii
2017-03-13 19:04 ` Clément Pit--Claudel
2017-03-13 20:53 ` Eli Zaretskii
2017-03-14 19:45 ` Clément Pit--Claudel
2017-03-15 15:37 ` Eli Zaretskii
2017-03-14 15:45 ` Eli Zaretskii
2017-03-14 19:35 ` Clément Pit--Claudel
2017-03-15 15:36 ` Eli Zaretskii
2017-03-15 20:46 ` Clément Pit--Claudel
2017-03-16 15:27 ` Eli Zaretskii [this message]
2017-03-16 21:23 ` Clément Pit--Claudel
2017-03-17 8:15 ` Eli Zaretskii
2017-04-16 7:48 ` Eli Zaretskii
2017-04-16 15:28 ` Clément Pit--Claudel
2016-12-19 17:00 ` Clément Pit--Claudel
2015-07-10 15:42 ` Glenn Morris
2016-03-03 6:37 ` Clément Pit--Claudel
2016-10-04 18:56 ` Jason Gross
2017-03-13 15:54 ` bug#21028: Slow font rendering in emacs Ralf Jung
2017-03-13 17:05 ` Eli Zaretskii
2017-03-13 18:12 ` Ralf Jung
2017-03-13 20:39 ` Eli Zaretskii
2017-03-14 15:57 ` Ralf Jung
2017-03-14 17:11 ` Eli Zaretskii
2017-03-14 18:50 ` Ralf Jung
2017-03-14 19:16 ` Eli Zaretskii
2017-03-14 19:17 ` Ralf Jung
2017-03-14 20:49 ` John Mastro
2017-03-15 15:40 ` Eli Zaretskii
2017-03-14 15:47 ` Eli Zaretskii
2017-03-14 18:41 ` Ralf Jung
2017-03-14 19:16 ` Eli Zaretskii
2017-03-14 19:39 ` Ralf Jung
2017-03-14 19:45 ` Ralf Jung
2017-03-15 15:36 ` Eli Zaretskii
2017-04-22 8:54 ` Ralf Jung
2017-04-22 13:40 ` Eli Zaretskii
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=83ziglz1gy.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=21028@debbugs.gnu.org \
--cc=clement.pitclaudel@live.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.