all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: help-gnu-emacs@gnu.org
Subject: Re: script-representative-chars vs incomplete fonts
Date: Sun, 12 Sep 2021 08:54:56 +0300	[thread overview]
Message-ID: <83tuiqfidr.fsf@gnu.org> (raw)
In-Reply-To: <878s02u5m6.fsf@gmail.com> (message from Kévin Le Gouguec on Sun, 12 Sep 2021 00:09:21 +0200)

> From: Kévin Le Gouguec <kevin.legouguec@gmail.com>
> Date: Sun, 12 Sep 2021 00:09:21 +0200
> 
> IIUC, fontset.el sets up script-representative-chars so that any font
> providing U+1D49C "𝒜" can be used for the whole "mathematical-script"
> range (U+1D49C–U+1D4CF "𝒜–𝓏").

No, script-representative-chars is used to _reject_ fonts that don't
suit our needs.  The candidate fonts should be selected by your font
backend, and selected wisely.

> On my system, I happen to have
> 
> - one font (KpMath) that provides U+1D49C–U+1D4B5 (the "capital" chars),
>   but not U+1D4B6–U+1D4CF (the "small" chars),
> 
> - another font (DejaVu Math TeX Gyre) that provides both sub-ranges[1].
> 
> As luck would have it, when trying to display a char in this range,
> Emacs stumbles on KpMath first

It's not Emacs that stumbles on that font, it's your font backend
(probably fontconfig?).  Emacs just verifies that the candidate fonts
returned by the backend satisfy the requirements, and uses the first
font that does.  So this might mean a bug report for fontconfig and/or
the font designers is in order.

> The situation is not irremediable; I've thought of at least 3
> workarounds[2].  I do wonder though if this situation is something Emacs
> should guard against by default, and if so, with what heuristics?

If there are strange fonts that support only portions of that Unicode
block, the easiest solution is to add more representative characters.

> E.g. in fontset.el, would it be overkill to break down the 52-char
> ranges in the math-subgroup loop into 2 26-char ranges in order to
> always add the "SMALL A" codepoints to script-representative-chars?

What would be the purpose of breaking that range?
script-representative-chars can specify multiple characters per
script, see its doc string.

>     1. (push #x1D4CF (alist-get 'mathematical-script
>                                 script-representative-chars))
>     2. (set-fontset-font
>         t 'mathematical "DejaVu Math TeX Gyre" nil 'prepend)
>     3. Uninstall KpMath.

I'd suggest to do 3 regardless.  A font that supports only part of a
block is a bad font to have.

Emacs should probably do the equivalent of 1, and the solution for
end-users is 2, of course; messing with script-representative-chars is
not recommended.



  reply	other threads:[~2021-09-12  5:54 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-11 22:09 script-representative-chars vs incomplete fonts Kévin Le Gouguec
2021-09-12  5:54 ` Eli Zaretskii [this message]
2021-09-12 17:08   ` Kévin Le Gouguec
2021-09-12 17:30     ` Eli Zaretskii
2021-09-12 22:21       ` Kévin Le Gouguec
2021-09-13 17:09         ` Eli Zaretskii
2021-09-13 22:46           ` Kévin Le Gouguec
2021-09-14 11:25             ` 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=83tuiqfidr.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=help-gnu-emacs@gnu.org \
    /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.