(chise-tex-encode-ucs-char-at-point): Add setting for U+0250, U+0254,
[chise/uptex-chise.git] / elisp / chise-tex.el
index 3760ef7..a56484b 100644 (file)
@@ -1,6 +1,6 @@
 ;;; chise-tex.el --- Coding-system based chise2otf like tool
 
-;; Copyright (C) 2004,2005,2006,2007,2008 MORIOKA Tomohiko
+;; Copyright (C) 2004,2005,2006,2007,2008,2009 MORIOKA Tomohiko
 
 ;; Author: MORIOKA Tomohiko <tomo@kanji.zinbun.kyoto-u.ac.jp>
 ;; Keywords: OTF package, pTeX, CHISE, Multiscript, Multilingual
       (delete-char)
       (insert "{\\usefont{T1}{pxr}{m}{n}\\ng}")
       t)
+     ((eq chr ?\u0250)
+      (delete-char)
+      (insert "\\textturna{}")
+      t)
+     ((eq chr ?\u0254)
+      (delete-char)
+      (insert "\\textopeno{}")
+      t)
+     ((eq chr ?\u0264)
+      (delete-char)
+      (insert "\\textramshorns{}")
+      t)
+     ((eq chr ?\u026F)
+      (delete-char)
+      (insert "\\textturnm{}")
+      t)
      ((eq chr ?\u0282)
       (delete-char)
       (insert "{\\usefont{T1}{pxr}{m}{n}\\k{s}}")
       t)
      ((eq chr ?\u0294)
       (delete-char)
-      (insert "\\UCSjis{0294}")
+      ;; (insert "\\UCSjis{0294}")
+      (insert "\\textglotstop{}")
       t)
      ((eq chr ?\u2022)
       (delete-char)
            (if (eq font-encoding 'T2A)
                (forward-char)
              (setq pos (point))
-             (unless (and (prog1
-                              (search-backward
-                               "\\fontencoding{T2A}\\selectfont{}" nil t)
-                            (goto-char pos))
-                          (eq pos (match-end 0)))
-               (insert "\\fontencoding{T2A}\\selectfont{}")
-               )
-             (forward-char)
-             (setq font-encoding 'T2A))
+              ;; (unless (and (prog1
+              ;;                  (search-backward
+              ;;                   "\\fontencoding{T2A}\\selectfont{}" nil t)
+              ;;                (goto-char pos))
+              ;;              (eq pos (match-end 0)))
+              ;;   (insert "\\fontencoding{T2A}\\selectfont{}")
+              ;;   )
+             (if (search-backward "\\CyrillicScript{"
+                                  (- pos (eval-when-compile
+                                           (length "\\CyrillicScript{")))
+                                  t)
+                 (search-forward "}" nil t)
+               (insert "\\CyrillicScript{")
+               (forward-char)
+               (skip-chars-forward "---\u0400-\u04F9 ")
+               (insert "}"))
+              ;; (setq font-encoding 'T2A)
+             )
            )
           ((and (setq ret (encode-char chr '=ucs))
                 (and (<= #x0374 ret)(<= ret #x03F3)))
            (if (eq font-encoding 'LGR)
                (forward-char)
              (setq pos (point))
-             (unless (and (prog1
-                              (search-backward
-                               "\\fontencoding{LGR}\\selectfont{}" nil t)
-                            (goto-char pos))
-                          (eq pos (match-end 0)))
-               (insert "\\fontencoding{LGR}\\selectfont{}")
-               )
-             (forward-char)
-             (setq font-encoding 'LGR))
-           (skip-chars-forward "\u0374-\u03F3")
-           (unless (eq font-encoding 'T1)
-             (unless (looking-at
-                      "\\\\fontencoding{T1}\\\\selectfont{}")
-               (insert "\\fontencoding{T1}\\selectfont{}")
-               )
-             (setq font-encoding 'T1))
+              ;; (unless (and (prog1
+              ;;                  (search-backward
+              ;;                   "\\fontencoding{LGR}\\selectfont{}" nil t)
+              ;;                (goto-char pos))
+              ;;              (eq pos (match-end 0)))
+              ;;   (insert "\\fontencoding{LGR}\\selectfont{}")
+              ;;   )
+             (if (search-backward "\\GreekScript{"
+                                  (- pos (eval-when-compile
+                                           (length "\\GreekScript{")))
+                                  t)
+                 (search-forward "}" nil t)
+               (insert "\\GreekScript{")
+               (forward-char)
+               (skip-chars-forward "\u0374-\u03F3 ")
+               (insert "}"))
+              ;; (setq font-encoding 'LGR)
+             )
+           ;; (unless (eq font-encoding 'T1)
+            ;;   (unless (looking-at
+            ;;            "\\\\fontencoding{T1}\\\\selectfont{}")
+            ;;     (insert "\\fontencoding{T1}\\selectfont{}")
+            ;;     )
+            ;;   (setq font-encoding 'T1))
            )
           (t
            (unless (eq font-encoding 'T1)