Mercurial > emacs
annotate lisp/language/indian.el @ 41523:9dcf83921a38
*** empty log message ***
author | Kenichi Handa <handa@m17n.org> |
---|---|
date | Mon, 26 Nov 2001 00:05:57 +0000 |
parents | f091948e4d1c |
children | 3bf347fb3060 |
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 |
41469 | 5 ;; Maintainer: KAWABATA, Taichi <batta@beige.ocn.ne.jp> |
6 ;; Keywords: multilingual, 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 | |
41469 | 32 (make-coding-system |
33 'in-is13194 2 ?D | |
34 "8-bit encoding for ASCII (MSB=0) and IS13194-Devanagari (MSB=1)" | |
35 '(ascii indian-is13194 nil nil | |
36 nil ascii-eol) | |
37 '((safe-charsets ascii indian-is13194) | |
38 (post-read-conversion . in-is13194-post-read-conversion) | |
39 (pre-write-conversion . in-is13194-pre-write-conversion))) | |
17052 | 40 |
41469 | 41 (defvar indian-script-table |
42 '[ | |
43 devanagari | |
44 sanskrit | |
45 bengali | |
46 tamil | |
47 telugu | |
48 assamese | |
49 oriya | |
50 kannada | |
51 malayalam | |
52 gujarati | |
53 punjabi | |
54 ] | |
55 "Vector of Indian script names.") | |
17052 | 56 |
41469 | 57 (let ((len (length indian-script-table)) |
58 (i 0)) | |
59 (while (< i len) | |
60 (put (aref indian-script-table i) 'indian-glyph-code-offset (* 256 i)) | |
61 (setq i (1+ i)))) | |
17052 | 62 |
41469 | 63 (defvar indian-default-script 'devanagari |
64 "Default script for Indian languages. | |
65 Each Indian language environment sets this value | |
66 to one of `indian-script-table' (which see). | |
67 The default value is `devanagari'.") | |
17052 | 68 |
41469 | 69 (defun indian-glyph-char (index &optional script) |
70 "Return character of charset `indian-glyph' made from glyph index INDEX. | |
71 The variable `indian-default-script' specifies the script of the glyph. | |
72 Optional argument SCRIPT, if non-nil, overrides `indian-default-script'. | |
73 See also the function `indian-char-glyph'." | |
74 (or script | |
75 (setq script indian-default-script)) | |
76 (let ((offset (get script 'indian-glyph-code-offset))) | |
77 (or (integerp offset) | |
78 (error "Invalid script name: %s" script)) | |
79 (or (and (>= index 0) (< index 256)) | |
80 (error "Invalid glyph index: %d" index)) | |
81 (setq index (+ offset index)) | |
82 (make-char 'indian-glyph (+ (/ index 96) 32) (+ (% index 96) 32)))) | |
17052 | 83 |
41469 | 84 (defvar indian-glyph-max-char |
85 (indian-glyph-char | |
86 255 (aref indian-script-table (1- (length indian-script-table)))) | |
87 "The maximum valid code of characters in the charset `indian-glyph'") | |
17052 | 88 |
41469 | 89 (defun indian-char-glyph (char) |
90 "Return information about the glphy code for CHAR of `indian-glyph' charset. | |
91 The value is (INDEX . SCRIPT), where INDEX is the glyph index | |
92 in the font that Indian script name SCRIPT specifies. | |
93 See also the function `indian-glyph-char'." | |
94 (let ((split (split-char char)) | |
95 code) | |
96 (or (eq (car split) 'indian-glyph) | |
97 (error "Charset of `%c' is not indian-glyph" char)) | |
98 (or (<= char indian-glyph-max-char) | |
99 (error "Invalid indian-glyph char: %d" char)) | |
100 (setq code (+ (* (- (nth 1 split) 32) 96) (nth 2 split) -32)) | |
101 (cons (% code 256) (aref indian-script-table (/ code 256))))) | |
17052 | 102 |
41469 | 103 (define-ccl-program ccl-encode-indian-glyph-font |
104 `(0 | |
105 ;; Shorten (r1 = (((((r1 - 32) * 96) + r2) - 32) % 256)) | |
106 (r1 = ((((r1 * 96) + r2) - ,(+ (* 32 96) 32)) % 256)))) | |
17052 | 107 |
41469 | 108 (setq font-ccl-encoder-alist |
109 (cons (cons "-CDAC" 'ccl-encode-indian-glyph-font) | |
110 font-ccl-encoder-alist)) | |
17052 | 111 |
41469 | 112 (setq font-ccl-encoder-alist |
113 (cons '("ISO10646.*-1" . ccl-encode-unicode-font) | |
114 font-ccl-encoder-alist)) | |
33778 | 115 |
116 (provide 'indian) | |
41469 | 117 |
17052 | 118 ;;; indian.el ends here |