Commit | Line | Data |
---|---|---|
0fbd9496 | 1 | ;;; lao.el --- support for Lao -*- coding: utf-8; no-byte-compile: t -*- |
d92d0128 | 2 | |
95df8112 | 3 | ;; Copyright (C) 2001-2011 Free Software Foundation, Inc. |
ba87a680 | 4 | ;; Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, |
5df4f04c | 5 | ;; 2007, 2008, 2009, 2010, 2011 |
eaa61218 KH |
6 | ;; National Institute of Advanced Industrial Science and Technology (AIST) |
7 | ;; Registration Number H14PRO021 | |
8f924df7 KH |
8 | ;; Copyright (C) 2003 |
9 | ;; National Institute of Advanced Industrial Science and Technology (AIST) | |
10 | ;; Registration Number H13PRO009 | |
d92d0128 KH |
11 | |
12 | ;; Keywords: multilingual, Lao | |
13 | ||
14 | ;; This file is part of GNU Emacs. | |
15 | ||
4936186e | 16 | ;; GNU Emacs is free software: you can redistribute it and/or modify |
d92d0128 | 17 | ;; it under the terms of the GNU General Public License as published by |
4936186e GM |
18 | ;; the Free Software Foundation, either version 3 of the License, or |
19 | ;; (at your option) any later version. | |
d92d0128 KH |
20 | |
21 | ;; GNU Emacs is distributed in the hope that it will be useful, | |
22 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
23 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
24 | ;; GNU General Public License for more details. | |
25 | ||
26 | ;; You should have received a copy of the GNU General Public License | |
4936186e | 27 | ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. |
d92d0128 | 28 | |
60370d40 PJ |
29 | ;;; Commentary: |
30 | ||
d92d0128 KH |
31 | ;;; Code: |
32 | ||
e1915ab3 KH |
33 | (define-coding-system 'lao |
34 | "8-bit encoding for ASCII (MSB=0) and LAO (MSB=1)." | |
35 | :coding-type 'charset | |
36 | :mnemonic ?L | |
37 | :charset-list '(lao)) | |
d92d0128 | 38 | |
d92d0128 | 39 | (set-language-info-alist |
a564ccf9 | 40 | "Lao" '((charset lao) |
a79a3c79 KH |
41 | (coding-system lao) |
42 | (coding-priority lao) | |
a564ccf9 | 43 | (input-method . "lao") |
a564ccf9 KH |
44 | (unibyte-display . lao) |
45 | (features lao-util) | |
78eee0ed | 46 | (documentation . t))) |
d92d0128 | 47 | |
0fbd9496 KH |
48 | (let ((consonant "ກ-ຮໜໝ") |
49 | (tone "່-໌") | |
50 | (vowel-upper-lower "ັິ-ົໍ") | |
51 | (semivowel-lower "ຼ") | |
52 | (fallback-rule [nil 0 compose-gstring-for-graphic])) | |
53 | ;; target characters regexp | |
54 | ;; ----------------- ------ | |
55 | (dolist (l `((,vowel-upper-lower . "[c].[t]?") | |
56 | (,tone . "[c].") | |
57 | (,semivowel-lower . "[c].[v][t]?") | |
58 | (,semivowel-lower . "[c].[t]"))) | |
59 | (let* ((chars (car l)) | |
60 | (len (length chars)) | |
61 | ;; Replace `c', `t', `v' to consonant, tone, and vowel. | |
62 | (regexp (mapconcat #'(lambda (c) | |
63 | (cond ((= c ?c) consonant) | |
64 | ((= c ?t) tone) | |
65 | ((= c ?v) vowel-upper-lower) | |
66 | (t (string c)))) | |
67 | (cdr l) "")) | |
68 | ;; Element of composition-function-table. | |
69 | (elt (list (vector regexp 1 'lao-composition-function) | |
70 | fallback-rule)) | |
71 | ch) | |
72 | (dotimes (i len) | |
73 | (setq ch (aref chars i)) | |
74 | (if (and (> i 1) (= (aref chars (1- i)) ?-)) | |
75 | ;; End of character range. | |
76 | (set-char-table-range composition-function-table | |
77 | (cons (aref chars (- i 2)) ch) elt) | |
78 | (if (or (= (1+ i) len) | |
79 | (and (/= ch ?-) (/= (aref chars (1+ i)) ?-))) | |
80 | ;; A character not forming a range. | |
81 | (set-char-table-range composition-function-table ch elt))))))) | |
86e2a803 | 82 | |
41da80b1 DL |
83 | (provide 'lao) |
84 | ||
d92d0128 | 85 | ;;; lao.el ends here |