Mercurial > emacs
annotate lisp/language/indian.el @ 90705:93c0415cf795
*** empty log message ***
author | Kenichi Handa <handa@m17n.org> |
---|---|
date | Thu, 30 Nov 2006 04:33:12 +0000 |
parents | f9a65d7ebd29 |
children | 6588c6259dfb |
rev | line source |
---|---|
41469 | 1 ;;; indian.el --- Indian languages support -*- coding: iso-2022-7bit; -*- |
17052 | 2 |
62396 | 3 ;; Copyright (C) 1997, 1999, 2001 Free Software Foundation, Inc. |
4 ;; Copyright (C) 2002, 2003 | |
5 ;; National Institute of Advanced Industrial Science and Technology (AIST) | |
6 ;; Registration Number H14PRO021 | |
17052 | 7 |
49704
003055ca7e13
Maintainer's mail address changed.
Kenichi Handa <handa@m17n.org>
parents:
47701
diff
changeset
|
8 ;; Maintainer: KAWABATA, Taichi <kawabata@m17n.org> |
42312 | 9 ;; Keywords: multilingual, i18n, Indian |
17052 | 10 |
11 ;; This file is part of GNU Emacs. | |
12 | |
13 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
14 ;; it under the terms of the GNU General Public License as published by | |
15 ;; the Free Software Foundation; either version 2, or (at your option) | |
16 ;; any later version. | |
17 | |
18 ;; GNU Emacs is distributed in the hope that it will be useful, | |
19 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
20 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
21 ;; GNU General Public License for more details. | |
22 | |
23 ;; You should have received a copy of the GNU General Public License | |
17314
f438ebf1c679
Fix FSF address in comment.
Kenichi Handa <handa@m17n.org>
parents:
17300
diff
changeset
|
24 ;; along with GNU Emacs; see the file COPYING. If not, write to the |
64085 | 25 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
26 ;; Boston, MA 02110-1301, USA. | |
17052 | 27 |
28 ;;; Commentary: | |
29 | |
41469 | 30 ;; This file defines in-is13194 coding system and relationship between |
31 ;; indian-glyph character-set and various CDAC fonts. | |
17052 | 32 |
33 ;;; Code: | |
34 | |
88414
fad0f879877f
Call define-coding-system instead of make-coding-system. All CCL program deleted.
Kenichi Handa <handa@m17n.org>
parents:
42312
diff
changeset
|
35 (define-coding-system 'in-is13194-devanagari |
fad0f879877f
Call define-coding-system instead of make-coding-system. All CCL program deleted.
Kenichi Handa <handa@m17n.org>
parents:
42312
diff
changeset
|
36 "8-bit encoding for ASCII (MSB=0) and IS13194-Devanagari (MSB=1)." |
fad0f879877f
Call define-coding-system instead of make-coding-system. All CCL program deleted.
Kenichi Handa <handa@m17n.org>
parents:
42312
diff
changeset
|
37 :coding-type 'iso-2022 |
fad0f879877f
Call define-coding-system instead of make-coding-system. All CCL program deleted.
Kenichi Handa <handa@m17n.org>
parents:
42312
diff
changeset
|
38 :mnemonic ?D |
fad0f879877f
Call define-coding-system instead of make-coding-system. All CCL program deleted.
Kenichi Handa <handa@m17n.org>
parents:
42312
diff
changeset
|
39 :designation [ascii indian-is13194 nil nil] |
fad0f879877f
Call define-coding-system instead of make-coding-system. All CCL program deleted.
Kenichi Handa <handa@m17n.org>
parents:
42312
diff
changeset
|
40 :charset-list '(ascii indian-is13194) |
89239
976a610d28e1
(in-is13194-devanagari): Fix
Kenichi Handa <handa@m17n.org>
parents:
89095
diff
changeset
|
41 :post-read-conversion 'in-is13194-post-read-conversion |
976a610d28e1
(in-is13194-devanagari): Fix
Kenichi Handa <handa@m17n.org>
parents:
89095
diff
changeset
|
42 :pre-write-conversion 'in-is13194-pre-write-conversion) |
17052 | 43 |
88414
fad0f879877f
Call define-coding-system instead of make-coding-system. All CCL program deleted.
Kenichi Handa <handa@m17n.org>
parents:
42312
diff
changeset
|
44 (define-coding-system-alias 'devanagari 'in-is13194-devanagari) |
46743
d341cac00baf
(in-is13194): Give correct `safe-chars' property.
Kenichi Handa <handa@m17n.org>
parents:
42312
diff
changeset
|
45 |
50256
104cf4fa2a8e
(indian-font-foundry): New variable.
Kenichi Handa <handa@m17n.org>
parents:
49704
diff
changeset
|
46 (defvar indian-font-foundry 'cdac |
104cf4fa2a8e
(indian-font-foundry): New variable.
Kenichi Handa <handa@m17n.org>
parents:
49704
diff
changeset
|
47 "Font foundry for Indian characters. |
104cf4fa2a8e
(indian-font-foundry): New variable.
Kenichi Handa <handa@m17n.org>
parents:
49704
diff
changeset
|
48 Currently supported foundries are `cdac' and `akruti'.") |
104cf4fa2a8e
(indian-font-foundry): New variable.
Kenichi Handa <handa@m17n.org>
parents:
49704
diff
changeset
|
49 |
104cf4fa2a8e
(indian-font-foundry): New variable.
Kenichi Handa <handa@m17n.org>
parents:
49704
diff
changeset
|
50 (defvar indian-script-language-alist |
57537
b9687fdf909d
(indian-script-language-alist): Swap value and doc.
Kim F. Storm <storm@cua.dk>
parents:
52401
diff
changeset
|
51 '((devanagari (hindi sanskrit) nil) |
b9687fdf909d
(indian-script-language-alist): Swap value and doc.
Kim F. Storm <storm@cua.dk>
parents:
52401
diff
changeset
|
52 (bengali (bengali assamese) nil) |
b9687fdf909d
(indian-script-language-alist): Swap value and doc.
Kim F. Storm <storm@cua.dk>
parents:
52401
diff
changeset
|
53 (gurmukhi (punjabi) nil) |
b9687fdf909d
(indian-script-language-alist): Swap value and doc.
Kim F. Storm <storm@cua.dk>
parents:
52401
diff
changeset
|
54 (gujarati (gujarati) nil) |
b9687fdf909d
(indian-script-language-alist): Swap value and doc.
Kim F. Storm <storm@cua.dk>
parents:
52401
diff
changeset
|
55 (oriya (oriya) nil) |
b9687fdf909d
(indian-script-language-alist): Swap value and doc.
Kim F. Storm <storm@cua.dk>
parents:
52401
diff
changeset
|
56 (tamil (tamil) nil) |
b9687fdf909d
(indian-script-language-alist): Swap value and doc.
Kim F. Storm <storm@cua.dk>
parents:
52401
diff
changeset
|
57 (telugu (telugu) nil) |
b9687fdf909d
(indian-script-language-alist): Swap value and doc.
Kim F. Storm <storm@cua.dk>
parents:
52401
diff
changeset
|
58 (kannada (kannada) nil) |
b9687fdf909d
(indian-script-language-alist): Swap value and doc.
Kim F. Storm <storm@cua.dk>
parents:
52401
diff
changeset
|
59 (malayalam (malayalam) nil)) |
50256
104cf4fa2a8e
(indian-font-foundry): New variable.
Kenichi Handa <handa@m17n.org>
parents:
49704
diff
changeset
|
60 "Alist of Indian scripts vs the corresponding language list and font foundry. |
104cf4fa2a8e
(indian-font-foundry): New variable.
Kenichi Handa <handa@m17n.org>
parents:
49704
diff
changeset
|
61 Each element has this form: |
104cf4fa2a8e
(indian-font-foundry): New variable.
Kenichi Handa <handa@m17n.org>
parents:
49704
diff
changeset
|
62 |
104cf4fa2a8e
(indian-font-foundry): New variable.
Kenichi Handa <handa@m17n.org>
parents:
49704
diff
changeset
|
63 (SCRIPT LANGUAGE-LIST FONT-FOUNDRY) |
104cf4fa2a8e
(indian-font-foundry): New variable.
Kenichi Handa <handa@m17n.org>
parents:
49704
diff
changeset
|
64 |
104cf4fa2a8e
(indian-font-foundry): New variable.
Kenichi Handa <handa@m17n.org>
parents:
49704
diff
changeset
|
65 SCRIPT is one of Indian script names. |
104cf4fa2a8e
(indian-font-foundry): New variable.
Kenichi Handa <handa@m17n.org>
parents:
49704
diff
changeset
|
66 |
104cf4fa2a8e
(indian-font-foundry): New variable.
Kenichi Handa <handa@m17n.org>
parents:
49704
diff
changeset
|
67 LANGUAGE-LIST is a list of Indian langauge names SCRIPT is used for. |
104cf4fa2a8e
(indian-font-foundry): New variable.
Kenichi Handa <handa@m17n.org>
parents:
49704
diff
changeset
|
68 The list is in the priority order. |
104cf4fa2a8e
(indian-font-foundry): New variable.
Kenichi Handa <handa@m17n.org>
parents:
49704
diff
changeset
|
69 |
104cf4fa2a8e
(indian-font-foundry): New variable.
Kenichi Handa <handa@m17n.org>
parents:
49704
diff
changeset
|
70 FONT-FOUNDRY is a font foundry representing a group of Indian |
104cf4fa2a8e
(indian-font-foundry): New variable.
Kenichi Handa <handa@m17n.org>
parents:
49704
diff
changeset
|
71 fonts. If the value is nil, the value of `indian-font-foundry' |
57537
b9687fdf909d
(indian-script-language-alist): Swap value and doc.
Kim F. Storm <storm@cua.dk>
parents:
52401
diff
changeset
|
72 is used.") |
50256
104cf4fa2a8e
(indian-font-foundry): New variable.
Kenichi Handa <handa@m17n.org>
parents:
49704
diff
changeset
|
73 |
104cf4fa2a8e
(indian-font-foundry): New variable.
Kenichi Handa <handa@m17n.org>
parents:
49704
diff
changeset
|
74 (defconst indian-font-char-index-table |
104cf4fa2a8e
(indian-font-foundry): New variable.
Kenichi Handa <handa@m17n.org>
parents:
49704
diff
changeset
|
75 '( ; for which language(s) |
104cf4fa2a8e
(indian-font-foundry): New variable.
Kenichi Handa <handa@m17n.org>
parents:
49704
diff
changeset
|
76 ;; CDAC fonts |
104cf4fa2a8e
(indian-font-foundry): New variable.
Kenichi Handa <handa@m17n.org>
parents:
49704
diff
changeset
|
77 (#x0000 . cdac:dv-ttsurekh) ; hindi, etc |
104cf4fa2a8e
(indian-font-foundry): New variable.
Kenichi Handa <handa@m17n.org>
parents:
49704
diff
changeset
|
78 (#x0100 . cdac:sd-ttsurekh) ; sanskrit |
104cf4fa2a8e
(indian-font-foundry): New variable.
Kenichi Handa <handa@m17n.org>
parents:
49704
diff
changeset
|
79 (#x0200 . cdac:bn-ttdurga) ; bengali |
50388
40bda6ae386e
(indian-font-char-index-table): Fix the
Kenichi Handa <handa@m17n.org>
parents:
50256
diff
changeset
|
80 (#x0300 . cdac:tm-ttvalluvar) ; tamil |
40bda6ae386e
(indian-font-char-index-table): Fix the
Kenichi Handa <handa@m17n.org>
parents:
50256
diff
changeset
|
81 (#x0400 . cdac:tl-tthemalatha) ; telugu |
40bda6ae386e
(indian-font-char-index-table): Fix the
Kenichi Handa <handa@m17n.org>
parents:
50256
diff
changeset
|
82 (#x0500 . cdac:as-ttdurga) ; assamese |
50256
104cf4fa2a8e
(indian-font-foundry): New variable.
Kenichi Handa <handa@m17n.org>
parents:
49704
diff
changeset
|
83 (#x0600 . cdac:or-ttsarala) ; oriya |
50388
40bda6ae386e
(indian-font-char-index-table): Fix the
Kenichi Handa <handa@m17n.org>
parents:
50256
diff
changeset
|
84 (#x0700 . cdac:kn-ttuma) ; kannada |
40bda6ae386e
(indian-font-char-index-table): Fix the
Kenichi Handa <handa@m17n.org>
parents:
50256
diff
changeset
|
85 (#x0800 . cdac:ml-ttkarthika) ; malayalam |
40bda6ae386e
(indian-font-char-index-table): Fix the
Kenichi Handa <handa@m17n.org>
parents:
50256
diff
changeset
|
86 (#x0900 . cdac:gj-ttavantika) ; gujarati |
40bda6ae386e
(indian-font-char-index-table): Fix the
Kenichi Handa <handa@m17n.org>
parents:
50256
diff
changeset
|
87 (#x0A00 . cdac:pn-ttamar) ; punjabi |
50256
104cf4fa2a8e
(indian-font-foundry): New variable.
Kenichi Handa <handa@m17n.org>
parents:
49704
diff
changeset
|
88 |
104cf4fa2a8e
(indian-font-foundry): New variable.
Kenichi Handa <handa@m17n.org>
parents:
49704
diff
changeset
|
89 ;; AKRUTI fonts |
104cf4fa2a8e
(indian-font-foundry): New variable.
Kenichi Handa <handa@m17n.org>
parents:
49704
diff
changeset
|
90 (#x0B00 . akruti:dev) ; hindi, etc |
104cf4fa2a8e
(indian-font-foundry): New variable.
Kenichi Handa <handa@m17n.org>
parents:
49704
diff
changeset
|
91 (#x0C00 . akruti:bng) ; bengali |
104cf4fa2a8e
(indian-font-foundry): New variable.
Kenichi Handa <handa@m17n.org>
parents:
49704
diff
changeset
|
92 (#x0D00 . akruti:pnj) ; punjabi |
104cf4fa2a8e
(indian-font-foundry): New variable.
Kenichi Handa <handa@m17n.org>
parents:
49704
diff
changeset
|
93 (#x0E00 . akruti:guj) ; gujarati |
104cf4fa2a8e
(indian-font-foundry): New variable.
Kenichi Handa <handa@m17n.org>
parents:
49704
diff
changeset
|
94 (#x0F00 . akruti:ori) ; oriya |
104cf4fa2a8e
(indian-font-foundry): New variable.
Kenichi Handa <handa@m17n.org>
parents:
49704
diff
changeset
|
95 (#x1000 . akruti:tml) ; tamil |
104cf4fa2a8e
(indian-font-foundry): New variable.
Kenichi Handa <handa@m17n.org>
parents:
49704
diff
changeset
|
96 (#x1100 . akruti:tlg) ; telugu |
104cf4fa2a8e
(indian-font-foundry): New variable.
Kenichi Handa <handa@m17n.org>
parents:
49704
diff
changeset
|
97 (#x1200 . akruti:knd) ; kannada |
104cf4fa2a8e
(indian-font-foundry): New variable.
Kenichi Handa <handa@m17n.org>
parents:
49704
diff
changeset
|
98 (#x1300 . akruti:mal) ; malayalam |
104cf4fa2a8e
(indian-font-foundry): New variable.
Kenichi Handa <handa@m17n.org>
parents:
49704
diff
changeset
|
99 ) |
57537
b9687fdf909d
(indian-script-language-alist): Swap value and doc.
Kim F. Storm <storm@cua.dk>
parents:
52401
diff
changeset
|
100 "Alist of indices of `indian-glyph' character vs Indian font identifiers. |
50256
104cf4fa2a8e
(indian-font-foundry): New variable.
Kenichi Handa <handa@m17n.org>
parents:
49704
diff
changeset
|
101 Each element has this form: (INDEX . FONT-IDENTIFIER) |
104cf4fa2a8e
(indian-font-foundry): New variable.
Kenichi Handa <handa@m17n.org>
parents:
49704
diff
changeset
|
102 |
104cf4fa2a8e
(indian-font-foundry): New variable.
Kenichi Handa <handa@m17n.org>
parents:
49704
diff
changeset
|
103 INDEX is an index number of the first character in the charset |
104cf4fa2a8e
(indian-font-foundry): New variable.
Kenichi Handa <handa@m17n.org>
parents:
49704
diff
changeset
|
104 `indian-glyph' assigned for glyphs in the font specified by |
104cf4fa2a8e
(indian-font-foundry): New variable.
Kenichi Handa <handa@m17n.org>
parents:
49704
diff
changeset
|
105 FONT-IDENTIFIER. Currently FONT-IDENTIFIERs are defined for CDAC |
104cf4fa2a8e
(indian-font-foundry): New variable.
Kenichi Handa <handa@m17n.org>
parents:
49704
diff
changeset
|
106 and AKRUTI font groups.") |
57537
b9687fdf909d
(indian-script-language-alist): Swap value and doc.
Kim F. Storm <storm@cua.dk>
parents:
52401
diff
changeset
|
107 |
50256
104cf4fa2a8e
(indian-font-foundry): New variable.
Kenichi Handa <handa@m17n.org>
parents:
49704
diff
changeset
|
108 (defun indian-font-char (index font-identifier) |
104cf4fa2a8e
(indian-font-foundry): New variable.
Kenichi Handa <handa@m17n.org>
parents:
49704
diff
changeset
|
109 "Return character of charset `indian-glyph' made from glyph index INDEX. |
104cf4fa2a8e
(indian-font-foundry): New variable.
Kenichi Handa <handa@m17n.org>
parents:
49704
diff
changeset
|
110 FONT-IDENTIFIER is an identifier of an Indian font listed in the |
104cf4fa2a8e
(indian-font-foundry): New variable.
Kenichi Handa <handa@m17n.org>
parents:
49704
diff
changeset
|
111 variable `indian-font-char-index-table'. It specifies which |
104cf4fa2a8e
(indian-font-foundry): New variable.
Kenichi Handa <handa@m17n.org>
parents:
49704
diff
changeset
|
112 font INDEX is for." |
104cf4fa2a8e
(indian-font-foundry): New variable.
Kenichi Handa <handa@m17n.org>
parents:
49704
diff
changeset
|
113 (if (or (< index 0) (> index 255)) |
104cf4fa2a8e
(indian-font-foundry): New variable.
Kenichi Handa <handa@m17n.org>
parents:
49704
diff
changeset
|
114 (error "Invalid glyph index: %d" index)) |
104cf4fa2a8e
(indian-font-foundry): New variable.
Kenichi Handa <handa@m17n.org>
parents:
49704
diff
changeset
|
115 (let ((start (car (rassq font-identifier indian-font-char-index-table)))) |
104cf4fa2a8e
(indian-font-foundry): New variable.
Kenichi Handa <handa@m17n.org>
parents:
49704
diff
changeset
|
116 (if (not start) |
104cf4fa2a8e
(indian-font-foundry): New variable.
Kenichi Handa <handa@m17n.org>
parents:
49704
diff
changeset
|
117 (error "Unknown font identifier: %s" font-identifier)) |
104cf4fa2a8e
(indian-font-foundry): New variable.
Kenichi Handa <handa@m17n.org>
parents:
49704
diff
changeset
|
118 (setq index (+ start index)) |
104cf4fa2a8e
(indian-font-foundry): New variable.
Kenichi Handa <handa@m17n.org>
parents:
49704
diff
changeset
|
119 (make-char 'indian-glyph (+ (/ index 96) 32) (+ (% index 96) 32)))) |
104cf4fa2a8e
(indian-font-foundry): New variable.
Kenichi Handa <handa@m17n.org>
parents:
49704
diff
changeset
|
120 |
104cf4fa2a8e
(indian-font-foundry): New variable.
Kenichi Handa <handa@m17n.org>
parents:
49704
diff
changeset
|
121 ;; Return a range of characters (cons of min and max character) of the |
104cf4fa2a8e
(indian-font-foundry): New variable.
Kenichi Handa <handa@m17n.org>
parents:
49704
diff
changeset
|
122 ;; charset `indian-glyph' for displaying SCRIPT in LANGUAGE by a font |
104cf4fa2a8e
(indian-font-foundry): New variable.
Kenichi Handa <handa@m17n.org>
parents:
49704
diff
changeset
|
123 ;; of FOUNDRY. |
104cf4fa2a8e
(indian-font-foundry): New variable.
Kenichi Handa <handa@m17n.org>
parents:
49704
diff
changeset
|
124 |
104cf4fa2a8e
(indian-font-foundry): New variable.
Kenichi Handa <handa@m17n.org>
parents:
49704
diff
changeset
|
125 (defun indian-font-char-range (font-identifier) |
104cf4fa2a8e
(indian-font-foundry): New variable.
Kenichi Handa <handa@m17n.org>
parents:
49704
diff
changeset
|
126 (cons (indian-font-char 0 font-identifier) |
104cf4fa2a8e
(indian-font-foundry): New variable.
Kenichi Handa <handa@m17n.org>
parents:
49704
diff
changeset
|
127 (indian-font-char 255 font-identifier))) |
57537
b9687fdf909d
(indian-script-language-alist): Swap value and doc.
Kim F. Storm <storm@cua.dk>
parents:
52401
diff
changeset
|
128 |
41469 | 129 (defvar indian-script-table |
130 '[ | |
131 devanagari | |
132 sanskrit | |
133 bengali | |
134 tamil | |
135 telugu | |
136 assamese | |
137 oriya | |
138 kannada | |
139 malayalam | |
140 gujarati | |
141 punjabi | |
142 ] | |
143 "Vector of Indian script names.") | |
17052 | 144 |
41469 | 145 (let ((len (length indian-script-table)) |
146 (i 0)) | |
147 (while (< i len) | |
148 (put (aref indian-script-table i) 'indian-glyph-code-offset (* 256 i)) | |
149 (setq i (1+ i)))) | |
17052 | 150 |
41469 | 151 (defvar indian-default-script 'devanagari |
152 "Default script for Indian languages. | |
153 Each Indian language environment sets this value | |
154 to one of `indian-script-table' (which see). | |
155 The default value is `devanagari'.") | |
17052 | 156 |
89297
4a475cc23487
(indian-composable-pattern): New variable.
Kenichi Handa <handa@m17n.org>
parents:
89239
diff
changeset
|
157 (defvar indian-composable-pattern |
4a475cc23487
(indian-composable-pattern): New variable.
Kenichi Handa <handa@m17n.org>
parents:
89239
diff
changeset
|
158 (make-char-table nil) |
4a475cc23487
(indian-composable-pattern): New variable.
Kenichi Handa <handa@m17n.org>
parents:
89239
diff
changeset
|
159 "Char table of regexps for composable Indian character sequence.") |
50256
104cf4fa2a8e
(indian-font-foundry): New variable.
Kenichi Handa <handa@m17n.org>
parents:
49704
diff
changeset
|
160 |
33778 | 161 (provide 'indian) |
41469 | 162 |
52401 | 163 ;;; arch-tag: 83aa8fc7-7ee2-4364-a6e5-498f5e3b8c2f |
17052 | 164 ;;; indian.el ends here |