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