From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.help Subject: Re: script-representative-chars vs incomplete fonts Date: Sun, 12 Sep 2021 08:54:56 +0300 Message-ID: <83tuiqfidr.fsf@gnu.org> References: <878s02u5m6.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="23534"; mail-complaints-to="usenet@ciao.gmane.io" To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Sun Sep 12 07:55:46 2021 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mPISv-0005zL-Vw for geh-help-gnu-emacs@m.gmane-mx.org; Sun, 12 Sep 2021 07:55:45 +0200 Original-Received: from localhost ([::1]:36906 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mPISt-0000Vt-VN for geh-help-gnu-emacs@m.gmane-mx.org; Sun, 12 Sep 2021 01:55:43 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:49614) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mPISI-0000Vl-A7 for help-gnu-emacs@gnu.org; Sun, 12 Sep 2021 01:55:06 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:51518) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mPISI-0006QZ-1h for help-gnu-emacs@gnu.org; Sun, 12 Sep 2021 01:55:06 -0400 Original-Received: from 84.94.185.95.cable.012.net.il ([84.94.185.95]:3696 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mPISH-0003Ke-K9 for help-gnu-emacs@gnu.org; Sun, 12 Sep 2021 01:55:05 -0400 In-Reply-To: <878s02u5m6.fsf@gmail.com> (message from =?utf-8?Q?K=C3=A9vin?= Le Gouguec on Sun, 12 Sep 2021 00:09:21 +0200) X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:133002 Archived-At: > From: Kรฉvin Le Gouguec > 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.