(Vmac_ts_active_input_buf) [USE_MAC_TSM]: New variable.
[emacs.git] / lisp / language / indian.el
blob20046dacab5bf6724ffa7e4973b5cc38ceadb878
1 ;;; indian.el --- Indian languages support -*- coding: iso-2022-7bit; -*-
3 ;; Copyright (C) 1997, 1999, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
4 ;; Free Software Foundation, Inc.
5 ;; Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008
6 ;; National Institute of Advanced Industrial Science and Technology (AIST)
7 ;; Registration Number H14PRO021
9 ;; Maintainer: KAWABATA, Taichi <kawabata@m17n.org>
10 ;; Keywords: multilingual, i18n, Indian
12 ;; This file is part of GNU Emacs.
14 ;; GNU Emacs is free software; you can redistribute it and/or modify
15 ;; it under the terms of the GNU General Public License as published by
16 ;; the Free Software Foundation; either version 3, or (at your option)
17 ;; any later version.
19 ;; GNU Emacs is distributed in the hope that it will be useful,
20 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
21 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 ;; GNU General Public License for more details.
24 ;; You should have received a copy of the GNU General Public License
25 ;; along with GNU Emacs; see the file COPYING. If not, write to the
26 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
27 ;; Boston, MA 02110-1301, USA.
29 ;;; Commentary:
31 ;; This file defines in-is13194 coding system and relationship between
32 ;; indian-glyph character-set and various CDAC fonts.
34 ;;; Code:
36 (make-coding-system
37 'in-is13194 2 ?D
38 "8-bit encoding for ASCII (MSB=0) and IS13194-Devanagari (MSB=1)."
39 '(ascii indian-is13194 nil nil
40 nil ascii-eol)
41 `((safe-chars . ,(let ((table (make-char-table 'safe-chars nil)))
42 (set-char-table-range table 'indian-is13194 t)
43 (dotimes (i 127)
44 (aset table i t)
45 (aset table (decode-char 'ucs (+ #x900 i)) t))
46 table))
47 (post-read-conversion . in-is13194-post-read-conversion)
48 (pre-write-conversion . in-is13194-pre-write-conversion)))
50 (define-coding-system-alias 'devanagari 'in-is13194)
52 (defvar indian-font-foundry 'cdac
53 "Font foundry for Indian characters.
54 Currently supported foundries are `cdac' and `akruti'.")
56 (defvar indian-script-language-alist
57 '((devanagari (hindi sanskrit) nil)
58 (bengali (bengali assamese) nil)
59 (gurmukhi (punjabi) nil)
60 (gujarati (gujarati) nil)
61 (oriya (oriya) nil)
62 (tamil (tamil) nil)
63 (telugu (telugu) nil)
64 (kannada (kannada) nil)
65 (malayalam (malayalam) nil))
66 "Alist of Indian scripts vs the corresponding language list and font foundry.
67 Each element has this form:
69 (SCRIPT LANGUAGE-LIST FONT-FOUNDRY)
71 SCRIPT is one of Indian script names.
73 LANGUAGE-LIST is a list of Indian langauge names SCRIPT is used for.
74 The list is in the priority order.
76 FONT-FOUNDRY is a font foundry representing a group of Indian
77 fonts. If the value is nil, the value of `indian-font-foundry'
78 is used.")
80 (defconst indian-font-char-index-table
81 '( ; for which language(s)
82 ;; CDAC fonts
83 (#x0000 . cdac:dv-ttsurekh) ; hindi, etc
84 (#x0100 . cdac:sd-ttsurekh) ; sanskrit
85 (#x0200 . cdac:bn-ttdurga) ; bengali
86 (#x0300 . cdac:tm-ttvalluvar) ; tamil
87 (#x0400 . cdac:tl-tthemalatha) ; telugu
88 (#x0500 . cdac:as-ttdurga) ; assamese
89 (#x0600 . cdac:or-ttsarala) ; oriya
90 (#x0700 . cdac:kn-ttuma) ; kannada
91 (#x0800 . cdac:ml-ttkarthika) ; malayalam
92 (#x0900 . cdac:gj-ttavantika) ; gujarati
93 (#x0A00 . cdac:pn-ttamar) ; punjabi
95 ;; AKRUTI fonts
96 (#x0B00 . akruti:dev) ; hindi, etc
97 (#x0C00 . akruti:bng) ; bengali
98 (#x0D00 . akruti:pnj) ; punjabi
99 (#x0E00 . akruti:guj) ; gujarati
100 (#x0F00 . akruti:ori) ; oriya
101 (#x1000 . akruti:tml) ; tamil
102 (#x1100 . akruti:tlg) ; telugu
103 (#x1200 . akruti:knd) ; kannada
104 (#x1300 . akruti:mal) ; malayalam
106 "Alist of indices of `indian-glyph' character vs Indian font identifiers.
107 Each element has this form: (INDEX . FONT-IDENTIFIER)
109 INDEX is an index number of the first character in the charset
110 `indian-glyph' assigned for glyphs in the font specified by
111 FONT-IDENTIFIER. Currently FONT-IDENTIFIERs are defined for CDAC
112 and AKRUTI font groups.")
114 (defun indian-font-char (index font-identifier)
115 "Return character of charset `indian-glyph' made from glyph index INDEX.
116 FONT-IDENTIFIER is an identifier of an Indian font listed in the
117 variable `indian-font-char-index-table'. It specifies which
118 font INDEX is for."
119 (if (or (< index 0) (> index 255))
120 (error "Invalid glyph index: %d" index))
121 (let ((start (car (rassq font-identifier indian-font-char-index-table))))
122 (if (not start)
123 (error "Unknown font identifier: %s" font-identifier))
124 (setq index (+ start index))
125 (make-char 'indian-glyph (+ (/ index 96) 32) (+ (% index 96) 32))))
127 ;; Return a range of characters (cons of min and max character) of the
128 ;; charset `indian-glyph' for displaying SCRIPT in LANGUAGE by a font
129 ;; of FOUNDRY.
131 (defun indian-font-char-range (font-identifier)
132 (cons (indian-font-char 0 font-identifier)
133 (indian-font-char 255 font-identifier)))
135 (defvar indian-script-table
137 devanagari
138 sanskrit
139 bengali
140 tamil
141 telugu
142 assamese
143 oriya
144 kannada
145 malayalam
146 gujarati
147 punjabi
149 "Vector of Indian script names.")
151 (let ((len (length indian-script-table))
152 (i 0))
153 (while (< i len)
154 (put (aref indian-script-table i) 'indian-glyph-code-offset (* 256 i))
155 (setq i (1+ i))))
157 (defvar indian-default-script 'devanagari
158 "Default script for Indian languages.
159 Each Indian language environment sets this value
160 to one of `indian-script-table' (which see).
161 The default value is `devanagari'.")
163 (define-ccl-program ccl-encode-indian-glyph-font
165 ;; Shorten (r1 = (((((r1 - 32) * 96) + r2) - 32) % 256))
166 (r1 = ((((r1 * 96) + r2) - ,(+ (* 32 96) 32)) % 256))))
168 (setq font-ccl-encoder-alist
169 (cons (cons "-CDAC" 'ccl-encode-indian-glyph-font)
170 font-ccl-encoder-alist))
172 (setq font-ccl-encoder-alist
173 (cons (cons "-AKRUTI" 'ccl-encode-indian-glyph-font)
174 font-ccl-encoder-alist))
176 (provide 'indian)
178 ;;; arch-tag: 83aa8fc7-7ee2-4364-a6e5-498f5e3b8c2f
179 ;;; indian.el ends here