comparison lisp/disp-table.el @ 52948:5044018cd79c

* disp-table.el (standard-display-8bit) (standard-display-default, standard-display-ascii) (standard-display-g1, standard-display-graphic) (standard-display-underline): Assure that standard-display-table is a display table.
author Kenichi Handa <handa@m17n.org>
date Tue, 28 Oct 2003 06:52:20 +0000
parents 695cf19ef79e
children b925e3274547
comparison
equal deleted inserted replaced
52947:3c1778936dff 52948:5044018cd79c
111 (message "No display table")))) 111 (message "No display table"))))
112 112
113 ;;;###autoload 113 ;;;###autoload
114 (defun standard-display-8bit (l h) 114 (defun standard-display-8bit (l h)
115 "Display characters in the range L to H literally." 115 "Display characters in the range L to H literally."
116 (or standard-display-table
117 (setq standard-display-table (make-display-table)))
116 (while (<= l h) 118 (while (<= l h)
117 (if (and (>= l ?\ ) (< l 127)) 119 (if (and (>= l ?\ ) (< l 127))
118 (aset standard-display-table l nil) 120 (aset standard-display-table l nil)
119 (aset standard-display-table l (vector l))) 121 (aset standard-display-table l (vector l)))
120 (setq l (1+ l)))) 122 (setq l (1+ l))))
121 123
122 ;;;###autoload 124 ;;;###autoload
123 (defun standard-display-default (l h) 125 (defun standard-display-default (l h)
124 "Display characters in the range L to H using the default notation." 126 "Display characters in the range L to H using the default notation."
127 (or standard-display-table
128 (setq standard-display-table (make-display-table)))
125 (while (<= l h) 129 (while (<= l h)
126 (if (and (>= l ?\ ) (char-valid-p l)) 130 (if (and (>= l ?\ ) (char-valid-p l))
127 (aset standard-display-table l nil)) 131 (aset standard-display-table l nil))
128 (setq l (1+ l)))) 132 (setq l (1+ l))))
129 133
131 ;; For that, you need to go through create-glyph. Use one of the 135 ;; For that, you need to go through create-glyph. Use one of the
132 ;; other functions below, or roll your own. 136 ;; other functions below, or roll your own.
133 ;;;###autoload 137 ;;;###autoload
134 (defun standard-display-ascii (c s) 138 (defun standard-display-ascii (c s)
135 "Display character C using printable string S." 139 "Display character C using printable string S."
140 (or standard-display-table
141 (setq standard-display-table (make-display-table)))
136 (aset standard-display-table c (vconcat s))) 142 (aset standard-display-table c (vconcat s)))
137 143
138 ;;;###autoload 144 ;;;###autoload
139 (defun standard-display-g1 (c sc) 145 (defun standard-display-g1 (c sc)
140 "Display character C as character SC in the g1 character set. 146 "Display character C as character SC in the g1 character set.
141 This function assumes that your terminal uses the SO/SI characters; 147 This function assumes that your terminal uses the SO/SI characters;
142 it is meaningless for an X frame." 148 it is meaningless for an X frame."
143 (if (memq window-system '(x w32)) 149 (if (memq window-system '(x w32))
144 (error "Cannot use string glyphs in a windowing system")) 150 (error "Cannot use string glyphs in a windowing system"))
151 (or standard-display-table
152 (setq standard-display-table (make-display-table)))
145 (aset standard-display-table c 153 (aset standard-display-table c
146 (vector (create-glyph (concat "\016" (char-to-string sc) "\017"))))) 154 (vector (create-glyph (concat "\016" (char-to-string sc) "\017")))))
147 155
148 ;;;###autoload 156 ;;;###autoload
149 (defun standard-display-graphic (c gc) 157 (defun standard-display-graphic (c gc)
150 "Display character C as character GC in graphics character set. 158 "Display character C as character GC in graphics character set.
151 This function assumes VT100-compatible escapes; it is meaningless for an 159 This function assumes VT100-compatible escapes; it is meaningless for an
152 X frame." 160 X frame."
153 (if (memq window-system '(x w32)) 161 (if (memq window-system '(x w32))
154 (error "Cannot use string glyphs in a windowing system")) 162 (error "Cannot use string glyphs in a windowing system"))
163 (or standard-display-table
164 (setq standard-display-table (make-display-table)))
155 (aset standard-display-table c 165 (aset standard-display-table c
156 (vector (create-glyph (concat "\e(0" (char-to-string gc) "\e(B"))))) 166 (vector (create-glyph (concat "\e(0" (char-to-string gc) "\e(B")))))
157 167
158 ;;;###autoload 168 ;;;###autoload
159 (defun standard-display-underline (c uc) 169 (defun standard-display-underline (c uc)
160 "Display character C as character UC plus underlining." 170 "Display character C as character UC plus underlining."
171 (or standard-display-table
172 (setq standard-display-table (make-display-table)))
161 (aset standard-display-table c 173 (aset standard-display-table c
162 (vector 174 (vector
163 (if window-system 175 (if window-system
164 (logior uc (lsh (face-id 'underline) 19)) 176 (logior uc (lsh (face-id 'underline) 19))
165 (create-glyph (concat "\e[4m" (char-to-string uc) "\e[m")))))) 177 (create-glyph (concat "\e[4m" (char-to-string uc) "\e[m"))))))