emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/lisp/language/devan-util.el,v


From: Miles Bader
Subject: [Emacs-diffs] Changes to emacs/lisp/language/devan-util.el,v
Date: Fri, 01 Feb 2008 16:02:28 +0000

CVSROOT:        /cvsroot/emacs
Module name:    emacs
Changes by:     Miles Bader <miles>     08/02/01 16:01:31

Index: lisp/language/devan-util.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/language/devan-util.el,v
retrieving revision 1.52
retrieving revision 1.53
diff -u -b -r1.52 -r1.53
--- lisp/language/devan-util.el 8 Jan 2008 20:45:57 -0000       1.52
+++ lisp/language/devan-util.el 1 Feb 2008 16:01:02 -0000       1.53
@@ -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, 2008
 ;;   Free Software Foundation, Inc.
@@ -36,8 +36,6 @@
 
 ;;; Code:
 
-;;;###autoload
-
 ;; Devanagari Composable Pattern
 ;;    C .. Consonants
 ;;    V .. Vowel
@@ -56,6 +54,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-$,address@hidden(B][$,15A5B(B]?\\)\\|[$,15C6D(B]"
@@ -65,6 +68,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")
@@ -91,11 +100,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))
@@ -106,21 +110,25 @@
        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
+      (if auto-compose-current-font
+         (if (eq (string-match "[$,address@hidden(B-$,16_(B]+" pos) pos)
+             (or (font-shape-text 0 (match-end 0) auto-compose-current-font
+                                  string)
+                 pos)))
+    (goto-char pos)
+    (if auto-compose-current-font
+       (if (looking-at "[$,address@hidden(B-$,16_(B]+")
+           (or (font-shape-text pos (match-end 0) auto-compose-current-font)
+               pos)
+         (if (looking-at devanagari-composable-pattern)
+             (prog1 (match-end 0)
+               (devanagari-compose-syllable-region pos (match-end 0))))))))
 
 ;; Notes on conversion steps.
 
@@ -497,11 +505,10 @@
 (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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]