(setup-japanese-environment-internal):
[bpt/emacs.git] / lisp / language / indian.el
index 0fed075..8bceb0a 100644 (file)
@@ -1,8 +1,8 @@
 ;;; indian.el --- Indian languages support -*- coding: iso-2022-7bit; -*-
 
-;; Copyright (C) 1997, 1999, 2001, 2002, 2003, 2004, 2005, 2006, 2007
+;; Copyright (C) 1997, 1999, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
 ;;   Free Software Foundation, Inc.
-;; Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007
+;; Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008
 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
 ;;   Registration Number H14PRO021
 
@@ -13,7 +13,7 @@
 
 ;; GNU Emacs is free software; you can redistribute it and/or modify
 ;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation; either version 2, or (at your option)
+;; the Free Software Foundation; either version 3, or (at your option)
 ;; any later version.
 
 ;; GNU Emacs is distributed in the hope that it will be useful,
 
 ;;; Code:
 
-(make-coding-system
- 'in-is13194 2 ?D
- "8-bit encoding for ASCII (MSB=0) and IS13194-Devanagari (MSB=1)."
- '(ascii indian-is13194 nil nil
-   nil ascii-eol)
- `((safe-chars . ,(let ((table (make-char-table 'safe-chars nil)))
-                   (set-char-table-range table 'indian-is13194 t)
-                   (dotimes (i 127)
-                     (aset table i t)
-                     (aset table (decode-char 'ucs (+ #x900 i)) t))
-                   table))
-   (post-read-conversion . in-is13194-post-read-conversion)
-   (pre-write-conversion . in-is13194-pre-write-conversion)))
-
-(define-coding-system-alias 'devanagari 'in-is13194)
+(define-coding-system 'in-is13194-devanagari
+  "8-bit encoding for ASCII (MSB=0) and IS13194-Devanagari (MSB=1)."
+  :coding-type 'iso-2022
+  :mnemonic ?D
+  :designation [ascii indian-is13194 nil nil]
+  :charset-list '(ascii indian-is13194)
+  :post-read-conversion 'in-is13194-post-read-conversion
+  :pre-write-conversion 'in-is13194-pre-write-conversion)
+
+(define-coding-system-alias 'devanagari 'in-is13194-devanagari)
 
 (defvar indian-font-foundry 'cdac
   "Font foundry for Indian characters.
@@ -160,18 +155,29 @@ Each Indian language environment sets this value
 to one of `indian-script-table' (which see).
 The default value is `devanagari'.")
 
-(define-ccl-program ccl-encode-indian-glyph-font
-  `(0
-    ;; Shorten (r1 = (((((r1 - 32) * 96) + r2) - 32) % 256))
-    (r1 = ((((r1 * 96) + r2) - ,(+ (* 32 96) 32)) % 256))))
-
-(setq font-ccl-encoder-alist
-      (cons (cons "-CDAC" 'ccl-encode-indian-glyph-font)
-           font-ccl-encoder-alist))
-
-(setq font-ccl-encoder-alist
-      (cons (cons "-AKRUTI" 'ccl-encode-indian-glyph-font)
-           font-ccl-encoder-alist))
+(defvar indian-composable-pattern
+  (make-char-table nil)
+  "Char table of regexps for composable Indian character sequence.")
+
+(let ((script-regexp-alist
+       '((devanagari . "[\x900-\x9FF\x200C\x200D]+")
+        (bengali . "[\x980-\x9FF\x200C\x200D]+")
+        (gurmukhi . "[\xA00-\xA7F\x200C\x200D]+")
+        (gujarati . "[\xA80-\xAFF\x200C\x200D]+")
+        (oriya . "[\xB00-\xB7F\x200C\x200D]+")
+        (tamil . "[\xB80-\xBFF\x200C\x200D]+")
+        (telugu . "[\xC00-\xC7F\x200C\x200D]+")
+        (kannada . "[\xC80-\xCFF\x200C\x200D]+")
+        (malayalam . "[\xD00-\xD7F\x200C\x200D]+")
+        (sinhala . "[\xD80-\xDFF\x200C\x200D]+"))))
+  (map-char-table #'(lambda (key val) 
+                     (let ((slot (assq val script-regexp-alist)))
+                       (if slot
+                           (set-char-table-range 
+                            composition-function-table key
+                            (list (cons (cdr slot) 'font-shape-text))))))
+                 char-script-table))
+                                             
 
 (provide 'indian)