1 ;;; indian.el --- Indian languages support -*- coding: iso-2022-7bit; -*-
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
8 ;; Maintainer: KAWABATA, Taichi <kawabata@m17n.org>
9 ;; Keywords: multilingual, i18n, Indian
11 ;; This file is part of GNU Emacs.
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)
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.
23 ;; You should have received a copy of the GNU General Public License
24 ;; along with GNU Emacs; see the file COPYING. If not, write to the
25 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
26 ;; Boston, MA 02110-1301, USA.
30 ;; This file defines in-is13194 coding system and relationship between
31 ;; indian-glyph character-set and various CDAC fonts.
37 "8-bit encoding for ASCII (MSB=0) and IS13194-Devanagari (MSB=1)."
38 '(ascii indian-is13194 nil nil
40 `((safe-chars . ,(let ((table (make-char-table 'safe-chars nil)))
41 (set-char-table-range table 'indian-is13194 t)
44 (aset table (decode-char 'ucs (+ #x900 i)) t))
46 (post-read-conversion . in-is13194-post-read-conversion)
47 (pre-write-conversion . in-is13194-pre-write-conversion)))
49 (define-coding-system-alias 'devanagari 'in-is13194)
51 (defvar indian-font-foundry 'cdac
52 "Font foundry for Indian characters.
53 Currently supported foundries are `cdac' and `akruti'.")
55 (defvar indian-script-language-alist
56 '((devanagari (hindi sanskrit) nil)
57 (bengali (bengali assamese) nil)
58 (gurmukhi (punjabi) nil)
59 (gujarati (gujarati) nil)
63 (kannada (kannada) nil)
64 (malayalam (malayalam) nil))
65 "Alist of Indian scripts vs the corresponding language list and font foundry.
66 Each element has this form:
68 (SCRIPT LANGUAGE-LIST FONT-FOUNDRY)
70 SCRIPT is one of Indian script names.
72 LANGUAGE-LIST is a list of Indian langauge names SCRIPT is used for.
73 The list is in the priority order.
75 FONT-FOUNDRY is a font foundry representing a group of Indian
76 fonts. If the value is nil, the value of `indian-font-foundry'
79 (defconst indian-font-char-index-table
80 '( ; for which language(s)
82 (#x0000 . cdac:dv-ttsurekh) ; hindi, etc
83 (#x0100 . cdac:sd-ttsurekh) ; sanskrit
84 (#x0200 . cdac:bn-ttdurga) ; bengali
85 (#x0300 . cdac:tm-ttvalluvar) ; tamil
86 (#x0400 . cdac:tl-tthemalatha) ; telugu
87 (#x0500 . cdac:as-ttdurga) ; assamese
88 (#x0600 . cdac:or-ttsarala) ; oriya
89 (#x0700 . cdac:kn-ttuma) ; kannada
90 (#x0800 . cdac:ml-ttkarthika) ; malayalam
91 (#x0900 . cdac:gj-ttavantika) ; gujarati
92 (#x0A00 . cdac:pn-ttamar) ; punjabi
95 (#x0B00 . akruti:dev) ; hindi, etc
96 (#x0C00 . akruti:bng) ; bengali
97 (#x0D00 . akruti:pnj) ; punjabi
98 (#x0E00 . akruti:guj) ; gujarati
99 (#x0F00 . akruti:ori) ; oriya
100 (#x1000 . akruti:tml) ; tamil
101 (#x1100 . akruti:tlg) ; telugu
102 (#x1200 . akruti:knd) ; kannada
103 (#x1300 . akruti:mal) ; malayalam
105 "Alist of indices of `indian-glyph' character vs Indian font identifiers.
106 Each element has this form: (INDEX . FONT-IDENTIFIER)
108 INDEX is an index number of the first character in the charset
109 `indian-glyph' assigned for glyphs in the font specified by
110 FONT-IDENTIFIER. Currently FONT-IDENTIFIERs are defined for CDAC
111 and AKRUTI font groups.")
113 (defun indian-font-char (index font-identifier)
114 "Return character of charset `indian-glyph' made from glyph index INDEX.
115 FONT-IDENTIFIER is an identifier of an Indian font listed in the
116 variable `indian-font-char-index-table'. It specifies which
118 (if (or (< index 0) (> index 255))
119 (error "Invalid glyph index: %d" index))
120 (let ((start (car (rassq font-identifier indian-font-char-index-table))))
122 (error "Unknown font identifier: %s" font-identifier))
123 (setq index (+ start index))
124 (make-char 'indian-glyph (+ (/ index 96) 32) (+ (% index 96) 32))))
126 ;; Return a range of characters (cons of min and max character) of the
127 ;; charset `indian-glyph' for displaying SCRIPT in LANGUAGE by a font
130 (defun indian-font-char-range (font-identifier)
131 (cons (indian-font-char 0 font-identifier)
132 (indian-font-char 255 font-identifier)))
134 (defvar indian-script-table
148 "Vector of Indian script names.")
150 (let ((len (length indian-script-table))
153 (put (aref indian-script-table i) 'indian-glyph-code-offset (* 256 i))
156 (defvar indian-default-script 'devanagari
157 "Default script for Indian languages.
158 Each Indian language environment sets this value
159 to one of `indian-script-table' (which see).
160 The default value is `devanagari'.")
162 (define-ccl-program ccl-encode-indian-glyph-font
164 ;; Shorten (r1 = (((((r1 - 32) * 96) + r2) - 32) % 256))
165 (r1 = ((((r1 * 96) + r2) - ,(+ (* 32 96) 32)) % 256))))
167 (setq font-ccl-encoder-alist
168 (cons (cons "-CDAC" 'ccl-encode-indian-glyph-font)
169 font-ccl-encoder-alist))
171 (setq font-ccl-encoder-alist
172 (cons (cons "-AKRUTI" 'ccl-encode-indian-glyph-font)
173 font-ccl-encoder-alist))
177 ;;; arch-tag: 83aa8fc7-7ee2-4364-a6e5-498f5e3b8c2f
178 ;;; indian.el ends here