emacs-diffs
[Top][All Lists]
Advanced

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

master 75a91a0: Unicode integrals in Calc


From: Mattias Engdegård
Subject: master 75a91a0: Unicode integrals in Calc
Date: Sun, 6 Dec 2020 07:13:46 -0500 (EST)

branch: master
commit 75a91a0bb5236b049a5ea07488da5721ec5a3214
Author: Mattias Engdegård <mattiase@acm.org>
Commit: Mattias Engdegård <mattiase@acm.org>

    Unicode integrals in Calc
    
    * lisp/calc/calccomp.el (math-compose-integ): Use Unicode integral
    signs when available instead of a crude ASCII approximation, with a
    shorter stem to save space.
---
 lisp/calc/calccomp.el | 37 ++++++++++++++++++++++++++++---------
 1 file changed, 28 insertions(+), 9 deletions(-)

diff --git a/lisp/calc/calccomp.el b/lisp/calc/calccomp.el
index e4f6e98..0631eb4 100644
--- a/lisp/calc/calccomp.el
+++ b/lisp/calc/calccomp.el
@@ -1054,17 +1054,36 @@
                                         (nth 1 a)) 185))
              (calc-language 'flat)
              (low (and (nth 3 a) (math-compose-expr (nth 3 a) 0)))
-             (high (and (nth 4 a) (math-compose-expr (nth 4 a) 0))))
+             (high (and (nth 4 a) (math-compose-expr (nth 4 a) 0)))
+              ;; Check if we have Unicode integral top/bottom parts.
+              (fancy (and (char-displayable-p ?⌠)
+                          (char-displayable-p ?⌡)))
+              ;; If we do, find the most suitable middle part.
+              (fancy-stem (cond ((not fancy))
+                                ;; U+23AE INTEGRAL EXTENSION
+                                ((char-displayable-p ?⎮) "⎮ ")
+                                ;; U+2502 BOX DRAWINGS LIGHT VERTICAL
+                                ((char-displayable-p ?│) "│ ")
+                                ;; U+007C VERTICAL LINE
+                                (t "| "))))
         (list 'horiz
               (if parens "(" "")
-              (append (list 'vcent (if high 3 2))
-                      (and high (list (list 'horiz "  " high)))
-                      '("  /"
-                        " | "
-                        " | "
-                        " | "
-                        "/  ")
-                      (and low (list (list 'horiz low "  "))))
+              (append (list 'vcent (if fancy
+                                        (if high 2 1)
+                                      (if high 3 2)))
+                      (and high (list (if fancy
+                                           (list 'horiz high " ")
+                                         (list 'horiz "  " high))))
+                       (if fancy
+                           (list "⌠ " fancy-stem "⌡ ")
+                        '("  /"
+                          " | "
+                          " | "
+                          " | "
+                          "/  "))
+                      (and low (list (if fancy
+                                          (list 'horiz low " ")
+                                        (list 'horiz low "  ")))))
               expr
               (if over
                   ""



reply via email to

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