diff options
| author | Kenichi Handa | 2009-02-04 02:00:34 +0000 |
|---|---|---|
| committer | Kenichi Handa | 2009-02-04 02:00:34 +0000 |
| commit | 8da437855b51da955fae489c92c8e18773eb1890 (patch) | |
| tree | de20532a5c2169909143a06ddb311249e43e06bc | |
| parent | 4cb75c4b12afcc18c7ee5384e668e0be0ab656b4 (diff) | |
| download | emacs-8da437855b51da955fae489c92c8e18773eb1890.tar.gz emacs-8da437855b51da955fae489c92c8e18773eb1890.zip | |
(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.
| -rw-r--r-- | lisp/composite.el | 55 |
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." | |||
| 664 | (nchars (lgstring-char-len gstring)) | 664 | (nchars (lgstring-char-len gstring)) |
| 665 | (nglyphs (lgstring-glyph-len gstring)) | 665 | (nglyphs (lgstring-glyph-len gstring)) |
| 666 | (i 0) | 666 | (i 0) |
| 667 | (coding (lgstring-font gstring)) | ||
| 667 | glyph) | 668 | glyph) |
| 668 | (while (and (< i nglyphs) | 669 | (while (and (< i nglyphs) |
| 669 | (setq glyph (lgstring-glyph gstring i))) | 670 | (setq glyph (lgstring-glyph gstring i))) |
| 670 | (if (= (lglyph-width glyph) 0) | 671 | (if (not (char-charset (lglyph-char glyph) coding)) |
| 671 | (progn | 672 | (progn |
| 672 | ;; Compose by prepending a space. | 673 | ;; As the terminal doesn't support this glyph, return a |
| 673 | (setq gstring (lgstring-insert-glyph gstring i (lglyph-copy glyph)) | 674 | ;; gstring in which each glyph is its own graphme-cluster |
| 674 | nglyphs (lgstring-glyph-len gstring)) | 675 | ;; of width 1.. |
| 675 | (lglyph-set-char (lgstring-glyph gstring i) 32) | 676 | (setq i 0) |
| 676 | (setq i (+ 2))) | 677 | (while (and (< i nglyphs) |
| 677 | (let ((from (lglyph-from glyph)) | 678 | (setq glyph (lgstring-glyph gstring i))) |
| 678 | (to (lglyph-to glyph)) | 679 | (if (< (lglyph-width glyph) 1) |
| 679 | (j (1+ i))) | 680 | (lglyph-set-width glyph 1)) |
| 680 | (while (and (< j nglyphs) | 681 | (lglyph-set-from-to glyph i i) |
| 681 | (setq glyph (lgstring-glyph gstring j)) | 682 | (setq i (1+ i)))) |
| 682 | (= (lglyph-width glyph) 0)) | 683 | (if (= (lglyph-width glyph) 0) |
| 683 | (setq to (lglyph-to glyph) | 684 | (progn |
| 684 | j (1+ j))) | 685 | ;; Compose by prepending a space. |
| 685 | (while (< i j) | 686 | (setq gstring (lgstring-insert-glyph gstring i |
| 686 | (setq glyph (lgstring-glyph gstring i)) | 687 | (lglyph-copy glyph)) |
| 687 | (lglyph-set-from-to glyph from to) | 688 | nglyphs (lgstring-glyph-len gstring)) |
| 688 | (setq i (1+ i)))))) | 689 | (setq glyph (lgstring-glyph gstring i)) |
| 690 | (lglyph-set-char glyph 32) | ||
| 691 | (lglyph-set-width glyph 1) | ||
| 692 | (setq i (+ 2))) | ||
| 693 | (let ((from (lglyph-from glyph)) | ||
| 694 | (to (lglyph-to glyph)) | ||
| 695 | (j (1+ i))) | ||
| 696 | (while (and (< j nglyphs) | ||
| 697 | (setq glyph (lgstring-glyph gstring j)) | ||
| 698 | (char-charset (lglyph-char glyph) coding) | ||
| 699 | (= (lglyph-width glyph) 0)) | ||
| 700 | (setq to (lglyph-to glyph) | ||
| 701 | j (1+ j))) | ||
| 702 | (while (< i j) | ||
| 703 | (setq glyph (lgstring-glyph gstring i)) | ||
| 704 | (lglyph-set-from-to glyph from to) | ||
| 705 | (setq i (1+ i))))))) | ||
| 689 | gstring)) | 706 | gstring)) |
| 690 | 707 | ||
| 691 | 708 | ||
| @@ -709,7 +726,7 @@ This function is the default value of `auto-composition-function' (which see)." | |||
| 709 | (let ((gstring (composition-get-gstring from to font-object string))) | 726 | (let ((gstring (composition-get-gstring from to font-object string))) |
| 710 | (if (lgstring-shaped-p gstring) | 727 | (if (lgstring-shaped-p gstring) |
| 711 | gstring | 728 | gstring |
| 712 | (or font-object | 729 | (or (fontp font-object 'font-object) |
| 713 | (setq func 'compose-gstring-for-terminal)) | 730 | (setq func 'compose-gstring-for-terminal)) |
| 714 | (funcall func gstring)))) | 731 | (funcall func gstring)))) |
| 715 | 732 | ||