diff options
| author | Kenichi Handa | 2014-06-28 10:34:17 +0900 |
|---|---|---|
| committer | Kenichi Handa | 2014-06-28 10:34:17 +0900 |
| commit | 1fc00e5c9e87c88b4b253692d6ade822f6d74d3e (patch) | |
| tree | 88a3063f7ea7573c00550b513bc178f94b8ed871 | |
| parent | 5335a8ced5a44befa20b759b73c900856defa0d7 (diff) | |
| download | emacs-1fc00e5c9e87c88b4b253692d6ade822f6d74d3e.tar.gz emacs-1fc00e5c9e87c88b4b253692d6ade822f6d74d3e.zip | |
Fix Bug#17739.
* composite.el: Setup composition-function-table for dotted circle.
(compose-gstring-for-dotted-circle): New function.
* international/characters.el: Add category "^" to all
non-spacing characters.
| -rw-r--r-- | lisp/ChangeLog | 10 | ||||
| -rw-r--r-- | lisp/composite.el | 48 | ||||
| -rw-r--r-- | lisp/international/characters.el | 12 |
3 files changed, 64 insertions, 6 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index c243c6ea3ef..2c0f9814b4d 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,13 @@ | |||
| 1 | 2014-06-28 K. Handa <handa@gnu.org> | ||
| 2 | |||
| 3 | Fix Bug#17739. | ||
| 4 | |||
| 5 | * composite.el: Setup composition-function-table for dotted circle. | ||
| 6 | (compose-gstring-for-dotted-circle): New function. | ||
| 7 | |||
| 8 | * international/characters.el: Add category "^" to all | ||
| 9 | non-spacing characters. | ||
| 10 | |||
| 1 | 2014-06-15 Stefan Monnier <monnier@iro.umontreal.ca> | 11 | 2014-06-15 Stefan Monnier <monnier@iro.umontreal.ca> |
| 2 | 12 | ||
| 3 | * ses.el: Miscellaneous cleanups; use lexical-binding; avoid | 13 | * ses.el: Miscellaneous cleanups; use lexical-binding; avoid |
diff --git a/lisp/composite.el b/lisp/composite.el index b46d41a0aa4..666d6c9dd91 100644 --- a/lisp/composite.el +++ b/lisp/composite.el | |||
| @@ -671,6 +671,49 @@ All non-spacing characters have this function in | |||
| 671 | (setq i (1+ i)))) | 671 | (setq i (1+ i)))) |
| 672 | gstring)))))) | 672 | gstring)))))) |
| 673 | 673 | ||
| 674 | (defun compose-gstring-for-dotted-circle (gstring) | ||
| 675 | (let* ((dc (lgstring-glyph gstring 0)) ; glyph of dotted-circle | ||
| 676 | (dc-id (lglyph-code dc)) | ||
| 677 | (fc (lgstring-glyph gstring 1)) ; glyph of the following char | ||
| 678 | (fc-id (lglyph-code fc)) | ||
| 679 | (gstr (and nil (font-shape-gstring gstring)))) | ||
| 680 | (if (and gstr | ||
| 681 | (or (= (lgstring-glyph-len gstr) 1) | ||
| 682 | (and (= (lgstring-glyph-len gstr) 2) | ||
| 683 | (= (lglyph-to (lgstring-glyph gstr 0)) | ||
| 684 | (lglyph-to (lgstring-glyph gstr 1)))))) | ||
| 685 | ;; It seems that font-shape-gstring has composed glyphs. | ||
| 686 | gstr | ||
| 687 | ;; Artificially compose the following glyph with the preceding | ||
| 688 | ;; dotted-circle. | ||
| 689 | (setq dc (lgstring-glyph gstring 0) | ||
| 690 | fc (lgstring-glyph gstring 1)) | ||
| 691 | (let ((dc-width (lglyph-width dc)) | ||
| 692 | (fc-width (- (lglyph-rbearing fc) (lglyph-lbearing fc))) | ||
| 693 | (from (lglyph-from dc)) | ||
| 694 | (to (lglyph-to fc)) | ||
| 695 | (xoff 0) (yoff 0) (width 0)) | ||
| 696 | (if (and (< (lglyph-descent fc) 0) | ||
| 697 | (> (lglyph-ascent dc) (- (lglyph-descent fc)))) | ||
| 698 | ;; Set YOFF so that the following glyph is put on top of | ||
| 699 | ;; the dotted-circle. | ||
| 700 | (setq yoff (- (- (lglyph-descent fc)) (lglyph-ascent dc)))) | ||
| 701 | (if (> (lglyph-width fc) 0) | ||
| 702 | (setq xoff (- (lglyph-rbearing fc)))) | ||
| 703 | (if (< dc-width fc-width) | ||
| 704 | ;; The following glyph is wider, but we don't know how to | ||
| 705 | ;; align both glyphs. So, try the easiet method; | ||
| 706 | ;; i.e. align left edges of the glyphs. | ||
| 707 | (setq xoff (- xoff (- dc-width) (- (lglyph-lbearing fc ))) | ||
| 708 | width (- fc-width dc-width))) | ||
| 709 | (if (or (/= xoff 0) (/= yoff 0) (/= width 0) (/= (lglyph-width fc) 0)) | ||
| 710 | (lglyph-set-adjustment fc xoff yoff width)) | ||
| 711 | (lglyph-set-from-to dc from to) | ||
| 712 | (lglyph-set-from-to fc from to)) | ||
| 713 | (if (> (lgstring-glyph-len gstring) 2) | ||
| 714 | (lgstring-set-glyph gstring 2 nil)) | ||
| 715 | gstring))) | ||
| 716 | |||
| 674 | ;; Allow for bootstrapping without uni-*.el. | 717 | ;; Allow for bootstrapping without uni-*.el. |
| 675 | (when unicode-category-table | 718 | (when unicode-category-table |
| 676 | (let ((elt `([,(purecopy "\\c.\\c^+") 1 compose-gstring-for-graphic] | 719 | (let ((elt `([,(purecopy "\\c.\\c^+") 1 compose-gstring-for-graphic] |
| @@ -679,7 +722,10 @@ All non-spacing characters have this function in | |||
| 679 | #'(lambda (key val) | 722 | #'(lambda (key val) |
| 680 | (if (memq val '(Mn Mc Me)) | 723 | (if (memq val '(Mn Mc Me)) |
| 681 | (set-char-table-range composition-function-table key elt))) | 724 | (set-char-table-range composition-function-table key elt))) |
| 682 | unicode-category-table))) | 725 | unicode-category-table)) |
| 726 | ;; for dotted-circle | ||
| 727 | (aset composition-function-table #x25CC | ||
| 728 | `([,(purecopy ".\\c^") 0 compose-gstring-for-dotted-circle]))) | ||
| 683 | 729 | ||
| 684 | (defun compose-gstring-for-terminal (gstring) | 730 | (defun compose-gstring-for-terminal (gstring) |
| 685 | "Compose glyph-string GSTRING for terminal display. | 731 | "Compose glyph-string GSTRING for terminal display. |
diff --git a/lisp/international/characters.el b/lisp/international/characters.el index 63b2b4f0eda..03b55c1eb5f 100644 --- a/lisp/international/characters.el +++ b/lisp/international/characters.el | |||
| @@ -1359,11 +1359,13 @@ Setup char-width-table appropriate for non-CJK language environment." | |||
| 1359 | (when (setq unicode-category-table | 1359 | (when (setq unicode-category-table |
| 1360 | (unicode-property-table-internal 'general-category)) | 1360 | (unicode-property-table-internal 'general-category)) |
| 1361 | (map-char-table #'(lambda (key val) | 1361 | (map-char-table #'(lambda (key val) |
| 1362 | (if (and val | 1362 | (if val |
| 1363 | (or (and (/= (aref (symbol-name val) 0) ?M) | 1363 | (cond ((or (and (/= (aref (symbol-name val) 0) ?M) |
| 1364 | (/= (aref (symbol-name val) 0) ?C)) | 1364 | (/= (aref (symbol-name val) 0) ?C)) |
| 1365 | (eq val 'Zs))) | 1365 | (eq val 'Zs)) |
| 1366 | (modify-category-entry key ?.))) | 1366 | (modify-category-entry key ?.)) |
| 1367 | ((eq val 'Mn) | ||
| 1368 | (modify-category-entry key ?^))))) | ||
| 1367 | unicode-category-table)) | 1369 | unicode-category-table)) |
| 1368 | 1370 | ||
| 1369 | (optimize-char-table (standard-category-table)) | 1371 | (optimize-char-table (standard-category-table)) |