| 1 |
|
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 |
|
|---|
| 10 |
|
|---|
| 11 |
|
|---|
| 12 |
|
|---|
| 13 |
|
|---|
| 14 |
|
|---|
| 15 |
|
|---|
| 16 |
|
|---|
| 17 |
|
|---|
| 18 |
|
|---|
| 19 |
|
|---|
| 20 |
|
|---|
| 21 |
|
|---|
| 22 |
|
|---|
| 23 |
|
|---|
| 24 |
|
|---|
| 25 |
|
|---|
| 26 |
|
|---|
| 27 |
|
|---|
| 28 |
|
|---|
| 29 |
|
|---|
| 30 |
|
|---|
| 31 |
|
|---|
| 32 |
|
|---|
| 33 |
|
|---|
| 34 |
|
|---|
| 35 |
|
|---|
| 36 |
(make-coding-system |
|---|
| 37 |
'in-is13194 2 ?D |
|---|
| 38 |
"8-bit encoding for ASCII (MSB=0) and IS13194-Devanagari (MSB=1)." |
|---|
| 39 |
'(ascii indian-is13194 nil nil |
|---|
| 40 |
nil ascii-eol) |
|---|
| 41 |
`((safe-chars . ,(let ((table (make-char-table 'safe-chars nil))) |
|---|
| 42 |
(set-char-table-range table 'indian-is13194 t) |
|---|
| 43 |
(dotimes (i 127) |
|---|
| 44 |
(aset table i t) |
|---|
| 45 |
(aset table (decode-char 'ucs (+ #x900 i)) t)) |
|---|
| 46 |
table)) |
|---|
| 47 |
(post-read-conversion . in-is13194-post-read-conversion) |
|---|
| 48 |
(pre-write-conversion . in-is13194-pre-write-conversion))) |
|---|
| 49 |
|
|---|
| 50 |
(define-coding-system-alias 'devanagari 'in-is13194) |
|---|
| 51 |
|
|---|
| 52 |
(defvar indian-font-foundry 'cdac |
|---|
| 53 |
"Font foundry for Indian characters. |
|---|
| 54 |
Currently supported foundries are `cdac' and `akruti'.") |
|---|
| 55 |
|
|---|
| 56 |
(defvar indian-script-language-alist |
|---|
| 57 |
'((devanagari (hindi sanskrit) nil) |
|---|
| 58 |
(bengali (bengali assamese) nil) |
|---|
| 59 |
(gurmukhi (punjabi) nil) |
|---|
| 60 |
(gujarati (gujarati) nil) |
|---|
| 61 |
(oriya (oriya) nil) |
|---|
| 62 |
(tamil (tamil) nil) |
|---|
| 63 |
(telugu (telugu) nil) |
|---|
| 64 |
(kannada (kannada) nil) |
|---|
| 65 |
(malayalam (malayalam) nil)) |
|---|
| 66 |
"Alist of Indian scripts vs the corresponding language list and font foundry. |
|---|
| 67 |
Each element has this form: |
|---|
| 68 |
|
|---|
| 69 |
(SCRIPT LANGUAGE-LIST FONT-FOUNDRY) |
|---|
| 70 |
|
|---|
| 71 |
SCRIPT is one of Indian script names. |
|---|
| 72 |
|
|---|
| 73 |
LANGUAGE-LIST is a list of Indian langauge names SCRIPT is used for. |
|---|
| 74 |
The list is in the priority order. |
|---|
| 75 |
|
|---|
| 76 |
FONT-FOUNDRY is a font foundry representing a group of Indian |
|---|
| 77 |
fonts. If the value is nil, the value of `indian-font-foundry' |
|---|
| 78 |
is used.") |
|---|
| 79 |
|
|---|
| 80 |
(defconst indian-font-char-index-table |
|---|
| 81 |
'( |
|---|
| 82 |
|
|---|
| 83 |
(#x0000 . cdac:dv-ttsurekh) |
|---|
| 84 |
(#x0100 . cdac:sd-ttsurekh) |
|---|
| 85 |
(#x0200 . cdac:bn-ttdurga) |
|---|
| 86 |
(#x0300 . cdac:tm-ttvalluvar) |
|---|
| 87 |
(#x0400 . cdac:tl-tthemalatha) |
|---|
| 88 |
(#x0500 . cdac:as-ttdurga) |
|---|
| 89 |
(#x0600 . cdac:or-ttsarala) |
|---|
| 90 |
(#x0700 . cdac:kn-ttuma) |
|---|
| 91 |
(#x0800 . cdac:ml-ttkarthika) |
|---|
| 92 |
(#x0900 . cdac:gj-ttavantika) |
|---|
| 93 |
(#x0A00 . cdac:pn-ttamar) |
|---|
| 94 |
|
|---|
| 95 |
|
|---|
| 96 |
(#x0B00 . akruti:dev) |
|---|
| 97 |
(#x0C00 . akruti:bng) |
|---|
| 98 |
(#x0D00 . akruti:pnj) |
|---|
| 99 |
(#x0E00 . akruti:guj) |
|---|
| 100 |
(#x0F00 . akruti:ori) |
|---|
| 101 |
(#x1000 . akruti:tml) |
|---|
| 102 |
(#x1100 . akruti:tlg) |
|---|
| 103 |
(#x1200 . akruti:knd) |
|---|
| 104 |
(#x1300 . akruti:mal) |
|---|
| 105 |
) |
|---|
| 106 |
"Alist of indices of `indian-glyph' character vs Indian font identifiers. |
|---|
| 107 |
Each element has this form: (INDEX . FONT-IDENTIFIER) |
|---|
| 108 |
|
|---|
| 109 |
INDEX is an index number of the first character in the charset |
|---|
| 110 |
`indian-glyph' assigned for glyphs in the font specified by |
|---|
| 111 |
FONT-IDENTIFIER. Currently FONT-IDENTIFIERs are defined for CDAC |
|---|
| 112 |
and AKRUTI font groups.") |
|---|
| 113 |
|
|---|
| 114 |
(defun indian-font-char (index font-identifier) |
|---|
| 115 |
"Return character of charset `indian-glyph' made from glyph index INDEX. |
|---|
| 116 |
FONT-IDENTIFIER is an identifier of an Indian font listed in the |
|---|
| 117 |
variable `indian-font-char-index-table'. It specifies which |
|---|
| 118 |
font INDEX is for." |
|---|
| 119 |
(if (or (< index 0) (> index 255)) |
|---|
| 120 |
(error "Invalid glyph index: %d" index)) |
|---|
| 121 |
(let ((start (car (rassq font-identifier indian-font-char-index-table)))) |
|---|
| 122 |
(if (not start) |
|---|
| 123 |
(error "Unknown font identifier: %s" font-identifier)) |
|---|
| 124 |
(setq index (+ start index)) |
|---|
| 125 |
(make-char 'indian-glyph (+ (/ index 96) 32) (+ (% index 96) 32)))) |
|---|
| 126 |
|
|---|
| 127 |
|
|---|
| 128 |
|
|---|
| 129 |
|
|---|
| 130 |
|
|---|
| 131 |
(defun indian-font-char-range (font-identifier) |
|---|
| 132 |
(cons (indian-font-char 0 font-identifier) |
|---|
| 133 |
(indian-font-char 255 font-identifier))) |
|---|
| 134 |
|
|---|
| 135 |
(defvar indian-script-table |
|---|
| 136 |
'[ |
|---|
| 137 |
devanagari |
|---|
| 138 |
sanskrit |
|---|
| 139 |
bengali |
|---|
| 140 |
tamil |
|---|
| 141 |
telugu |
|---|
| 142 |
assamese |
|---|
| 143 |
oriya |
|---|
| 144 |
kannada |
|---|
| 145 |
malayalam |
|---|
| 146 |
gujarati |
|---|
| 147 |
punjabi |
|---|
| 148 |
] |
|---|
| 149 |
"Vector of Indian script names.") |
|---|
| 150 |
|
|---|
| 151 |
(let ((len (length indian-script-table)) |
|---|
| 152 |
(i 0)) |
|---|
| 153 |
(while (< i len) |
|---|
| 154 |
(put (aref indian-script-table i) 'indian-glyph-code-offset (* 256 i)) |
|---|
| 155 |
(setq i (1+ i)))) |
|---|
| 156 |
|
|---|
| 157 |
(defvar indian-default-script 'devanagari |
|---|
| 158 |
"Default script for Indian languages. |
|---|
| 159 |
Each Indian language environment sets this value |
|---|
| 160 |
to one of `indian-script-table' (which see). |
|---|
| 161 |
The default value is `devanagari'.") |
|---|
| 162 |
|
|---|
| 163 |
(define-ccl-program ccl-encode-indian-glyph-font |
|---|
| 164 |
`(0 |
|---|
| 165 |
|
|---|
| 166 |
(r1 = ((((r1 * 96) + r2) - ,(+ (* 32 96) 32)) % 256)))) |
|---|
| 167 |
|
|---|
| 168 |
(setq font-ccl-encoder-alist |
|---|
| 169 |
(cons (cons "-CDAC" 'ccl-encode-indian-glyph-font) |
|---|
| 170 |
font-ccl-encoder-alist)) |
|---|
| 171 |
|
|---|
| 172 |
(setq font-ccl-encoder-alist |
|---|
| 173 |
(cons (cons "-AKRUTI" 'ccl-encode-indian-glyph-font) |
|---|
| 174 |
font-ccl-encoder-alist)) |
|---|
| 175 |
|
|---|
| 176 |
(provide 'indian) |
|---|
| 177 |
|
|---|
| 178 |
|
|---|
| 179 |
|
|---|
| 180 |
|
|---|