From: tomo Date: Thu, 2 Sep 2004 14:25:41 +0000 (+0000) Subject: (chise-tex-encode-region-for-jis): New function. X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=76a6c41758b8cdcaa18f5efeac7e053b9b736ffb;p=chise%2Fomega.git (chise-tex-encode-region-for-jis): New function. (iso-2022-jp-tex-jis): New coding-system. --- diff --git a/chise2otf/elisp/chise-tex.el b/chise2otf/elisp/chise-tex.el index 307e353..b580985 100644 --- a/chise2otf/elisp/chise-tex.el +++ b/chise2otf/elisp/chise-tex.el @@ -79,6 +79,38 @@ (t (forward-char)))))))) +(defun chise-tex-encode-region-for-jis (start end) + (interactive "r") + (save-excursion + (save-restriction + (narrow-to-region start end) + (goto-char start) + (let (chr ret rest spec) + (while (and (skip-chars-forward "\x00-\xFF") + (not (eobp))) + (setq chr (char-after)) + (cond ((encode-char chr '=jis-x0208-1983) + (forward-char)) + ;; ((setq ret (encode-char chr '=jis-x0208-1990)) + ;; (delete-char) + ;; (insert (decode-char '=jis-x0208-1983 ret))) + ((catch 'tag + (setq rest chise-tex-coded-charset-expression-alist) + (while (setq spec (car rest)) + (if (setq ret (encode-char chr (car spec))) + (throw 'tag ret)) + (setq rest (cdr rest)))) + (delete-char) + ;; (if (eq (char-before) ?《) + ;; (insert " ")) + (insert (format (format "\\%s{%%0%d%s}" + (nth 1 spec) + (nth 2 spec) + (nth 3 spec)) + ret))) + (t + (forward-char)))))))) + (defun chise-tex-decode-region (start end) (interactive "r") (save-excursion @@ -121,6 +153,19 @@ mnemonic "pTeX(GB)/7bit" )) +(make-coding-system + 'iso-2022-jp-tex-jis 'iso2022 + "ISO-2022-JP with TeX representation for JIS fonts." + '(charset-g0 ascii + short t + seven t + input-charset-conversion ((latin-jisx0201 ascii) + (japanese-jisx0208-1978 japanese-jisx0208)) + pre-write-conversion chise-tex-encode-region-for-jis + post-read-conversion chise-tex-decode-region + mnemonic "pTeX(JIS)/7bit" + )) + ;;; @ End. ;;;