all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Drew Adams <drew.adams@oracle.com>
Cc: 32159@debbugs.gnu.org, moses.mason@gmail.com
Subject: bug#32159: 26.1; inhibit-compacting-font-caches does not fix all fonts lagging issue
Date: Sun, 15 Jul 2018 21:53:54 +0300	[thread overview]
Message-ID: <837elw9vp9.fsf@gnu.org> (raw)
In-Reply-To: <0c4b0a47-267d-4c4d-8d1f-6a562ac7519b@default> (message from Drew Adams on Sun, 15 Jul 2018 09:50:03 -0700 (PDT))

> Date: Sun, 15 Jul 2018 09:50:03 -0700 (PDT)
> From: Drew Adams <drew.adams@oracle.com>
> Cc: 32159@debbugs.gnu.org
> 
> It's great to support a large variety of fonts.  But
> if a user has lots of fonts installed then it seems
> that such an advantage can become a debilitating
> (i.e., severe) disadvantage.

Only if some characters Emacs needs to display are not supported by
any of those many fonts, and if the user didn't customize Emacs to
tell that he/she doesn't _want_ those characters to be displayed,
ever.  How reasonable is such a situation?  Not very reasonable from
my POV.

> This seems like a case of letting a search for the perfect become
> the enemy of the good.

What is "good" in this context, and how do we define it in practical
terms that can allow us to express it in code?

> It sounds like Emacs has a do-or-die approach, here,
> trying its utmost to find a font that will fit the
> bill - and using all installed fonts in its search.

No, it doesn't use all of the installed fonts, only those which
satisfy the requirements of the script whose character Emacs needs to
display.

> It seems, at least naively, like it should be
> possible for a user to control this, by toning down
> Emacs's overdrive and enthusiasm in this.

We have that way: the user should customize the fontset.

> Emacs had better analyze what's going on, itself, no?

And what exactly is "going on", may I ask?

Emacs enumerates the relevant fonts, then goes over them one by one,
determining as quickly as it can whether each font supports the
required features.  Each font that does is opened and looked up for
the character we need to display.  In this context, what do you mean
by "going on"?

> Doesn't (can't) Emacs have a better understanding of
> this problem than a user?

What else can Emacs do except try the fonts that might fit the bill?
What other understanding do you expect from Emacs?  Can Emacs
"understand" that no font is available for a given character without
trying to find such a font?

> IOW, Emacs should learn when to stop hanging a user
> up.

Which is when, exactly?  If you have some ideas, please let us hear
them, even if they are vague.

> Why must Emacs always try _all installed fonts_ each time?

It doesn't, not all of them.  Only those that might be relevant.

> Can't Emacs learn which fonts work for which chars,

It can, and it has.  See the default fontset -- that's the database
Emacs uses to guide the search.

> so that it doesn't keep trying a given font when
> trying to display a given char, after it's already
> determined previously that that font doesn't support
> that char?

Emacs never tries to search for a font that supports a given character
after it has done that once and failed.  But it will look again when
presented with another character, or if we clear the font caches.

> My question is essentially this: It seems like you
> keep saying, and being content to say, that if too
> may fonts are installed then Emacs can be slow / hang.

I'm saying that a system that has 5000 fonts installed and still has
some characters not covered is misconfigured.  Installing one or two
more fonts will probably fix the problem; if the user doesn't _want_
those characters to be displayed, ever, there's a way of customizing
Emacs to do that as well.  Doing none of those alternatives makes no
sense to me, if the slowdown annoys the user who is in this situation.

> I expect that, even if you agree that that would be
> desirable (which I'm not sure you do), you might
> say only: "patches welcome".

Patches to speed up Emacs are always welcome, that's a truism.  Sadly,
I've not seen patches in this particular are in a long, long, long,
LONG time.

> I expect that you, Eli, are likely our only hope
> anytime soon of addressing this problem.

I'm not your hope, I don't know enough about this stuff to redesign it
(assuming that there is a way of redesigning it and getting better
performance for the same level of support for various scripts).  All I
can is try to explain how to configure your system better using the
available features and tricks about which I do know.  That, and
applying some simple band-aid, like inhibit-compacting-font-caches,
from time to time, is all I can do, and am doing.

> Can Emacs not analyze the problem while it searches
> desperately for a font, and so be able to report
> about which fonts seem the most useless, least used,
> and least useful for Emacs?  That would help a user
> think about which fonts s?he might try removing.

From the little I know, there's no answer to that question, even if
you only ask about Emacs.  Of course, people install fonts for other
applications as well, and might not want to uninstall fonts that get
in Emacs's way.

No, the way to solve these problems is to either install a few more
fonts that complete/improve the coverage, and/or customize the
fontsets to make the font search more efficient.

> And beyond putting this burden on the user, can't
> such an analysis by Emacs be used by Emacs itself,
> to help it try to do the right thing by default -
> have it try dropping this or that font from its
> search?  IOW, can't Emacs learn about the set of
> fonts installed, and not blindly try each one
> everytime when trying to display a given char?

We don't have infrastructure for such analysis.  And I don't think we
have anyone on board with expertise to design and code it, even for a
single platform, let alone all of them.  "Patches welcome", of course.

> Why must the only "solution" be for a user to
> uninstall fonts?

See above: it's not the only one.  Not even the best, if you ask me.





  reply	other threads:[~2018-07-15 18:53 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-15  0:02 bug#32159: 26.1; inhibit-compacting-font-caches does not fix all fonts lagging issue Moses
2018-07-15  2:39 ` Eli Zaretskii
2018-07-15  5:50   ` Moses
2018-07-15 14:41     ` Eli Zaretskii
2018-07-16  2:35       ` Moses
2018-07-16  3:34         ` Eli Zaretskii
2018-07-17  1:38           ` Moses
2018-07-17  2:38             ` Eli Zaretskii
     [not found]     ` <<83in5ga7dc.fsf@gnu.org>
2018-07-15 16:50       ` Drew Adams
2018-07-15 18:53         ` Eli Zaretskii [this message]
2018-07-16  3:43           ` net june
2018-07-16 14:24             ` Eli Zaretskii
     [not found]     ` <<<83in5ga7dc.fsf@gnu.org>
     [not found]       ` <<0c4b0a47-267d-4c4d-8d1f-6a562ac7519b@default>
     [not found]         ` <<837elw9vp9.fsf@gnu.org>
2018-07-15 19:43           ` Drew Adams
2018-07-16 14:22             ` Eli Zaretskii
2018-07-17  2:13               ` Moses
2018-07-17  2:40                 ` Eli Zaretskii
2018-07-17  4:22                   ` Moses
2018-07-17 15:05                     ` Eli Zaretskii
2018-07-19 13:41                       ` Eli Zaretskii
2018-07-19 15:56                         ` Drew Adams
2018-07-22  5:45                       ` Moses
2018-07-22 14:06                         ` Eli Zaretskii
2018-07-22 14:52                           ` Moses
2018-07-22 15:14                             ` Eli Zaretskii
2018-07-22 15:41                               ` Moses
2018-07-22 16:02                                 ` Eli Zaretskii
2018-07-17 10:24 ` Andy Moreton
2018-07-17 15:52   ` 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=837elw9vp9.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=32159@debbugs.gnu.org \
    --cc=drew.adams@oracle.com \
    --cc=moses.mason@gmail.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.