From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?UTF-8?Q?K=C3=A9vin?= Le Gouguec Newsgroups: gmane.emacs.bugs Subject: bug#51495: 29.0.50; [PATCH] Avoid fonts with incomplete coverage of MATHEMATICAL chars Date: Fri, 29 Oct 2021 23:43:34 +0200 Message-ID: <875ytfv75l.fsf@gmail.com> References: <87fssjv7ag.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="19645"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) To: 51495@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Oct 30 00:02:14 2021 Return-path: Envelope-to: geb-bug-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 1mgZwz-0004wO-Mw for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 30 Oct 2021 00:02:13 +0200 Original-Received: from localhost ([::1]:46278 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mgZwy-0005Pi-Mh for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 29 Oct 2021 18:02:12 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:60086) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mgZfQ-00029L-IL for bug-gnu-emacs@gnu.org; Fri, 29 Oct 2021 17:44:04 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:44639) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mgZfQ-0008J3-7r for bug-gnu-emacs@gnu.org; Fri, 29 Oct 2021 17:44:04 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mgZfO-0006U0-69 for bug-gnu-emacs@gnu.org; Fri, 29 Oct 2021 17:44:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: =?UTF-8?Q?K=C3=A9vin?= Le Gouguec Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 29 Oct 2021 21:44:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 51495 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 51495-submit@debbugs.gnu.org id=B51495.163554382424874 (code B ref 51495); Fri, 29 Oct 2021 21:44:02 +0000 Original-Received: (at 51495) by debbugs.gnu.org; 29 Oct 2021 21:43:44 +0000 Original-Received: from localhost ([127.0.0.1]:56184 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mgZf6-0006T7-4G for submit@debbugs.gnu.org; Fri, 29 Oct 2021 17:43:44 -0400 Original-Received: from mail-wr1-f44.google.com ([209.85.221.44]:33661) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mgZf3-0006Sp-KY for 51495@debbugs.gnu.org; Fri, 29 Oct 2021 17:43:42 -0400 Original-Received: by mail-wr1-f44.google.com with SMTP id m22so18838208wrb.0 for <51495@debbugs.gnu.org>; Fri, 29 Oct 2021 14:43:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:subject:references:date:in-reply-to:message-id:user-agent :mime-version; bh=KVzEWaUFWqbCSeG2sG5MFpdlNKh0fZTTsPG8IZ/tTnI=; b=e6MsbWUhtk/pdex5wrDNrm6cNh0HxZ87es4OPbNP8zqjWruF4ajzAX52M6oMAhetY4 /T4/FvUD4pY1TY77JehncNqjXuxx5XsmodQ6WfIAK2qjB3UEqoOZf0foav1e9wQ6nKFu sc/ar2Oc/zwCaJAdgVZJsaTGyBasB0rmOQO9vKNkfurrutqiuqMh4b/wvlSe1QiS4dHH UKA2Z9URvwHIxj6l56i0RJm2eKoVRWunuXOezi163FiiaRxg5V1nZ/PmGOu+bcyq2e7/ VnODlPFNlNOuuxFOJVh9M13cDMFXIDmbo2MA+dk04Hg9Dfhzd5wPILC3KLW97h5KQM42 ZNwg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=KVzEWaUFWqbCSeG2sG5MFpdlNKh0fZTTsPG8IZ/tTnI=; b=PihByjsbxvsgJQpZ1vHZuAtyldJZrbzDPcOSKHPv0LzBG7J0zbXdOyAbMPK2fC1ivW lLd7oCKfWZqBQgMJnrtvXmbKxbCBCTGGZujBFMwFUbs2D4gu2iqYUkm2U4piInSMWRTx xziG8ikWk062Ym4OuP1hn/uHkhGVGNda28e/622H2sY/R2uk5qKBuz/oGK7S7vErV3V+ 8p+RizIxnwe2NQYrJbnUZiJh566OSFPYc3ZtN+8SFtO7brgskrNEqtx3WESJH8egyL3V EAt0yN90s284u9dEY0qCLUEc0CqBelWjYt8cMgI1abPucJBOuknMlbh/KUwSH6GTzWEQ UHig== X-Gm-Message-State: AOAM5303VBx54Uw6749MGUTwSukGPTXB3UaJO0pZGJvJMlIYQsXZaiYu y+GFq9AxLLolV4fAaB/cBaSO/5Z0hDo= X-Google-Smtp-Source: ABdhPJxMBG21oPXkwfTWa8djg3AdKpnEF2GxtdzQxb30FBvEkHNEFekFnbtpDxlFWTGSTZJ4cItX7g== X-Received: by 2002:a05:600c:ad8:: with SMTP id c24mr14072550wmr.82.1635543815341; Fri, 29 Oct 2021 14:43:35 -0700 (PDT) Original-Received: from amdahl30 ([2a01:e0a:253:fe0:2ef0:5dff:fed2:7b49]) by smtp.gmail.com with ESMTPSA id j8sm310574wrh.16.2021.10.29.14.43.34 for <51495@debbugs.gnu.org> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Oct 2021 14:43:34 -0700 (PDT) In-Reply-To: <87fssjv7ag.fsf@gmail.com> ("=?UTF-8?Q?K=C3=A9vin?= Le Gouguec"'s message of "Fri, 29 Oct 2021 23:40:39 +0200") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:218598 Archived-At: --=-=-= Content-Type: text/plain And the Patch That Was Promised, slightly polished compared to the one posted in help-gnu-emacs[1]. I know that debbugs.el does not make it easy[2], but it'd be nice if the rationale (the bit between the summary line and the changelog entries) made it into the final commit message. It's not essential, since I added an explanatory comment to the code so that one can find the rationale without reaching for the changelog, but the proposed commit message also provides further references if needed. Again, thanks for your time. --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-Avoid-fonts-with-incomplete-coverage-of-MATHEMATICAL.patch >From 73d82879c3516444888ec613a72fa27119fd7851 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Le=20Gouguec?= Date: Mon, 11 Oct 2021 23:32:28 +0200 Subject: [PATCH] Avoid fonts with incomplete coverage of MATHEMATICAL chars Some fonts include glyphs for MATHEMATICAL SCRIPT CAPITAL codepoints (#x1D49C-#x1D4B5) but not for MATHEMATICAL SCRIPT SMALL codepoints (#x1D4B6-#x1D4CF), see e.g. KpMath[1]. 'script-representative-chars' must thus include both CAPITAL and SMALL codepoints to ensure that we filter those fonts out. Bug#51495; discussed in help-gnu-emacs[2]. [1] https://mirrors.ctan.org/fonts/kpfonts-otf/doc/unimath-kpfonts.pdf [2] <878s02u5m6.fsf@gmail.com> https://lists.gnu.org/archive/html/help-gnu-emacs/2021-09/msg00150.html * lisp/international/fontset.el (setup-default-fontset): Include both ends of each sub-range in 'script-representative-chars'. --- lisp/international/fontset.el | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/lisp/international/fontset.el b/lisp/international/fontset.el index fcd22e09d2..7c3a7cd1a9 100644 --- a/lisp/international/fontset.el +++ b/lisp/international/fontset.el @@ -816,11 +816,16 @@ setup-default-fontset (#x1D7EC #x1D7F5 mathematical-sans-serif-bold) (#x1D7F6 #x1D7FF mathematical-monospace))) (let ((slot (assq (nth 2 math-subgroup) script-representative-chars))) + ;; Add both ends of each subgroup to help filter out some + ;; incomplete fonts, e.g. those that cover MATHEMATICAL SCRIPT + ;; CAPITAL glyphs but not MATHEMATICAL SCRIPT SMALL ones. (if slot - (if (vectorp (cdr slot)) - (setcdr slot (vconcat (cdr slot) (vector (car math-subgroup)))) - (setcdr slot (vector (cadr slot) (car math-subgroup)))) - (setq slot (list (nth 2 math-subgroup) (car math-subgroup))) + (setcdr slot (append (list (nth 0 math-subgroup) + (nth 1 math-subgroup)) + (cdr slot))) + (setq slot (list (nth 2 math-subgroup) + (nth 0 math-subgroup) + (nth 1 math-subgroup))) (nconc script-representative-chars (list slot)))) (set-fontset-font "fontset-default" -- 2.33.0 --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable [1] Added an explanatory comment; used nth consistently instead of car/cadr/nth to make the logic more obvious. (pcase-dolist would make it even more obvious; should I send a followup patch or would that be overkill?) [2] One of the many reasons it took me=E2=80=A6 gee, more than a month? to = post this patch, is my (on-and-off, still ongoing) attempt to teach debbugs-gnu.el to keep this rationale, since it's been stripped from my previous patches[3][4][5]. It's slow going, mostly because I go back and forth between a "conservative" approach (introducing a variable similar to debbugs-gnu-patch-subject) and an "impotent rage" approach (=C2=AB Why not just call git am?? I made the patch with format-patch, like CONTRIBUTE says; why are we even parsing it?! Is this our lot? Did we fly too close to the sun and burn our wings? Must we toil endlessly, craft regexp after regexp, until the trumpets blow and sweet armageddon delivers us from the cycle of re-search-forward? What am I (looking-at)? Hath (eobp) finally come? (forward-line) I go, forever more, UNTIL THE FIRE OF A THOUSAND "^[*]" CLEANSES MY CURSED SOUL =C2=BB). [3] https://debbugs.gnu.org/35564#231 Compare with f8d8d28bc6. [4] https://debbugs.gnu.org/41810#26 (patch 1) Compare with elpa.git 01e7d1fe21. [5] And then there was bug#39504, although the "root cause" for this one was attaching more than one patch to a single message. --=-=-=--