emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master b54be60: Avoid fonts with incomplete coverage of MATHEMATICAL cha


From: Lars Ingebrigtsen
Subject: master b54be60: Avoid fonts with incomplete coverage of MATHEMATICAL chars
Date: Sat, 30 Oct 2021 08:45:15 -0400 (EDT)

branch: master
commit b54be604bf8ad67346a82a0755349ffa8a715a11
Author: Kévin Le Gouguec <kevin.legouguec@gmail.com>
Commit: Lars Ingebrigtsen <larsi@gnus.org>

    Avoid fonts with incomplete coverage of MATHEMATICAL chars
    
    * lisp/international/fontset.el (setup-default-fontset): Include both
    ends of each sub-range in 'script-representative-chars' (bug#51495).
    
    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 | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/lisp/international/fontset.el b/lisp/international/fontset.el
index fcd22e0..7c3a7cd 100644
--- a/lisp/international/fontset.el
+++ b/lisp/international/fontset.el
@@ -816,11 +816,16 @@
                           (#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"



reply via email to

[Prev in Thread] Current Thread [Next in Thread]