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.
32 (define-coding-system 'in-is13194-devanagari
33 "8-bit encoding for ASCII (MSB=0) and IS13194-Devanagari (MSB=1)."
34 :coding-type 'iso-2022
36 :designation [ascii indian-is13194 nil nil]
37 :charset-list '(ascii indian-is13194)
38 :post-read-conversion 'in-is13194-post-read-conversion
39 :pre-write-conversion 'in-is13194-pre-write-conversion)
41 (define-coding-system-alias 'devanagari 'in-is13194-devanagari)
43 (defvar indian-font-foundry 'cdac
44 "Font foundry for Indian characters.
45 Currently supported foundries are `cdac' and `akruti'.")
47 (defvar indian-script-language-alist
48 "Alist of Indian scripts vs the corresponding language list and font foundry.
49 Each element has this form:
51 (SCRIPT LANGUAGE-LIST FONT-FOUNDRY)
53 SCRIPT is one of Indian script names.
55 LANGUAGE-LIST is a list of Indian langauge names SCRIPT is used for.
56 The list is in the priority order.
58 FONT-FOUNDRY is a font foundry representing a group of Indian
59 fonts. If the value is nil, the value of `indian-font-foundry'
61 '((devanagari (hindi sanskrit) nil)
62 (bengali (bengali assamese) nil)
63 (gurmukhi (punjabi) nil)
64 (gujarati (gujarati) nil)
68 (kannada (kannada) nil)
69 (malayalam (malayalam) nil)))
71 (defconst indian-font-char-index-table
72 '( ; for which language(s)
74 (#x0000 . cdac:dv-ttsurekh) ; hindi, etc
75 (#x0100 . cdac:sd-ttsurekh) ; sanskrit
76 (#x0200 . cdac:bn-ttdurga) ; bengali
77 (#x0300 . cdac:tm-ttvalluvar) ; tamil
78 (#x0400 . cdac:tl-tthemalatha) ; telugu
79 (#x0500 . cdac:as-ttdurga) ; assamese
80 (#x0600 . cdac:or-ttsarala) ; oriya
81 (#x0700 . cdac:kn-ttuma) ; kannada
82 (#x0800 . cdac:ml-ttkarthika) ; malayalam
83 (#x0900 . cdac:gj-ttavantika) ; gujarati
84 (#x0A00 . cdac:pn-ttamar) ; punjabi
87 (#x0B00 . akruti:dev) ; hindi, etc
88 (#x0C00 . akruti:bng) ; bengali
89 (#x0D00 . akruti:pnj) ; punjabi
90 (#x0E00 . akruti:guj) ; gujarati
91 (#x0F00 . akruti:ori) ; oriya
92 (#x1000 . akruti:tml) ; tamil
93 (#x1100 . akruti:tlg) ; telugu
94 (#x1200 . akruti:knd) ; kannada
95 (#x1300 . akruti:mal) ; malayalam
97 "Aliat of indices of `indian-glyph' character vs Indian font identifiers.
98 Each element has this form: (INDEX . FONT-IDENTIFIER)
100 INDEX is an index number of the first character in the charset
101 `indian-glyph' assigned for glyphs in the font specified by
102 FONT-IDENTIFIER. Currently FONT-IDENTIFIERs are defined for CDAC
103 and AKRUTI font groups.")
105 (defun indian-font-char (index font-identifier)
106 "Return character of charset `indian-glyph' made from glyph index INDEX.
107 FONT-IDENTIFIER is an identifier of an Indian font listed in the
108 variable `indian-font-char-index-table'. It specifies which
110 (if (or (< index 0) (> index 255))
111 (error "Invalid glyph index: %d" index))
112 (let ((start (car (rassq font-identifier indian-font-char-index-table))))
114 (error "Unknown font identifier: %s" font-identifier))
115 (setq index (+ start index))
116 (make-char 'indian-glyph (+ (/ index 96) 32) (+ (% index 96) 32))))
118 ;; Return a range of characters (cons of min and max character) of the
119 ;; charset `indian-glyph' for displaying SCRIPT in LANGUAGE by a font
122 (defun indian-font-char-range (font-identifier)
123 (cons (indian-font-char 0 font-identifier)
124 (indian-font-char 255 font-identifier)))
126 (defvar indian-script-table
140 "Vector of Indian script names.")
142 (let ((len (length indian-script-table))
145 (put (aref indian-script-table i) 'indian-glyph-code-offset (* 256 i))
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'.")
154 (defvar indian-composable-pattern
155 (make-char-table nil)
156 "Char table of regexps for composable Indian character sequence.")
160 ;;; indian.el ends here