summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEli Zaretskii <eliz@gnu.org>2020-10-31 12:40:25 +0200
committerEli Zaretskii <eliz@gnu.org>2020-10-31 12:40:25 +0200
commit66ceb148c7d90be71ead193306a4aa2d1f55674c (patch)
tree87c63c54f7b7f7dfde6d0c1dc819cd1075e506e2
parentdc16c70bada4c8520b8363d3df154dd6dd389ef9 (diff)
downloademacs-66ceb148c7d90be71ead193306a4aa2d1f55674c.tar.gz
Support prettified display of fractional numbers
* lisp/composite.el (composition-function-table): Define an entry for U+2044 FRACTION SLASH, for prettier display of fractional numbers.
-rw-r--r--lisp/composite.el13
1 files changed, 12 insertions, 1 deletions
diff --git a/lisp/composite.el b/lisp/composite.el
index 47d91c5d212..0a8dcb875c9 100644
--- a/lisp/composite.el
+++ b/lisp/composite.el
@@ -747,7 +747,18 @@ All non-spacing characters have this function in
unicode-category-table))
;; for dotted-circle
(aset composition-function-table #x25CC
- `([,(purecopy ".\\c^") 0 compose-gstring-for-dotted-circle])))
+ `([,(purecopy ".\\c^") 0 compose-gstring-for-dotted-circle]))
+ ;; For prettier display of fractions
+ (set-char-table-range
+ composition-function-table
+ #x2044
+ ;; We use font-shape-gstring so that if the font doesn't support
+ ;; fractional display, the characters are shown separately, not as
+ ;; a composed cluster.
+ (list (vector (purecopy "[1-9][0-9][0-9]\u2044[0-9]+")
+ 3 'font-shape-gstring)
+ (vector (purecopy "[1-9][0-9]\u2044[0-9]+") 2 'font-shape-gstring)
+ (vector (purecopy "[1-9]\u2044[0-9]+") 1 'font-shape-gstring))))
(defun compose-gstring-for-terminal (gstring _direction)
"Compose glyph-string GSTRING for terminal display.