]> code.delx.au - gnu-emacs/blobdiff - lisp/language/tibet-util.el
Merge from emacs--devo--0
[gnu-emacs] / lisp / language / tibet-util.el
index 38fcb8ceca5db18075fd88df06b4a596bc73233e..88f970e57049f7756298f9c6acf98a7c5ae0af81 100644 (file)
 ;;; Code:
 
 (defconst tibetan-obsolete-glyphs
-  `(("\e$(7!=\e(B" . "\e$(8!=\e(B")                        ; 2 col <-> 1 col
-    ("\e$(7!?\e(B" . "\e$(8!?\e(B")
-    ("\e$(7!@\e(B" . "\e$(8!@\e(B")
-    ("\e$(7!A\e(B" . "\e$(8!A\e(B")
-    ("\e$(7"`\e(B" . "\e$(8"`\e(B")
-    ("\e$(7!;\e(B" . "\e$(8!;\e(B")
-    ("\e$(7!D\e(B" . "\e$(8!D\e(B")
+  `(("\e$(7!=\e(B" . "\e$(7!=\e(B")                        ; 2 col <-> 1 col
+    ("\e$(7!?\e(B" . "\e$(7!?\e(B")
+    ("\e$(7!@\e(B" . "\e$(7!@\e(B")
+    ("\e$(7!A\e(B" . "\e$(7!A\e(B")
+    ("\e$(7"`\e(B" . "\e$(7"`\e(B")
+    ("\e$(7!;\e(B" . "\e$(7!;\e(B")
+    ("\e$(7!D\e(B" . "\e$(7!D\e(B")
     ;; Yes these are dirty. But ...
     ("\e$(7!>\e(B \e$(7!>\e(B" . ,(compose-string "\e$(7!>\e(B \e$(7!>\e(B" 0 3 [?\e$(7!>\e(B (Br . Bl) ?  (Br . Bl) ?\e$(7!>\e(B]))
     ("\e$(7!4!5!5\e(B" . ,(compose-string
@@ -141,7 +141,7 @@ The returned string has no composition information."
 ;;;
 ;;; Here are examples of the words "bsgrubs" and "hfauM"
 ;;;
-;;;            \e4\e$(7"7\e0"7\e1\e4%qx!"U\e0"G###C"U\e1\e4"7\e0"7\e1\e4"G\e0"G\e1\e(B            \e4\e$(7"Hx!"Rx!"Ur'"_\e0"H"R"U"_\e1\e(B
+;;;            \e$(7"7"G###C"U"7"G\e(B            \e$(7"H"R"U"_\e(B
 ;;;
 ;;;                             M
 ;;;             b s b s         h
@@ -167,7 +167,7 @@ The returned string has no composition information."
     ;; If 'a follows a consonant, turn it into the subjoined form.
     ;; * Disabled by Tomabechi 2000/06/09 *
     ;; Because in Unicode, \e$(7"A\e(B may follow directly a consonant without
-    ;; any intervening vowel, as in \e4\e$(7"9\e0"9\e1\e4""\e0"""Q\e1\e4"A\e0"A\e1!;\e(B=\e4\e$(7"9\e0"9\e1\e(B \e4\e$(7""\e0""\e1\e(B \e4\e$(7"A\e0"A\e1\e(B not \e4\e$(7"9\e0"9\e1\e(B \e4\e$(7""\e0""\e1\e(B \e$(7"Q\e(B \e4\e$(7"A\e0"A\e1\e(B
+    ;; any intervening vowel, as in \e$(7"9"""Q"A!;\e(B=\e$(7"9\e(B \e$(7""\e(B \e$(7"A\e(B not \e$(7"9\e(B \e$(7""\e(B \e$(7"Q\e(B \e$(7"A\e(B
     ;;(if (and (= char ?\e$(7"A\e(B)
     ;;      (aref (char-category-set (car last)) ?0))
     ;; (setq char ?\e$(7"R\e(B)) ;; modified for new font by Tomabechi 1999/12/10
@@ -189,7 +189,8 @@ The returned string has no composition information."
 
      ;; Compose lower vowel sign vertically under.
      ((aref (char-category-set char) ?3)
-      (if (eq char ?\e$(7"Q\e(B)         ;; `\e$(7"Q\e(B' should not visible when composed.
+      (if (or (eq char ?\e$(7"Q\e(B) ;; `\e$(7"Q\e(B' and `\e$,1FP\e(B' should not visible when composed.
+             (eq char #xF70))
          (setq rule nil)
        (setq rule stack-under)))
      ;; Transform ra-mgo (superscribed r) if followed by a subjoined
@@ -315,11 +316,21 @@ are decomposed into normal Tibetan character sequences."
     new))
 
 ;;;###autoload
-(defun tibetan-composition-function (from to pattern &optional string)
+(defun tibetan-composition-function (pos &optional string)
   (if string
-      (tibetan-compose-string string)
-    (tibetan-compose-region from to))
-  (- to from))
+      (if auto-compose-current-font
+         (if (eq (string-match "[\e$(7!0\e(B-\e$,1GQ\e(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 "[\e$(7!0\e(B-\e$,1GQ\e(B]+")
+           (or (font-shape-text pos (match-end 0) auto-compose-current-font)
+               pos)
+         (if (looking-at tibetan-composable-pattern)
+             (prog1 (match-end 0)
+               (tibetan-compose-region pos (match-end 0))))))))
 
 ;;;
 ;;; This variable is used to avoid repeated decomposition.