Mercurial > emacs
annotate lisp/language/tv-util.el @ 111861:869f03cdb254
Fix bug #1077 with popping new frames from a minibuffer-only frame.
menu-bar.el (menu-bar-frame-for-menubar, menu-bar-positive-p):
New functions.
(menu-bar-showhide-menu) <menu-bar-mode, showhide-tool-bar>: Use
them instead of `nil' and `>', respectively.
(menu-bar-showhide-tool-bar-menu): Use menu-bar-frame-for-menubar
instead of `nil'.
(toggle-menu-bar-mode-from-frame): Use menu-bar-frame-for-menubar
and menu-bar-positive-p instead of `nil' and `>', respectively.
author | Eli Zaretskii <eliz@gnu.org> |
---|---|
date | Thu, 09 Dec 2010 21:07:53 +0200 |
parents | 5b6eec51e45e |
children | 417b1e4d63cd |
rev | line source |
---|---|
90938 | 1 ;;; tv-util.el --- support for Tai Viet -*- coding: utf-8 -*- |
2 | |
106815 | 3 ;; Copyright (C) 2007, 2008, 2009, 2010 |
90938 | 4 ;; National Institute of Advanced Industrial Science and Technology (AIST) |
5 ;; Registration Number H13PRO009 | |
6 | |
7 ;; Keywords: multilingual, Tai Viet, i18n | |
8 | |
9 ;; This file is part of GNU Emacs. | |
10 | |
94665
55b7f25d920a
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
91437
diff
changeset
|
11 ;; GNU Emacs is free software: you can redistribute it and/or modify |
90938 | 12 ;; it under the terms of the GNU General Public License as published by |
94665
55b7f25d920a
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
91437
diff
changeset
|
13 ;; the Free Software Foundation, either version 3 of the License, or |
55b7f25d920a
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
91437
diff
changeset
|
14 ;; (at your option) any later version. |
90938 | 15 |
16 ;; GNU Emacs is distributed in the hope that it will be useful, | |
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
19 ;; GNU General Public License for more details. | |
20 | |
21 ;; You should have received a copy of the GNU General Public License | |
94665
55b7f25d920a
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
91437
diff
changeset
|
22 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. |
90938 | 23 |
24 ;;; Code | |
25 | |
26 ;; Regexp matching with a sequence of Tai Viet characters. | |
109365
5b6eec51e45e
* language/tv-util.el (tai-viet-re): Remove format.
Andreas Schwab <schwab@linux-m68k.org>
parents:
106815
diff
changeset
|
27 (defconst tai-viet-re "[\xaa80-\xaac2\xaadb-\xaadf]+") |
90938 | 28 |
29 ;; Char-table of information about glyph type of Tai Viet characters. | |
30 (defconst tai-viet-glyph-info | |
31 (let ((table (make-char-table nil)) | |
32 (specials '((right-overhang . "ꪊꪋꪌꪍꪏꪓꪖꪜꪞꪡꪤꪨ") | |
33 (left-overhang . "ꫂ") | |
34 (combining-vowel . "ꪴꪰꪲꪳꪷꪸꪾ") | |
91217
9cf3b1c148b9
(tai-viet-re): Include '-'.
Kenichi Handa <handa@m17n.org>
parents:
90950
diff
changeset
|
35 (combining-tone . "꪿꫁") |
9cf3b1c148b9
(tai-viet-re): Include '-'.
Kenichi Handa <handa@m17n.org>
parents:
90950
diff
changeset
|
36 (misc . "-")))) |
90938 | 37 ;; Set all TaiViet characters to `t'. |
38 (set-char-table-range table (cons #xaa80 #xaac2) t) | |
39 (set-char-table-range table (cons #xaadb #xaadf) t) | |
40 ;; Overwrite it for special characters. | |
41 (dolist (elt specials) | |
42 (let ((category (car elt)) | |
43 (chars (cdr elt))) | |
44 (dotimes (i (length chars)) | |
45 (aset table (aref chars i) category)))) | |
46 table)) | |
47 | |
48 (defun tai-viet-compose-string (from to string) | |
49 "Compose Tai Viet characters in STRING between indices FROM and TO." | |
50 (let* ((ch (aref string from)) | |
51 (info (aref tai-viet-glyph-info ch)) | |
52 prev-info) | |
53 (if (eq info 'non-spacing) | |
54 (compose-string string from (1+ from) (string ch ?\t))) | |
55 (setq from (1+ from) prev-info info) | |
56 (while (and (< from to) | |
90949 | 57 (>= #xaa80 (setq ch (aref string from))) |
58 (<= #xaaDF ch)) | |
90938 | 59 (setq info (aref tai-viet-glyph-info ch)) |
60 (if (and (eq info 'non-spacing) | |
61 (eq prev-info 'non-spacing)) | |
62 (compose-string from (1+ from) (string ?\t ch))) | |
63 (setq from (1+ from) prev-info info)) | |
64 (if (eq info 'right-overhang) | |
65 (compose-string string (1- from) from (string ch ?\t))) | |
66 from)) | |
67 | |
68 (defun tai-viet-compose-region (from to) | |
69 "Compose Tai Viet characters in the region between FROM and TO." | |
70 (decompose-region from to) | |
71 (let ((normal-rule '(Br . Bl)) | |
72 (tone-rule '(tr . bl)) | |
73 (prev-viet nil) | |
74 ch info pos components overhang) | |
75 (while (< from to) | |
76 (or ch | |
77 (setq ch (char-after from) | |
78 info (aref tai-viet-glyph-info ch))) | |
79 (setq from (1+ from)) | |
80 (if (not info) | |
81 (setq prev-viet nil | |
82 ch nil) | |
83 (if (memq info '(combining-vowel combining-tone)) | |
84 (progn | |
85 ;; Display this as a spacing glyph. | |
86 (compose-region (1- from) from (string ?\t ch)) | |
87 (setq prev-viet t | |
88 ch nil)) | |
89 (setq pos (1- from) | |
90 components ch | |
91 overhang (if (eq info 'right-overhang) | |
92 'right-overhang | |
93 (if (and (not prev-viet) (eq info 'left-overhang)) | |
94 'left-overhang)) | |
95 prev-viet t | |
96 ch nil) | |
97 (if (and (< from to) | |
98 (setq ch (char-after from) | |
99 info (aref tai-viet-glyph-info ch))) | |
100 (if (memq info '(combining-vowel combining-tone)) | |
101 (progn | |
102 (setq components | |
103 (list components normal-rule ch) | |
104 from (1+ from) | |
105 ch nil) | |
106 (if (and (< from to) | |
107 (setq ch (char-after from) | |
108 info (aref tai-viet-glyph-info ch)) | |
109 (eq info 'combining-tone)) | |
110 (setq components (nconc components | |
111 (list tone-rule ch)) | |
112 from (1+ from))) | |
113 (if (eq overhang 'left-overhang) | |
114 (setq components (cons ?\t | |
115 (cons normal-rule components))) | |
116 (if (and (eq overhang 'right-overhang) | |
117 (>= from to)) | |
118 (setq components (nconc components | |
119 (list normal-rule ?\t))))) | |
120 (compose-region pos from components)) | |
121 (if (eq overhang 'left-overhang) | |
122 (compose-region pos from (string ?\t components)))) | |
123 (if (eq overhang 'left-overhang) | |
124 (compose-region pos from (string ?\t components)) | |
125 (if (and (eq overhang 'right-overhang) (>= from to)) | |
126 (compose-region pos from (string components ?\t)))))))) | |
127 from)) | |
128 | |
129 | |
130 ;;;###autoload | |
91277
0dfd79b5e5c5
(tai-viet-composition-function): Fix
Kenichi Handa <handa@m17n.org>
parents:
91217
diff
changeset
|
131 (defun tai-viet-composition-function (from to font-object string) |
0dfd79b5e5c5
(tai-viet-composition-function): Fix
Kenichi Handa <handa@m17n.org>
parents:
91217
diff
changeset
|
132 (if string |
0dfd79b5e5c5
(tai-viet-composition-function): Fix
Kenichi Handa <handa@m17n.org>
parents:
91217
diff
changeset
|
133 (if (string-match tai-viet-re string from) |
0dfd79b5e5c5
(tai-viet-composition-function): Fix
Kenichi Handa <handa@m17n.org>
parents:
91217
diff
changeset
|
134 (tai-viet-compose-string from (match-end 0) string)) |
0dfd79b5e5c5
(tai-viet-composition-function): Fix
Kenichi Handa <handa@m17n.org>
parents:
91217
diff
changeset
|
135 (goto-char from) |
0dfd79b5e5c5
(tai-viet-composition-function): Fix
Kenichi Handa <handa@m17n.org>
parents:
91217
diff
changeset
|
136 (if (looking-at tai-viet-re) |
0dfd79b5e5c5
(tai-viet-composition-function): Fix
Kenichi Handa <handa@m17n.org>
parents:
91217
diff
changeset
|
137 (tai-viet-compose-region from (match-end 0))))) |
90938 | 138 |
139 ;; | |
140 (provide 'tai-viet-util) | |
90950 | 141 |
142 ;; arch-tag: a45ac3fc-07d0-44d5-8841-2ebea7e11f5b |