(chise-tex-encode-region-for-jis): Add settings for $_1$ and $_2$.
[chise/omega.git] / chise2otf / elisp / chise-tex.el
index 0f5e29c..230500a 100644 (file)
@@ -1,6 +1,6 @@
 ;;; chise-tex.el --- Coding-system based chise2otf like tool
 
-;; Copyright (C) 2004,2005,2006 MORIOKA Tomohiko
+;; Copyright (C) 2004,2005,2006,2007,2008 MORIOKA Tomohiko
 
 ;; Author: MORIOKA Tomohiko <tomo@kanji.zinbun.kyoto-u.ac.jp>
 ;; Keywords: OTF package, pTeX, CHISE, Multiscript, Multilingual
     (=gt-pj-10         "GTpjJ"         4 X)
     (=gt-pj-11         "GTpjK"         4 X)
     (=ruimoku-v6       "Ruimoku"       4 X)
-    (=ucs-bmp@cns      "UCScns"        4 X)))
+    (=hanziku-1                "HanzikuA"      4 X)
+    (=hanziku-2                "HanzikuB"      4 X)
+    (=hanziku-3                "HanzikuC"      4 X)
+    (=hanziku-4                "HanzikuD"      4 X)
+    (=hanziku-5                "HanzikuE"      4 X)
+    (=hanziku-6                "HanzikuF"      4 X)
+    (=hanziku-7                "HanzikuG"      4 X)
+    (=hanziku-8                "HanzikuH"      4 X)
+    (=hanziku-9                "HanzikuI"      4 X)
+    (=hanziku-10       "HanzikuJ"      4 X)
+    (=hanziku-11       "HanzikuK"      4 X)
+    (=hanziku-12       "HanzikuL"      4 X)
+    (=ucs-bmp@cns      "UCScns"        4 X)
+    ))
 
 (defun chise-tex-encode-region-for-gb (start end)
   (interactive "r")
                                      (cdr
                                       (assq (nth 1 ret)
                                             '((?\u0302
+                                               (?\u0300 . "CircGrave")
                                                (?\u0301 . "CircAcute")
                                                (?\u0303 . "CircTilde")
                                                (?\u0309 . "CircHook")
                                                )
+                                              (?\u031B
+                                               (?\u0301 . "HornAcute")
+                                               )
                                               (?\u0323
                                                (?\u0302 . "Circudot")
                                                )))))))
                ((eq chr ?\u2022)
                 (delete-char)
                 (insert "\\textbullet{}"))
+               ((eq chr ?\u2081)
+                (delete-char)
+                (insert "$_1$"))
+               ((eq chr ?\u2082)
+                (delete-char)
+                (insert "$_2$"))
                ((eq chr ?\u2083)
                 (delete-char)
                 (insert "$_3$"))
       (narrow-to-region start end)
       (goto-char start)
       (let (macro code ret me rest spec)
+       (while (re-search-forward "\\\\\\(.\\){\\(.\\)}" nil t)
+         (when (and
+                (setq macro
+                      (assq
+                       (aref (match-string 1) 0)
+                       '((?\` . ?\u0300) ; <COMBINING GRAVE ACCENT>
+                         (?\' . ?\u0301) ; <COMBINING ACUTE ACCENT>
+                         (?^  . ?\u0302) ; <COMBINING CIRCUMFLEX ACCENT>
+                         (?~  . ?\u0303) ; <COMBINING TILDE>
+                         (?=  . ?\u0304) ; <COMBINING MACRON>
+                         (?\. . ?\u0307) ; <COMBINING DOT ABOVE>
+                         (?\" . ?\u0308) ; <COMBINING DIAERESIS>
+                         (?d  . ?\u0323) ; <COMBINING DOT BELOW>
+                         )))
+                (setq ret
+                      (cdr (assq (cdr macro)
+                                 (char-feature (aref (match-string 2) 0)
+                                               'composition)))))
+           (delete-region (match-beginning 0)(match-end 0))
+           (insert ret)))
+       (goto-char start)
        (while (re-search-forward "\\\\\\([a-zA-Z0-9]+\\){\\([0-9A-Fa-f]+\\)}"
                                  nil t)
          (setq macro (match-string 1)
  '(charset-g0 ascii
    short t
    seven t
-   input-charset-conversion ((latin-jisx0201 ascii)
-                            (japanese-jisx0208-1978 japanese-jisx0208))
+   ;; input-charset-conversion ((latin-jisx0201 ascii)
+   ;;                       (japanese-jisx0208-1978 japanese-jisx0208))
    pre-write-conversion chise-tex-encode-region-for-gb
    post-read-conversion chise-tex-decode-region
    mnemonic "pTeX(GB)/7bit"
    ccs-priority-list (ascii
                      =jis-x0208@1983 =jis-x0208@1978
                      latin-jisx0201)
+   ;; output-charset-conversion ((=jis-x0208@1990 =jis-x0208@1983))
    pre-write-conversion chise-tex-encode-region-for-jis
    post-read-conversion chise-tex-decode-region
    mnemonic "pTeX(JIS)/7bit"