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/tml-util.el,v


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

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

Index: lisp/language/tml-util.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/language/tml-util.el,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- lisp/language/tml-util.el   8 Jan 2008 20:45:59 -0000       1.8
+++ lisp/language/tml-util.el   1 Feb 2008 16:01:04 -0000       1.9
@@ -103,23 +103,6 @@
       (function (lambda (x y) (> (length x) (length y))))))))
 
 
-;;;###autoload
-(defun tamil-composition-function (from to pattern  &optional string)
-  "Compose Tamil characters in REGION, or STRING if specified.
-Assume that the REGION or STRING must fully match the composable 
-PATTERN regexp."
-  (if string (tamil-compose-syllable-string string)
-    (tamil-compose-syllable-region from to))
-  (- to from))
-
-;; Register a function to compose Tamil characters.
-(mapc
- (function (lambda (ucs)
-   (aset composition-function-table (decode-char 'ucs ucs)
-        (list (cons tamil-composable-pattern
-                     'tamil-composition-function)))))
- (nconc '(#x0b82 #x0b83) (tamil-range #x0b85 #x0bb9)))
-
 ;; Notes on conversion steps.
 
 ;; 1. chars to glyphs
@@ -137,7 +120,7 @@
 
 (defvar tml-char-glyph
   '(;; various signs
-    ;;("$,1<"(B" . "")
+    ("$,1<"(B" . "$,4)b(B")        ;; not good
     ("$,1<#(B" . "$,4*G(B")
     ;; Independent Vowels
     ("$,1<%(B" . "$,4*<(B")
@@ -336,10 +319,18 @@
         (narrow-to-region from to)
         (goto-char (point-min))
         ;; char-glyph-conversion
-        (while (re-search-forward tml-char-glyph-regexp nil t)
-          (setq match-str (match-string 0))
-          (setq glyph-str
-                (concat glyph-str (gethash match-str tml-char-glyph-hash))))
+        (while (not (eobp))
+         (if (looking-at tml-char-glyph-regexp)
+             (progn
+               (setq match-str (match-string 0)
+                     glyph-str
+                     (concat glyph-str
+                             (gethash match-str tml-char-glyph-hash)))
+               (goto-char (match-end 0)))
+           (setq glyph-str (concat glyph-str (string (following-char))))
+           (forward-char 1)))
+       (or glyph-str
+           (aset glyph-str 0 (following-char)))
         ;; glyph reordering
         (when (string-match tml-glyph-reorder-key-glyphs glyph-str)
           (if (string-match (car tml-glyph-reordering-regexp-list)
@@ -364,6 +355,25 @@
                  glyph-str))))
         (compose-region from to glyph-str)))))
 
+;;;###autoload
+(defun tamil-composition-function (pos  &optional string)
+  "Compose Tamil 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 "[$,1< (B-$,1=?(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 "[$,1< (B-$,1=?(B]+")
+           (or (font-shape-text pos (match-end 0) auto-compose-current-font))
+         (if (looking-at tamil-composable-pattern)
+             (prog1 (match-end 0)
+               (tamil-compose-syllable-region pos (match-end 0))))))))
+
 (provide 'tml-util)
 
 ;;; arch-tag: 4d1c9737-e7b1-44cf-a040-4f64c50e773e




reply via email to

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