2 |
|
|
3 |
;; Copyright (C) 1999, 2001 Free Software Foundation, Inc. |
;; Copyright (C) 1999, 2001 Free Software Foundation, Inc. |
4 |
|
|
5 |
;; Maintainer: KAWABATA, Taichi <batta@beige.ocn.ne.jp> |
;; Maintainer: KAWABATA, Taichi <kawabata@m17n.org> |
6 |
;; Keywords: multilingual, i18n, Indian |
;; Keywords: multilingual, i18n, Indian |
7 |
|
|
8 |
;; This file is part of GNU Emacs. |
;; This file is part of GNU Emacs. |
34 |
"8-bit encoding for ASCII (MSB=0) and IS13194-Devanagari (MSB=1)." |
"8-bit encoding for ASCII (MSB=0) and IS13194-Devanagari (MSB=1)." |
35 |
'(ascii indian-is13194 nil nil |
'(ascii indian-is13194 nil nil |
36 |
nil ascii-eol) |
nil ascii-eol) |
37 |
'((safe-charsets ascii indian-is13194) |
`((safe-chars . ,(let ((table (make-char-table 'safe-chars nil))) |
38 |
|
(set-char-table-range table 'indian-is13194 t) |
39 |
|
(dotimes (i 127) |
40 |
|
(aset table i t) |
41 |
|
(aset table (decode-char 'ucs (+ #x900 i)) t)) |
42 |
|
table)) |
43 |
(post-read-conversion . in-is13194-post-read-conversion) |
(post-read-conversion . in-is13194-post-read-conversion) |
44 |
(pre-write-conversion . in-is13194-pre-write-conversion))) |
(pre-write-conversion . in-is13194-pre-write-conversion))) |
45 |
|
|
46 |
|
(define-coding-system-alias 'devanagari 'in-is13194) |
47 |
|
|
48 |
|
(defvar indian-font-foundry 'cdac |
49 |
|
"Font foundry for Indian characters. |
50 |
|
Currently supported foundries are `cdac' and `akruti'.") |
51 |
|
|
52 |
|
(defvar indian-script-language-alist |
53 |
|
"Alist of Indian scripts vs the corresponding language list and font foundry. |
54 |
|
Each element has this form: |
55 |
|
|
56 |
|
(SCRIPT LANGUAGE-LIST FONT-FOUNDRY) |
57 |
|
|
58 |
|
SCRIPT is one of Indian script names. |
59 |
|
|
60 |
|
LANGUAGE-LIST is a list of Indian langauge names SCRIPT is used for. |
61 |
|
The list is in the priority order. |
62 |
|
|
63 |
|
FONT-FOUNDRY is a font foundry representing a group of Indian |
64 |
|
fonts. If the value is nil, the value of `indian-font-foundry' |
65 |
|
is used." |
66 |
|
'((devanagari (hindi sanskrit) nil) |
67 |
|
(bengali (bengali assamese) nil) |
68 |
|
(gurmukhi (punjabi) nil) |
69 |
|
(gujarati (gujarati) nil) |
70 |
|
(oriya (oriya) nil) |
71 |
|
(tamil (tamil) nil) |
72 |
|
(telugu (telugu) nil) |
73 |
|
(kannada (kannada) nil) |
74 |
|
(malayalam (malayalam) nil))) |
75 |
|
|
76 |
|
(defconst indian-font-char-index-table |
77 |
|
'( ; for which language(s) |
78 |
|
;; CDAC fonts |
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 |
90 |
|
|
91 |
|
;; AKRUTI fonts |
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 |
101 |
|
) |
102 |
|
"Aliat of indices of `indian-glyph' character vs Indian font identifiers. |
103 |
|
Each element has this form: (INDEX . FONT-IDENTIFIER) |
104 |
|
|
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.") |
109 |
|
|
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 |
114 |
|
font INDEX is for." |
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)))) |
118 |
|
(if (not start) |
119 |
|
(error "Unknown font identifier: %s" font-identifier)) |
120 |
|
(setq index (+ start index)) |
121 |
|
(make-char 'indian-glyph (+ (/ index 96) 32) (+ (% index 96) 32)))) |
122 |
|
|
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 |
125 |
|
;; of FOUNDRY. |
126 |
|
|
127 |
|
(defun indian-font-char-range (font-identifier) |
128 |
|
(cons (indian-font-char 0 font-identifier) |
129 |
|
(indian-font-char 255 font-identifier))) |
130 |
|
|
131 |
(defvar indian-script-table |
(defvar indian-script-table |
132 |
'[ |
'[ |
133 |
devanagari |
devanagari |
166 |
font-ccl-encoder-alist)) |
font-ccl-encoder-alist)) |
167 |
|
|
168 |
(setq font-ccl-encoder-alist |
(setq font-ccl-encoder-alist |
169 |
(cons '("ISO10646.*-1" . ccl-encode-unicode-font) |
(cons (cons "-AKRUTI" 'ccl-encode-indian-glyph-font) |
170 |
font-ccl-encoder-alist)) |
font-ccl-encoder-alist)) |
171 |
|
|
172 |
(provide 'indian) |
(provide 'indian) |