1 ;; Functions for dealing with char tables.
2 ;; Copyright (C) 1987 Free Software Foundation, Inc.
4 ;; This file is part of GNU Emacs.
6 ;; GNU Emacs is free software; you can redistribute it and/or modify
7 ;; it under the terms of the GNU General Public License as published by
8 ;; the Free Software Foundation; either version 1, or (at your option)
11 ;; GNU Emacs is distributed in the hope that it will be useful,
12 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
13 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 ;; GNU General Public License for more details.
16 ;; You should have received a copy of the GNU General Public License
17 ;; along with GNU Emacs; see the file COPYING. If not, write to
18 ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
21 ;; Written by Howard Gayle. See case-table.el for details.
25 (defun rope-to-vector (rope)
26 (let* ((len (/ (length rope) 2))
27 (vector (make-vector len nil))
30 (aset vector i (rope-elt rope i))
33 (defun describe-display-table (DT)
34 "Describe the display-table DT in a help buffer."
35 (with-output-to-temp-buffer "*Help*"
36 (princ "\nTruncation glyf: ")
38 (princ "\nWrap glyf: ")
40 (princ "\nEscape glyf: ")
42 (princ "\nCtrl glyf: ")
44 (princ "\nSelective display rope: ")
45 (prin1 (rope-to-vector (aref dt 260)))
46 (princ "\nCharacter display ropes:\n")
47 (let ((vector (make-vector 256 nil))
51 (if (stringp (aref dt i))
52 (rope-to-vector (aref dt i))
55 (describe-vector vector))
56 (print-help-return-message)))
58 (defun describe-current-display-table ()
59 "Describe the display-table in use in the selected window and buffer."
61 (describe-display-table
62 (or (window-display-table (selected-window))
64 standard-display-table)))
66 (defun make-display-table ()
67 (make-vector 261 nil))
69 (defun standard-display-8bit (l h)
70 "Display characters in the range [L, H] literally."
72 (if (and (>= l ?\ ) (< l 127))
73 (if standard-display-table (aset standard-display-table l nil))
74 (or standard-display-table
75 (setq standard-display-table (make-vector 261 nil)))
76 (aset standard-display-table l l))
79 (defun standard-display-ascii (c s)
80 "Display character C using string S."
81 (or standard-display-table
82 (setq standard-display-table (make-vector 261 nil)))
83 (aset standard-display-table c (apply 'make-rope (append s nil))))
85 (defun standard-display-g1 (c sc)
86 "Display character C as character SC in the g1 character set."
87 (or standard-display-table
88 (setq standard-display-table (make-vector 261 nil)))
89 (aset standard-display-table c
90 (make-rope (create-glyf (concat "\016" (char-to-string sc) "\017")))))
92 (defun standard-display-graphic (c gc)
93 "Display character C as character GC in graphics character set."
94 (or standard-display-table
95 (setq standard-display-table (make-vector 261 nil)))
96 (aset standard-display-table c
97 (make-rope (create-glyf (concat "\e(0" (char-to-string gc) "\e(B")))))
99 (defun standard-display-underline (c uc)
100 "Display character C as character UC plus underlining."
101 (or standard-display-table
102 (setq standard-display-table (make-vector 261 nil)))
103 (aset standard-display-table c
104 (make-rope (create-glyf (concat "\e[4m" (char-to-string uc) "\e[m")))))
106 (defun create-glyf (string)
108 (while (and (< i 65536) (aref glyf-table i)
109 (not (string= (aref glyf-table i) string)))
112 (error "No free glyf codes remain"))
113 (aset glyf-table i string)))
115 (provide 'disp-table)