1 ;;; indian.el --- Indian languages support -*- coding: iso-2022-7bit; -*-
3 ;; Copyright (C) 1999, 2001 Free Software Foundation, Inc.
5 ;; Maintainer: KAWABATA, Taichi <kawabata@m17n.org>
6 ;; Keywords: multilingual, i18n, Indian
8 ;; This file is part of GNU Emacs.
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)
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.
20 ;; You should have received a copy of the GNU General Public License
21 ;; along with GNU Emacs; see the file COPYING. If not, write to the
22 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
23 ;; Boston, MA 02111-1307, USA.
27 ;; This file defines in-is13194 coding system and relationship between
28 ;; indian-glyph character-set and various CDAC fonts.
34 "8-bit encoding for ASCII (MSB=0) and IS13194-Devanagari (MSB=1)."
35 '(ascii indian-is13194 nil nil
37 `((safe-chars .
,(let ((table (make-char-table 'safe-chars nil
)))
38 (set-char-table-range table
'indian-is13194 t
)
41 (aset table
(decode-char 'ucs
(+ #x900 i
)) t
))
43 (post-read-conversion . in-is13194-post-read-conversion
)
44 (pre-write-conversion . in-is13194-pre-write-conversion
)))
46 (define-coding-system-alias 'devanagari
'in-is13194
)
48 (defvar indian-font-foundry
'cdac
49 "Font foundry for Indian characters.
50 Currently supported foundries are `cdac' and `akruti'.")
52 (defvar indian-script-language-alist
53 '((devanagari (hindi sanskrit
) nil
)
54 (bengali (bengali assamese
) nil
)
55 (gurmukhi (punjabi) nil
)
56 (gujarati (gujarati) nil
)
60 (kannada (kannada) nil
)
61 (malayalam (malayalam) nil
))
62 "Alist of Indian scripts vs the corresponding language list and font foundry.
63 Each element has this form:
65 (SCRIPT LANGUAGE-LIST FONT-FOUNDRY)
67 SCRIPT is one of Indian script names.
69 LANGUAGE-LIST is a list of Indian langauge names SCRIPT is used for.
70 The list is in the priority order.
72 FONT-FOUNDRY is a font foundry representing a group of Indian
73 fonts. If the value is nil, the value of `indian-font-foundry'
76 (defconst indian-font-char-index-table
77 '( ; for which language(s)
79 (#x0000 . cdac
:dv-ttsurekh
) ; hindi, etc
80 (#x0100 . cdac
:sd-ttsurekh
) ; sanskrit
81 (#x0200 . cdac
:bn-ttdurga
) ; bengali
82 (#x0300 . cdac
:tm-ttvalluvar
) ; tamil
83 (#x0400 . cdac
:tl-tthemalatha
) ; telugu
84 (#x0500 . cdac
:as-ttdurga
) ; assamese
85 (#x0600 . cdac
:or-ttsarala
) ; oriya
86 (#x0700 . cdac
:kn-ttuma
) ; kannada
87 (#x0800 . cdac
:ml-ttkarthika
) ; malayalam
88 (#x0900 . cdac
:gj-ttavantika
) ; gujarati
89 (#x0A00 . cdac
:pn-ttamar
) ; punjabi
92 (#x0B00 . akruti
:dev
) ; hindi, etc
93 (#x0C00 . akruti
:bng
) ; bengali
94 (#x0D00 . akruti
:pnj
) ; punjabi
95 (#x0E00 . akruti
:guj
) ; gujarati
96 (#x0F00 . akruti
:ori
) ; oriya
97 (#x1000 . akruti
:tml
) ; tamil
98 (#x1100 . akruti
:tlg
) ; telugu
99 (#x1200 . akruti
:knd
) ; kannada
100 (#x1300 . akruti
:mal
) ; malayalam
102 "Alist of indices of `indian-glyph' character vs Indian font identifiers.
103 Each element has this form: (INDEX . FONT-IDENTIFIER)
105 INDEX is an index number of the first character in the charset
106 `indian-glyph' assigned for glyphs in the font specified by
107 FONT-IDENTIFIER. Currently FONT-IDENTIFIERs are defined for CDAC
108 and AKRUTI font groups.")
110 (defun indian-font-char (index font-identifier
)
111 "Return character of charset `indian-glyph' made from glyph index INDEX.
112 FONT-IDENTIFIER is an identifier of an Indian font listed in the
113 variable `indian-font-char-index-table'. It specifies which
115 (if (or (< index
0) (> index
255))
116 (error "Invalid glyph index: %d" index
))
117 (let ((start (car (rassq font-identifier indian-font-char-index-table
))))
119 (error "Unknown font identifier: %s" font-identifier
))
120 (setq index
(+ start index
))
121 (make-char 'indian-glyph
(+ (/ index
96) 32) (+ (% index
96) 32))))
123 ;; Return a range of characters (cons of min and max character) of the
124 ;; charset `indian-glyph' for displaying SCRIPT in LANGUAGE by a font
127 (defun indian-font-char-range (font-identifier)
128 (cons (indian-font-char 0 font-identifier
)
129 (indian-font-char 255 font-identifier
)))
131 (defvar indian-script-table
145 "Vector of Indian script names.")
147 (let ((len (length indian-script-table
))
150 (put (aref indian-script-table i
) 'indian-glyph-code-offset
(* 256 i
))
153 (defvar indian-default-script
'devanagari
154 "Default script for Indian languages.
155 Each Indian language environment sets this value
156 to one of `indian-script-table' (which see).
157 The default value is `devanagari'.")
159 (define-ccl-program ccl-encode-indian-glyph-font
161 ;; Shorten (r1 = (((((r1 - 32) * 96) + r2) - 32) % 256))
162 (r1 = ((((r1 * 96) + r2
) -
,(+ (* 32 96) 32)) %
256))))
164 (setq font-ccl-encoder-alist
165 (cons (cons "-CDAC" 'ccl-encode-indian-glyph-font
)
166 font-ccl-encoder-alist
))
168 (setq font-ccl-encoder-alist
169 (cons (cons "-AKRUTI" 'ccl-encode-indian-glyph-font
)
170 font-ccl-encoder-alist
))
174 ;;; arch-tag: 83aa8fc7-7ee2-4364-a6e5-498f5e3b8c2f
175 ;;; indian.el ends here