summaryrefslogtreecommitdiff
path: root/lisp/language/devan-util.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/language/devan-util.el')
-rw-r--r--lisp/language/devan-util.el56
1 files changed, 28 insertions, 28 deletions
diff --git a/lisp/language/devan-util.el b/lisp/language/devan-util.el
index b25e90cebe9..b236a95e3b4 100644
--- a/lisp/language/devan-util.el
+++ b/lisp/language/devan-util.el
@@ -1,4 +1,4 @@
-;;; devan-util.el --- Support for composing Devanagari characters
+;;; devan-util.el --- Support for composing Devanagari characters -*-coding: iso-2022-7bit;-*-
;; Copyright (C) 1997, 1998, 2001, 2002, 2003, 2004, 2005, 2006, 2007
;; Free Software Foundation, Inc.
@@ -35,8 +35,6 @@
;;; Code:
-;;;###autoload
-
;; Devanagari Composable Pattern
;; C .. Consonants
;; V .. Vowel
@@ -55,6 +53,11 @@
(defconst devanagari-consonant
"[$,15U(B-$,15y68(B-$,16?(B]")
+ ;;("$,16B(B" . nil)
+ ;;("$,16A(B" . nil)
+ ;;("$,16C(B" . nil)
+
+
(defconst devanagari-composable-pattern
(concat
"\\([$,15E(B-$,15T6@6A(B][$,15A5B(B]?\\)\\|[$,15C6D(B]"
@@ -64,6 +67,12 @@
"\\)")
"Regexp matching a composable sequence of Devanagari characters.")
+(dolist (range '((#x0903 . #x0903)
+ (#x0905 . #x0939)
+ (#x0958 . #x0961)))
+ (set-char-table-range indian-composable-pattern range
+ devanagari-composable-pattern))
+
;;;###autoload
(defun devanagari-compose-region (from to)
(interactive "r")
@@ -72,8 +81,8 @@
(narrow-to-region from to)
(goto-char (point-min))
(while (re-search-forward devanagari-composable-pattern nil t)
- (devanagari-compose-syllable-region (match-beginning 0)
- (match-end 0))))))
+ (devanagari-compose-syllable-region (match-beginning 0)
+ (match-end 0))))))
(defun devanagari-compose-string (string)
(with-temp-buffer
(insert (decompose-string string))
@@ -90,11 +99,6 @@
(set-buffer-modified-p buffer-modified-p)
(- (point-max) (point-min))))))
-(defun devanagari-range (from to)
- "Make the list of the integers of range FROM to TO."
- (let (result)
- (while (<= from to) (setq result (cons to result) to (1- to))) result))
-
(defun devanagari-regexp-of-hashtbl-keys (hashtbl)
"Return a regular expression that matches all keys in hashtable HASHTBL."
(let ((max-specpdl-size 1000))
@@ -105,21 +109,18 @@
dummy)
(function (lambda (x y) (> (length x) (length y))))))))
-(defun devanagari-composition-function (from to pattern &optional string)
- "Compose Devanagari characters in REGION, or STRING if specified.
-Assume that the REGION or STRING must fully match the composable
-PATTERN regexp."
- (if string (devanagari-compose-syllable-string string)
- (devanagari-compose-syllable-region from to))
- (- to from))
-
-;; Register a function to compose Devanagari characters.
-(mapc
- (function (lambda (ucs)
- (aset composition-function-table (decode-char 'ucs ucs)
- (list (cons devanagari-composable-pattern
- 'devanagari-composition-function)))))
- (nconc '(#x0903) (devanagari-range #x0905 #x0939) (devanagari-range #x0958 #x0961)))
+;;;###autoload
+(defun devanagari-composition-function (pos &optional string)
+ "Compose Devanagari characters after the position POS.
+If STRING is not nil, it is a string, and POS is an index to the string.
+In this case, compose characters after POS of the string."
+ (if string
+ ;; Not yet implemented.
+ nil
+ (goto-char pos)
+ (if (looking-at devanagari-composable-pattern)
+ (prog1 (match-end 0)
+ (devanagari-compose-syllable-region pos (match-end 0))))))
;; Notes on conversion steps.
@@ -496,11 +497,10 @@ preferred rule from the sanskrit fonts." )
(defvar dev-glyph-glyph-2-regexp
(devanagari-regexp-of-hashtbl-keys dev-glyph-glyph-2-hash))
-
(defun dev-charseq (from &optional to)
(if (null to) (setq to from))
- (mapcar (function (lambda (x) (indian-glyph-char x 'devanagari)))
- (devanagari-range from to)))
+ (number-sequence (decode-char 'devanagari-cdac from)
+ (decode-char 'devanagari-cdac to)))
(defvar dev-glyph-cvn
(append