summaryrefslogtreecommitdiff
path: root/lisp/composite.el
diff options
context:
space:
mode:
authorKenichi Handa <handa@m17n.org>2009-02-04 02:00:34 +0000
committerKenichi Handa <handa@m17n.org>2009-02-04 02:00:34 +0000
commit8da437855b51da955fae489c92c8e18773eb1890 (patch)
treede20532a5c2169909143a06ddb311249e43e06bc /lisp/composite.el
parent4cb75c4b12afcc18c7ee5384e668e0be0ab656b4 (diff)
downloademacs-8da437855b51da955fae489c92c8e18773eb1890.tar.gz
(compose-gstring-for-terminal): If a character is
not supported by the current terminal, don't make a multi-glyph grapheme cluster. (auto-compose-chars): Check font-object by fontp.
Diffstat (limited to 'lisp/composite.el')
-rw-r--r--lisp/composite.el55
1 files changed, 36 insertions, 19 deletions
diff --git a/lisp/composite.el b/lisp/composite.el
index c37a37e18e0..537adab6e90 100644
--- a/lisp/composite.el
+++ b/lisp/composite.el
@@ -664,28 +664,45 @@ a prepending a space before it."
(nchars (lgstring-char-len gstring))
(nglyphs (lgstring-glyph-len gstring))
(i 0)
+ (coding (lgstring-font gstring))
glyph)
(while (and (< i nglyphs)
(setq glyph (lgstring-glyph gstring i)))
- (if (= (lglyph-width glyph) 0)
+ (if (not (char-charset (lglyph-char glyph) coding))
(progn
- ;; Compose by prepending a space.
- (setq gstring (lgstring-insert-glyph gstring i (lglyph-copy glyph))
- nglyphs (lgstring-glyph-len gstring))
- (lglyph-set-char (lgstring-glyph gstring i) 32)
- (setq i (+ 2)))
- (let ((from (lglyph-from glyph))
- (to (lglyph-to glyph))
- (j (1+ i)))
- (while (and (< j nglyphs)
- (setq glyph (lgstring-glyph gstring j))
- (= (lglyph-width glyph) 0))
- (setq to (lglyph-to glyph)
- j (1+ j)))
- (while (< i j)
- (setq glyph (lgstring-glyph gstring i))
- (lglyph-set-from-to glyph from to)
- (setq i (1+ i))))))
+ ;; As the terminal doesn't support this glyph, return a
+ ;; gstring in which each glyph is its own graphme-cluster
+ ;; of width 1..
+ (setq i 0)
+ (while (and (< i nglyphs)
+ (setq glyph (lgstring-glyph gstring i)))
+ (if (< (lglyph-width glyph) 1)
+ (lglyph-set-width glyph 1))
+ (lglyph-set-from-to glyph i i)
+ (setq i (1+ i))))
+ (if (= (lglyph-width glyph) 0)
+ (progn
+ ;; Compose by prepending a space.
+ (setq gstring (lgstring-insert-glyph gstring i
+ (lglyph-copy glyph))
+ nglyphs (lgstring-glyph-len gstring))
+ (setq glyph (lgstring-glyph gstring i))
+ (lglyph-set-char glyph 32)
+ (lglyph-set-width glyph 1)
+ (setq i (+ 2)))
+ (let ((from (lglyph-from glyph))
+ (to (lglyph-to glyph))
+ (j (1+ i)))
+ (while (and (< j nglyphs)
+ (setq glyph (lgstring-glyph gstring j))
+ (char-charset (lglyph-char glyph) coding)
+ (= (lglyph-width glyph) 0))
+ (setq to (lglyph-to glyph)
+ j (1+ j)))
+ (while (< i j)
+ (setq glyph (lgstring-glyph gstring i))
+ (lglyph-set-from-to glyph from to)
+ (setq i (1+ i)))))))
gstring))
@@ -709,7 +726,7 @@ This function is the default value of `auto-composition-function' (which see)."
(let ((gstring (composition-get-gstring from to font-object string)))
(if (lgstring-shaped-p gstring)
gstring
- (or font-object
+ (or (fontp font-object 'font-object)
(setq func 'compose-gstring-for-terminal))
(funcall func gstring))))