1 ;;; char-table.el --- display table of charset
3 ;; Copyright (C) 1996,1997 MORIOKA Tomohiko
5 ;; Author: MORIOKA Tomohiko <morioka@jaist.ac.jp>
6 ;; Version: $Id: char-table.el,v 1.1.1.1 1998-01-14 06:35:19 steve Exp $
7 ;; Keywords: character, mule
9 ;; This file is part of tl (Tiny Library).
11 ;; This program is free software; you can redistribute it and/or
12 ;; modify it under the terms of the GNU General Public License as
13 ;; published by the Free Software Foundation; either version 2, or (at
14 ;; your option) any later version.
16 ;; This program is distributed in the hope that it will be useful, but
17 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 ;; General Public License for more details.
21 ;; You should have received a copy of the GNU General Public License
22 ;; along with GNU Emacs; see the file COPYING. If not, write to the
23 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
24 ;; Boston, MA 02111-1307, USA.
28 (defsubst char-position-to-string (charset r l &optional plane)
31 (make-char charset plane (+ (* r 16) l))
32 (make-char charset (+ (* r 16) l))
35 (defsubst char-table-1 (charset r l plane)
36 (let* ((str (char-position-to-string charset r l plane))
37 (lp (- 3 (string-width str)))
43 (concat (make-string lp ? ) str (make-string rp ? ))
46 (defun insert-94-charset-table (charset &optional plane ofs)
51 "[%02x]
\e$B("
\e(B 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F\n"
53 (insert "
\e$B(!(!(+(!(!(!(!(!(!(!(!(!(!(!(!(!(!(!(!(!(!(!(!(!(!(!(!
\e(B\n")
55 (insert (format "%02x%x
\e$B("
\e(B " (or plane 0) (* (+ j ofs) 16)))
58 (insert (char-table-1 charset j k plane))
65 (insert (format "%02x%x
\e$B("
\e(B" (or plane 0) (* (+ j ofs) 16)))
68 (insert (char-table-1 charset j k plane))
75 (insert (format "%02x%x
\e$B("
\e(B" (or plane 0) (* (+ j ofs) 16)))
78 (insert (char-table-1 charset j k plane))
85 (defun insert-96-charset-table (charset &optional plane ofs)
90 "[%02x]
\e$B("
\e(B 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F\n"
92 (insert "
\e$B(!(!(+(!(!(!(!(!(!(!(!(!(!(!(!(!(!(!(!(!(!(!(!(!(!(!(!
\e(B\n")
95 (insert (format "%02x%x
\e$B("
\e(B" (or plane 0) (* (+ j ofs) 16)))
98 (insert (char-table-1 charset j k plane))
106 (defun insert-94x94-charset-table (charset)
107 (insert-94-charset-table charset 33)
110 (insert "
\e$B(,(,(;(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,
\e(B\n")
111 (insert-94-charset-table charset i)
115 (defun insert-96x96-charset-table (charset)
116 (insert-96-charset-table charset 32)
119 (insert "
\e$B(,(,(;(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,
\e(B\n")
120 (insert-96-charset-table charset i)
124 (defun insert-charset-table (charset)
125 "Insert character table of CHARSET."
126 (insert "
\e$B(,(,(8(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,
\e(B\n")
127 (let ((cc (charset-chars charset))
128 (cd (charset-dimension charset))
132 (insert-94-charset-table charset)
135 (insert-96-charset-table charset)
140 (insert-94x94-charset-table charset)
143 (insert-96x96-charset-table charset)
146 (insert "
\e$B(,(,(:(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,
\e(B\n")
150 (defun view-charset (charset)
151 "Display character table of CHARSET."
157 (cons (charset-doc-string charset) charset)
160 (cdr (assoc (completing-read "What charset: "
161 charset-alist nil t nil)
164 (let* ((desc (charset-doc-string charset))
165 (buf (concat "*Charset table for "
166 (charset-doc-string charset)
168 (unless (get-buffer buf)
169 (let ((the-buf (current-buffer)))
170 (set-buffer (get-buffer-create buf))
171 (insert (format "%s (%s)\n" desc charset))
172 (let ((msg (format "Generating char table for %s..." desc)))
174 (insert-charset-table charset)
175 (message "%s Done." msg)
177 (set-buffer-modified-p nil)
178 (goto-char (point-min))
188 (provide 'char-table)
190 ;;; char-table.el ends here