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